Peter Nabil
New Member
Hi every single one how r u doing??
Well i have an LCD HD44780U (16 pin) and i wanna connect it to the AT 89c51 and so i did but the problem is when i open the cct. nothing at all appears on the LCD although every thing is connected very well so if u PlZ read my program and tell me if there is any thing wrong with it thax a loooooot
ORG 0H ;
Mov A, #38 H ; Init LCD 2 lines, 5*7 Matrix
LCALL Command ; Issue command
LCALL Sarah ;
Mov A, # 'A' ;
Mov R0, # 30 H; RAM address pointer
Mov R1, # 40 ; counter
Again: Mov @R0, A ;
I NC R0;
DJNZ R1, Again
Mov R2, # 16 ; counter
Mov R0, # 30 H ; RAM address pointer
LCALL Juliet
Mov A, # 40 ; write at the second line
LCALL Command
Mov R2, #16 ; counter
Mov R0, # 30 H ; pointer
LCALL Juliet
Juliet: Mov A, @R0 ; Move from RAM to A
LCALL Romeo
INC R0 ; increment pointer
DJNZ R2, Juliet ;
LCALL LCD_Delay ; 2 Seconds delay
RET
Sarah: Mov A, #0E H ; LCD on, cursor on
LCALL Command ; issue command
Mov A, #01 H ; Clear LCD command
LCALL Command ; issue command
Mov A, #06 H ; Shift cursor right
LCALL Command ; issue command
Mov A, #80H ; Move to the 2nd line
LCALL Command ; issue command
RET
Command: ACALL Ready
Mov P1, A
CLR P2.5
CLR P2.6
SETB P2.7
CLR P2.7
RET
Romeo: ACALL Ready
Mov P1, A
SETB P2.5
CLR P2.6
SETB P2.7
CLR P2.7
RET
Ready: SETB P1.7
CLR P2.5
SETB P2.6
Back: CLR P2.7
SETB P2.7
JB P1.7, Back
RET
LCD_Delay: Mov R4, #07
Pet: Mov R5, #255
Mag: Mov R6, #255
Hera: NOP
NOP
DJNZ R6, Hera
DJNZ R5, Mag
DJNZ R4, Pet
RET
END
Thx again
[/b]
Well i have an LCD HD44780U (16 pin) and i wanna connect it to the AT 89c51 and so i did but the problem is when i open the cct. nothing at all appears on the LCD although every thing is connected very well so if u PlZ read my program and tell me if there is any thing wrong with it thax a loooooot
ORG 0H ;
Mov A, #38 H ; Init LCD 2 lines, 5*7 Matrix
LCALL Command ; Issue command
LCALL Sarah ;
Mov A, # 'A' ;
Mov R0, # 30 H; RAM address pointer
Mov R1, # 40 ; counter
Again: Mov @R0, A ;
I NC R0;
DJNZ R1, Again
Mov R2, # 16 ; counter
Mov R0, # 30 H ; RAM address pointer
LCALL Juliet
Mov A, # 40 ; write at the second line
LCALL Command
Mov R2, #16 ; counter
Mov R0, # 30 H ; pointer
LCALL Juliet
Juliet: Mov A, @R0 ; Move from RAM to A
LCALL Romeo
INC R0 ; increment pointer
DJNZ R2, Juliet ;
LCALL LCD_Delay ; 2 Seconds delay
RET
Sarah: Mov A, #0E H ; LCD on, cursor on
LCALL Command ; issue command
Mov A, #01 H ; Clear LCD command
LCALL Command ; issue command
Mov A, #06 H ; Shift cursor right
LCALL Command ; issue command
Mov A, #80H ; Move to the 2nd line
LCALL Command ; issue command
RET
Command: ACALL Ready
Mov P1, A
CLR P2.5
CLR P2.6
SETB P2.7
CLR P2.7
RET
Romeo: ACALL Ready
Mov P1, A
SETB P2.5
CLR P2.6
SETB P2.7
CLR P2.7
RET
Ready: SETB P1.7
CLR P2.5
SETB P2.6
Back: CLR P2.7
SETB P2.7
JB P1.7, Back
RET
LCD_Delay: Mov R4, #07
Pet: Mov R5, #255
Mag: Mov R6, #255
Hera: NOP
NOP
DJNZ R6, Hera
DJNZ R5, Mag
DJNZ R4, Pet
RET
END
Thx again
[/b]