ramyadhadidi
Junior Member level 1
I have problems with interfacing LCD with AT89C52, I read all posts but...won't help me
this is my assembly code
delay2 is 25ms
I change my code in some way, it is correct in PROTEUS but when I conncet it to LCD (JHD162A) I see many problems:
characters isn't correct.
I have 2 lines but on second line nothing is written.
checking busy flag does't work. I see nothing.
reset button on my 89c52 doesn't reset LCD.
and very serious problem, LCD is very dependent to power, I regulate power with capacitor and diode it got better but not solved.
also it is very dependent to the way i conncet power!
I try this on university with better equipment but I have same problem
please help me,is code correct?
and if it is correct why I have these problems with all LCDs?
this is my assembly code
Code:
LCD: MOV A,#38H ;write LCD
ACALL COMNWRT
ACALL DELAY2
MOV A,#0EH
ACALL COMNWRT
ACALL DELAY2
MOV A,#01H
ACALL COMNWRT
ACALL DELAY2
MOV A,#06H
ACALL COMNWRT
ACALL DELAY2
MOV A,#84H
ACALL COMNWRT
ACALL DELAY2
MOV A,#'X'
ACALL DATAWRT
ACALL DELAY2
MOV A,#':'
ACALL DATAWRT
ACALL DELAY2
MOV A,R3
ACALL HEX2ASCH
ACALL DATAWRT
ACALL DELAY2
MOV A,R3
ACALL HEX2ASCL
ACALL DATAWRT
ACALL DELAY2
;MOV A,#0CAH
;ACALL COMNWRT
;ACALL DELAY2
;ACALL DELAY2
MOV A,#'Y'
ACALL DATAWRT
ACALL DELAY2
MOV A,#':'
ACALL DATAWRT
ACALL DELAY2
MOV A,R2
ACALL HEX2ASCH
ACALL DATAWRT
ACALL DELAY2
MOV A,R2
ACALL HEX2ASCL
ACALL DATAWRT
ACALL DELAY2
RET
COMNWRT: MOV LCDDB,A ;for writing LCD commands
CLR RS
CLR RW
SETB E
CLR E
RET
DATAWRT: MOV LCDDB,A ;for writing LCD datas
SETB RS
CLR RW
SETB E
CLR E
RET
;READY: SETB P1.7
; CLR RS
; SETB RW
;AGAIN1: CLR E
; SETB E
; JB P1.7,AGAIN1
; RET
I change my code in some way, it is correct in PROTEUS but when I conncet it to LCD (JHD162A) I see many problems:
characters isn't correct.
I have 2 lines but on second line nothing is written.
checking busy flag does't work. I see nothing.
reset button on my 89c52 doesn't reset LCD.
and very serious problem, LCD is very dependent to power, I regulate power with capacitor and diode it got better but not solved.
also it is very dependent to the way i conncet power!
I try this on university with better equipment but I have same problem
please help me,is code correct?
and if it is correct why I have these problems with all LCDs?