SEND_CMD MOVWF temp2 ;4 BITLIK
Lcd ICIN???????????????
CALL BUSY ; Character to be sent is in W
movf temp2,w ; Wait for LCD to be ready
ANDLW 0xf0 ; Get upper nibble
MOVWF PORT_B ; Send data to LCD
BCF PORT_A,lcdrw ; Set LCD to read
nop
NOP
BCF PORT_A,lcdrs ; Set LCD to command mode
nop
NOP
BSF PORT_A,lcde ; toggle E for LCD
nop
NOP
BCF PORT_A,lcde
swapF temp2,W
ANDLW 0xf0 ; Get lower nibble
MOVWF PORT_B ; Send data to LCD
BSF PORT_A,lcde ; toggle E for LCD
nop
NOP
BCF PORT_A,lcde
RETURN
;--------------------------------
BUSY ;4 býtlýk için
CLRF PORT_B ;** Have PORTB<3:0> output low
MOVLW B'10000000' ; Set PortB for input
TRIS PORT_B
BCF PORT_A,lcdrs ; Set LCD for Command mode
nop
NOP
BSF PORT_A,lcdrw ; Setup to read busy flag
nop
NOP
BSF PORT_A,lcde ; Set E high
nop
NOP
BCF PORT_A,lcde ; Set E low
BTFSC PORT_B,7 ; Read lower nibble busy flag, DDRam ADR_Less
GOTO BUSY ; If busy, check again
BCF PORT_A,lcdrw
CLRW ;
TRIS PORT_B ; RB7 - 4 = inputs, RB3 - 0 = output
RETURN
;*********************
;*********************************
INITDISPLAY CLRF PORT_B
CLRF PORT_A
CLRW
TRIS PORT_A
clrf status
CALL WAIT
CALL WAIT
MOVLW B'00101000' ;4 BIT
bsf status,5
bsf status,6
CALL SEND_CMD
clrf status
CALL WAIT
bsf status,5
bsf status,6
MOVLW B'00001100' ;dsp on
CALL SEND_CMD
clrf status
CALL WAIT
bsf status,5
bsf status,6
MOVLW B'00000001' ;CLEAR DSPLY
CALL SEND_CMD
clrf status
CALL WAIT
bsf status,5
bsf status,6
MOVLW B'00000110' ;ENTRY MODE
CALL SEND_CMD
clrf status
CALL WAIT
bsf status,5
bsf status,6
MOVLW B'10000000' ;ADRES
CALL SEND_CMD
bcf status,6
bsf status,5
GOTO GERI
***********************
;********************************
HATA MOVLW '.'
CALL SEND_CHR
MOVLW '.'
CALL SEND_CHR
MOVLW '.'
CALL SEND_CHR
MOVLW '.'
CALL SEND_CHR
MOVLW '.'
CALL SEND_CHR
MOVLW ' '
CALL SEND_CHR
MOVLW 'H'
CALL SEND_CHR
MOVLW 'A'
CALL SEND_CHR
MOVLW 'T'
CALL SEND_CHR
MOVLW 'A'
CALL SEND_CHR
MOVLW ' '
CALL SEND_CHR
MOVLW '.'
CALL SEND_CHR
bcf flag,hata
GOTO TELEF1
Çalışan bir programdan size lazım olabilecek kısımları kesip yapıştırdım.Ufak tefek degişikliklerle kendinize uygun halae getirip kullanabilirsiniz.
Yok hala yapamadım derseniz özelden mail adresinizi gönderirseniz 20 yıl evvel yaptıgım kartbasma saati programının tamamını gönderebilirim.