EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

lcd interfacing

Started by abhay August 4, 2006
hi  .i m  interfacing 16x2 lcd to my P89LPC935 but i m unable to get
the desired output.i hav tested many times and also the program is
correct as i m able to debug it & observe the output correctly.i hav
also replaced my lcd one time. i m using HY-1602F6 lcd module.i hav
checked my pin configurations again & again but the lcd is just
flashing with backlight voltage input pins.
i m getting only blocks of one row display with no character when i
change the contrast.

Could anyone helpme out in this as i hav to complete my project with
this lcd module soon .also i would be thankful if anyone could suggest
anyother lcd module for reliable & low cost operation.

On 4 Aug 2006 10:30:17 -0700, in comp.arch.embedded "abhay"
<abhaym244@gmail.com> wrote:

>hi .i m interfacing 16x2 lcd to my P89LPC935 but i m unable to get >the desired output.i hav tested many times and also the program is >correct as i m able to debug it & observe the output correctly.i hav >also replaced my lcd one time. i m using HY-1602F6 lcd module.i hav >checked my pin configurations again & again but the lcd is just >flashing with backlight voltage input pins. >i m getting only blocks of one row display with no character when i >change the contrast. > >Could anyone helpme out in this as i hav to complete my project with >this lcd module soon .also i would be thankful if anyone could suggest >anyother lcd module for reliable & low cost operation.
The first answer to this problem is: Power On Reset you have to have a significant delay, Many milliseconds, before attempting to intitialise an LCD. See your data sheet martin
On 4 Aug, in article
     <1154712617.632509.193850@m79g2000cwm.googlegroups.com>
     abhaym244@gmail.com "abhay" wrote:

>hi .i m interfacing 16x2 lcd to my P89LPC935 but i m unable to get >the desired output.i hav tested many times and also the program is >correct as i m able to debug it & observe the output correctly.i hav
How have you determined the timing and delays of your program?
>also replaced my lcd one time. i m using HY-1602F6 lcd module.i hav
No doubt using a HD44870 or clone controller chip.
>checked my pin configurations again & again but the lcd is just >flashing with backlight voltage input pins.
What do you mean by 'flashing'.
>i m getting only blocks of one row display with no character when i >change the contrast. > >Could anyone helpme out in this as i hav to complete my project with >this lcd module soon .also i would be thankful if anyone could suggest >anyother lcd module for reliable & low cost operation.
What delays do you have between writes to the display? What are your initialisation delays? Are you sure you are configuring 4 and 8 bit transfer correctly. How are you determining that your end is right? -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
i hav done my lcd interfacing through delay function & through polling
of busy flag.
in delay program i gave a delay of 250ms.
by flashing i mean to say that the lcd is lit when i switch on the
power but it displays only one line (the bricks in one line)& i hav
correctly checked my configuring for 8 byte data transfer.
my initialisation instructions are 0x38h,0x80h,0x06h,0x0Eh,0x01h. i hav
read the datasheet & recommended delay was of 1.64ms & 40usec for some
instructions So tomake program simpler i tried with 3ms delay for each
instruction.
i m having a doubt in initialising commands.do i need to initialise
something else?
also is there something that i could do with my lcd module itself(like
any jumper setting) although i hav tried with that also but of no use

"abhay" <abhaym244@gmail.com> wrote in message
news:1154754568.051505.95120@i42g2000cwa.googlegroups.com...
> > i hav done my lcd interfacing through delay function & through polling > of busy flag. > in delay program i gave a delay of 250ms. > by flashing i mean to say that the lcd is lit when i switch on the > power but it displays only one line (the bricks in one line)& i hav > correctly checked my configuring for 8 byte data transfer. > my initialisation instructions are 0x38h,0x80h,0x06h,0x0Eh,0x01h. i hav > read the datasheet & recommended delay was of 1.64ms & 40usec for some > instructions So tomake program simpler i tried with 3ms delay for each > instruction. > i m having a doubt in initialising commands.do i need to initialise > something else? > also is there something that i could do with my lcd module itself(like > any jumper setting) although i hav tried with that also but of no use >
Is the LCD drive voltage right? Some of these LCDs need a negative voltage on the drive, say generated by a 7660 inverter. Other LCDs need Vo sitting on a potentiometer between Vss and Vdd. Would this information help some :) http://www.piclist.com/techref/lcds.htm The approach I've used in the past is to literally bit bang the port with quite messy code, and then once the timings and LCD works, I then manage the output via a timer so that everything is precise. Each manufacturer's LCD is just slightly different in how it does things. Are you reading the busy flag? This may be another approach. Can you enable RS232 on your microcontroller so you can see what's going on? You will get there, it'll eventually work :-)
"abhay" <abhaym244@gmail.com> wrote in message
news:1154754568.051505.95120@i42g2000cwa.googlegroups.com...
> > i hav done my lcd interfacing through delay function & through polling
Extract from http://www.sampson-jeff.com/lcdindex.htm " If you are going to use these types of displays, heed this warning! The manufactures use the term Vcc-Vee to describe the LCD bias voltage. This is actually a NEGATIVE voltage! (At least all that I have looked at so far are negative. Check it your self before connecting.) Some displays have a negative LCD supply voltage AND a negative contrast control supply voltage. An example of this is the DMF50081 from Optrex. Others have a single negative LCD supply voltage which also controls the contrast. The smaller Optrex displays (like the DMF5005) and the Toshiba displays I have looked at work this way. Example: From the Optrex DMF5005 data sheet. Supply Voltage (LCD Drive) Vcc-Vee is Min=8V Max=26V This means (5V - (-Vee)) = 26V, Therefore Vee= -3V to -21V Most the manufactures seem to use some variation of this notation. Don't let the unclear documentation destroy your display! Yes, I should have example schematics and real applications. I am adding these as I get time. "
Hi abhay:

