lcd 89c51
Hi all,
i m trying to interface a GLCD with 89c51. i am facing some problem because i m doing it first time. when i power up the circuit LCD back light is on and dots are highlighted but the data is not on display.
below is the connection diagram from 89c51 to GLCD
i m using JHD12864A GLCD.
here is the program code
ORG 00H
MOV A,#38H ;INIT. LCD 2 Lines, 5*7 Matrix
ACALL COMNWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#0EH ;Display ON, Cursor ON
ACALL COMNWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#01H ;Clear LCD
ACALL COMNWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#06H ;Shift Cursor right
ACALL COMNWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#84H ;Cursor at live 1, pos. 4
ACALL COMNWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#'A' ;Display Letter 'A'
ACALL DATAWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#'L' ;Display Letter 'L'
ACALL DATAWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#'L' ;Display Letter 'L'
ACALL DATAWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#'A' ;Display Letter 'A'
ACALL DATAWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
MOV A,#'H' ;Display Letter 'H'
ACALL DATAWRT ;CALL Command subroutine
ACALL DELAY ;Give LCD some time
AGAIN: SJMP AGAIN ;Stay Here
COMNWRT:
MOV P2,A ;Copy register A to LCD
CLR P0.7 ;R/S = 0 for command
CLR P1.6 ;R/W=0 for write
SETB P1.7 ;E=1 for high pulse
ACALL DELAY ;Give LCD some time
CLR P1.7 ;E=0 FOR High to loe pulse
RET
DATAWRT: MOV P2,A ;Copy register A to LCD
SETB P0.7 ;R/S = 1 for DATA
CLR P1.6 ;R/W=0 for write
SETB P1.7 ;E=1 for high pulse
ACALL DELAY ;Give LCD some time
CLR P1.7 ;E=0 FOR High to loe pulse
RET
DELAY: MOV R3,#50
HER: MOV R4,#255
HERE: DJNZ R4,HERE
DJNZ R3,HER
RET
END