
Подскажите, пожалуйста, что может быть неправильного в приведенной ниже программульке в процессе инициализации ЖКИ WH2004L.
замучался просто, сколько не переписывал программу, индикатор, как неживой ;(
Описание ЖК здесь...Нажмите для просмотра прикрепленного файла
Заранее благодарю.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;ATmega88 - 20MHz ;;;
;;;PD0-PD7= DB0-DB7 ;;;
;;;PB1=E ;;;
;;;PC4=RS ;;;
;;;PC5=R/W ;;;
;;;?E WH2004L 20x4 ;;;
;;;8bit ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.include "m88def.inc"
.def tmp=r16
.def tmp1=r17
ldi tmp, high(ramend)
out SPH, tmp
ldi tmp, low(ramend)
out SPL, tmp
main:
ldi tmp,$ff ; PORT D,B,C
out DDRD,tmp ; Vyvody
out DDRB,tmp ;
out DDRC,tmp ;
startinit_LCD:
rcall delay_40ms
ldi tmp,$30 ; 8 bit interface, 2stroki, 5x8
rcall DispCmd
rcall Delay_40us
ldi tmp,$30 ; 8 bit interface, 2stroki, 5x8
rcall DispCmd
rcall Delay_40us
ldi tmp,$F ; aee??eou ?EE. aee??eou eo?ni?, naaeaou aai ieaa?uei
rcall DispCmd
rcall Delay_40us
ldi tmp,1 ; Display clear
rcall DispCmd
rcall Delay_1_6ms
ldi tmp,6 ; onoaiiaea iai?aaeaiey naaeaa eo?ni?a ai?aai
rcall dispcmd
rcall delay_40us
; end startinit_LCD
ldi tmp,$38 ; 8 bit interface, 2stroki, 5x8
rcall DispCmd
rcall Delay_40us
ldi r18,$30
next: rcall DispData
rcall delay_40us
inc r18
cpi r18,$40
brne next
end: rjmp end
delay_40us:
ldi tmp,2
label2:
ldi tmp1,133
label1:
dec tmp1
brne label1
dec tmp
brne label2
ret
delay_40ms:
ldi tmp,255
label4:
ldi tmp1,255
label3:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
dec tmp1
brne label3
dec tmp
brne label4
ret
delay_1_6ms:
ldi tmp,10
label6:
ldi tmp1,255
label5:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
dec tmp1
brne label5
dec tmp
brne label6
ret
DispCmd:
cbi PORTB, 1 ; RS = 0 - commandy
sbi PORTC, 5 ; E = 1
nop
out PORTD, tmp
nop
nop
nop
cbi PORTC, 5 ;E=0 strob
nop
out PORTD,tmp
nop
nop
nop
nop
nop
nop
nop
nop
sbi PORTC,5
ret
Dispdata:
sbi PORTB, 1 ; RS = 1 - dannye
sbi PORTC, 5 ; E = 1
nop
out PORTD, tmp
nop
nop
nop
cbi PORTC, 5 ;E=1 strob
nop
out PORTD,tmp
nop
nop
nop
nop
nop
nop
nop
nop
sbi PORTC,5
ret