> my initialisation instructions are 0x38h,0x80h,0x06h,0x0Eh,0x01h.
This sequence doesn't look too bad...I suggest you drop the 0x80, it is not needed after reset. Since you are only seeing the blocks your LCD contrast voltage is OK. So the problem is your display does not accept the init sequence. Check also if the RS (register select), WR and CS (E) lines are correct. Look at the timing chart of your displays datasheet. Watch out: these LCD displays want a positive enable signal, not a negative one like usual :-) HTH Wolfgang -- From-address is Spam trap Use: wolfgang (dot) mahringer (at) sbg (dot) at
On 4 Aug, in article
     <1154754568.051505.95120@i42g2000cwa.googlegroups.com>
     abhaym244@gmail.com "abhay" wrote:

>i hav done my lcd interfacing through delay function & through polling >of busy flag. >in delay program i gave a delay of 250ms. >by flashing i mean to say that the lcd is lit when i switch on the >power but it displays only one line (the bricks in one line)& i hav >correctly checked my configuring for 8 byte data transfer.
Sounds like contrast voltage is in correct range.
>my initialisation instructions are 0x38h,0x80h,0x06h,0x0Eh,0x01h. i hav
I would check the datasheet to see what dots per character you have as some data sheets have mistakes (especially on LCDs) if your character size is 5 x 8 then 0x38 is correct. In rare circumstances the font size is 5 x 11 so this should be 0x3C, it is unlikely you have a 5 x 11 font size. As another poster has pointed out the 0x01 is not really necessary from initialisation. If you use the Display clear (0x01) then the 0x80 is a duplicate of part of the display clear function. Changine 0x0E to 0x0F may help as when it is working you should at least see a blinking cursor.
>read the datasheet & recommended delay was of 1.64ms & 40usec for some >instructions So tomake program simpler i tried with 3ms delay for each >instruction. >i m having a doubt in initialising commands.do i need to initialise >something else?
If none of the above then this sounds to me like one of the following:- 1/ your timing to write to the LCD is not what you think it is e.g. R/W or RS or E line inverted or even timing of these relative to each other and data. 2/ Data line or other signal not actually reaching the LCD or swapped. 3/ You do not wait long enough from power up before starting to initialise the controller, most controllers need 30 to 50ms BEFORE the first command is written
>also is there something that i could do with my lcd module itself(like >any jumper setting) although i hav tried with that also but of no use
I very much doubt that there is a jumper on the LCD that you should even think of changing as any jumper will be for manufacturering purposes of which LCD glass is on the module PCB. -- Paul Carpenter | paul@pcserviceselectronics.co.uk <http://www.pcserviceselectronics.co.uk/> PC Services <http://www.gnuh8.org.uk/> GNU H8 & mailing list info <http://www.badweb.org.uk/> For those web sites you hate
abhay wrote:
> i hav done my lcd interfacing through delay function & through polling > of busy flag. > in delay program i gave a delay of 250ms. > by flashing i mean to say that the lcd is lit when i switch on the > power but it displays only one line (the bricks in one line)
This is the normal result of a power up reset, operate the reset on your micro to run the initialisation code again, if you have it correct the lcd should go blank. If it stays the same then you have a problem in that part of the code. You MUST follow the initialisation sequence as specified in the data sheet.
abhay wrote:
> hi .i m interfacing 16x2 lcd to my P89LPC935 but i m unable to get > the desired output.i hav tested many times and also the program is > correct as i m able to debug it & observe the output correctly.i hav > also replaced my lcd one time. i m using HY-1602F6 lcd module.i hav > checked my pin configurations again & again but the lcd is just > flashing with backlight voltage input pins. > i m getting only blocks of one row display with no character when i > change the contrast. > > Could anyone helpme out in this as i hav to complete my project with > this lcd module soon .also i would be thankful if anyone could suggest > anyother lcd module for reliable & low cost operation.
Abhay, If your LCD is HD44780 based (as most are) then please read the HD44780 datasheet and follow the initialisation strickly. power off the board and check the continuity of MCU pins to the LCD pins. power on board, check if RS,E,R/W and data signals reach okay at LCD pins. Put long delays say 20 secs and see if voltage changes at LCD pins as intented in the software. Following is example for PIC for 4-bit interfacing (snip from http://esurinder.net/pic/lcd4bit.c ) // setting interface length, higher 4-bits matter // Though naming following 8bit, these needs 4 wires // just to be consistent with HD44780 datasheet lcd_commwrt_8bit(0x38); // 0011 1000 -- set 8-bit delay(30000); lcd_commwrt_8bit(0x38); // 0011 1000 -- set 8-bit delay(30000); lcd_commwrt_8bit(0x38); // 0011 1000 -- set 8-bit delay(30000); lcd_commwrt_8bit(0x20); // 0010 0000 -- set 4-bit delay(30000); // 4-bit communication starts now with LCD lcd_commwrt(0x28); // 0010 0000 -- 4-bit, 1-line delay(30000); ... lcd_commwrt(0x01); // clear DDRAM and set DDRAM address to 0x00 delay(3000); LCD comes with blocks of characters. for example 16 charcter LCD can be of two block. first 8 character in one address range and second half in another address range. Depening on the instructions LCD controller will get from MCU, it can activate different regions/different lines. Once a pin of MCU went bad while interfacing with LCD. It was difficult to detect as we do not doubt it (as it happens not so often). So with patience verify everything in a procedural manner. thanks - Surinder

The 2024 Embedded Online Conference