Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LCD second line working in proteus but not in reality?

Status
Not open for further replies.

shockoshocko

Junior Member level 1
Joined
Jul 28, 2009
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,394
I can print text on the first line but nothing appears on the second line at all, although in proteus simulation both lines work OK, I am using the code found in 8051projects.net tutorial, plz i want to know what could make the simulation differ from reality, i have spent too much time on the issue, and can't find the solution.



here are the subroutines used:

INIT_LCD:

MOV A,#38H
LCALL LCD_CMD
MOV A,#0EH
LCALL LCD_CMD
MOV A,#01H
LCALL LCD_CMD
MOV A,#06H
LCALL LCD_CMD
MOV A,#80H
LCALL LCD_CMD
RET

CLR_LCD:

MOV A,#01H
LCALL LCD_CMD
RET

WAIT_LCD:

MOV R7,#35H
BACK:
MOV R6,#0FFH
DJNZ R6,$
DJNZ R7,BACK
RET

LCD_CMD:

MOV DAT,A
CLR RS
CLR RW
SETB EN
CLR EN
LCALL WAIT_LCD
RET

LCD_WRT:

SETB RS
CLR RW
MOV DAT,A
SETB EN
CLR EN
LCALL WAIT_LCD
RET

LCD_STRING:

CLR A
MOVC A,@A+DPTR
JZ EXIT
LCALL LCD_WRT
INC DPTR
SJMP LCD_STRING
EXIT:
RET

SECOND_LINE:

MOV A,#0C0H
LCALL LCD_CMD
RET
 

What LCD you are using? is it HD44780U based LCD?

If it is different then the starting address of second line may be different.

Nandhu
 

I tried three different HD44780 16x2 and all have the same problem.

Added after 5 hours:

The second line works if i call the INIT_LCD subroutine more than one time,before sending any data to the lcd, anybody knows why?

MAIN:

LCALL INIT_LCD
LCALL INIT_LCD
MOV DPTR,#HELLO
LCALL LCD_STRING
LCALL SECOND_LINE
MOV DPTR,#WORLD
LCALL LCD_STRING
SJMP $
 

Try sending a 41+ char string to the LCD...
Normally, a 16x2 LCD has a memory of 80 locations. First row is locations 0-15 and the second line is locations 40-55.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top