LCD Code

Thread Starter

BrendanCarroll

Joined Jan 20, 2009
8
Hello all
I cannot write text to the second line of a 2 x 40 LCD. Does anyone have a working example or help on this issue. I am using an 8051 microcontroller and an LM108L (HD44780)LCD.
I am writing the code in assembly.
I have attached my code and any help would be greatly appreciated.
HELP
Thanks all

Brendan
 

Attachments

Thread Starter

BrendanCarroll

Joined Jan 20, 2009
8
I have read through this site and others but still to no avail. I am declaring all variables but still cannot get the cursor onto the second row of the LCD. I have directed the cursor to goto the HEX number corresponding to the second row and again it will not run. Please help. I can forward the code if anyone wishes.

Thanks again

Brendan
 

RiJoRI

Joined Aug 15, 2007
536
A method we use here at work is to declare a 32-byte message (our displays are 2x16), such as "****DISARMED**** READY TO ARM " and send that, letting the display worry about wrap-around. This does lead to "byte-rulers"
Rich (BB code):
;            0123456789ABCDEF0123456789ABCDEF
Msg1: .byte '****DISARMED****  READY TO ARM  '
Note the trailing spaces to wipe any message that was previously on the display.

--Rich
 

Dutar

Joined Jan 27, 2009
13
Check your LCD initialization code. Normally DB3 in function set refers to number of lines with 0 for 1 line and 1 for 2 lines

Hope this would help
 

Dutar

Joined Jan 27, 2009
13
I checked your code in the attached file and looks like you are setting the 2 line mode. But you seems to be sending function control and display control in a single word. In my case I use 4-bit word mode so I use the sequence:
LCD_INIT[4] = {0x28, 0x08, 1, 6}
I send each of them with a 40us gap and it works fine with me. Good luck!
 

Thread Starter

BrendanCarroll

Joined Jan 20, 2009
8
Hey Dutar I am not 100% sure what you mean. I am using 8 bit word mode and I really don't know what you mean by the following
LCD_INIT[4] = {0x28, 0x08, 1, 6}
Would there be any chance I can see the relevant part of your code as I would greatly appreciate it as I do appreciate your replies.
I have been trying to egt characters onto line 2 for a whole month and its driving me mad so I would be forever grateful for help.

Many thanks

Brendan
 

Dutar

Joined Jan 27, 2009
13
Hey Brendon, that syntax is in C, but anyway you also do the same in your code. I was referring to the function INIT_LCD in your code (it is in page 6 of your attachment). I attached the C code I use with dsPIC (lcd.txt). With dsPIC, TRIS refers to the direction setting register and LATE refers to the data I/O register E. I'm using 4-bit word mode so I'm seding data as nibbles.

Dushyantha
 

Attachments

jnvarsha

Joined Jan 21, 2009
3
Hi brendan,This is varsha, I read the thread mails between u & dutar. What he is saying is a 4- bit interfacing for data transfer .i also did the same thing for 40x4 LCD but in C. BUT I HAVE A CODE in asm language for 40x4 lcd. so from that u can take just the data transfer part i.e 4 bit interfacing. But for this u need to change the hardware too .U have to use onlt 4 data lines in this case .The other 4 data line ie from DB0-DB3 need not be connected. If its ok with u ,let me know i will send u the code.I am attaching the file in which there is code for data tranfer. I haven't send the whole code. just c if it can help u. But h/w modification is must.
 

Attachments

Thread Starter

BrendanCarroll

Joined Jan 20, 2009
8
Hi Varsha,

Thank you for your reply. I have sorted out the problem that was going on for so long. In my code I declared it was a 2 line LCD but I was supposed to declare this twice (once for each line). Thankfully it is working well and I would like to say thanks again to yourself and Dutar who replied to my mail.

Brendan
 
Top