Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LCD (2x16) showing only one line when data bits grounded

Status
Not open for further replies.

Elerion

Member
I reciently faced a problem with a 2x16 LCD (4 bit mode).
Only one line was displayed.
The solution was disconnect the LCD's unnused data bits from ground, and let them float, disconnected from each others.
Has anyone experienced this??

Now for some background...
I breadboarded the full circuit. It worked. Both lines.
I made a PCB, it didn't. Just one line.
After electric, logic analyzer and oscilloscope tests, I found no issue.
I tried replacing almost every component, although it didn't make sense.

Finally I realised on an apparently innofensive difference; the PCB had the unnused data bits grounded (on the breadboard they were unconnected). But this is suppose to be a good practice, isn't it?

Any explanation for this?
 
Hi El,
Deleted my reply, total nonsense regarding the bit pattern.
Leave the lower order 4 Bit connections, unconnected. D3,2,1,0
Sorry about the mis-info.!

Eric
 

Attachments

  • A02.gif
    A02.gif
    43.3 KB · Views: 348
Last edited:
Why should grounding them hurt?
I think its because they are data lines and grounding them means your effectively making then read as all 0 data bits on those lines
 
All LCD's with that controller are the same, except apparently some are a bit different. I could be wrong but what Nigel is saying fits with something I noticed. When you power up the LCD its in 8 bit mode, if you have any of the lower four bits with a signal on (1 OR 0), then even when you put it into 4 bit mode you have already written to the dataline....

I am making a right mess explaining this, Put it this way, in 4 bit mode the lower 4 data lines are not actually floating, no idea if they are tri state or not, but they certainly behave like it in 4 bit mode. Long story short dont ground them, to double check look at the data table for the controller, see what 0000 on the lower 4 data lines sets the LCD to.... I bet thats where you find your problem.
 
OK got it!

your setting it to 1 line mode by ground bit 0 and 1 at start up, see this table
lcd.PNG
 

Attachments

  • lcd.PNG
    lcd.PNG
    84.9 KB · Views: 341
No they aren't - the display boots up set to 8 bit mode, you have to actively set it to 4 bit mode

Sure. I set 4 bit mode. It works great on breadboard/protoboard, and also on the PCB if I let them float.

OK got it!

Thank you very much for the info.

I worked with LCDs many times for prototyping. I never grounded, of course.
But I've seen schematics doing it (easy to find some doing a quick search).
As I was making a PCB, I decided to do things the right way, and I supposed that letting they float wasn't. Wrong!
 
Lcd's power up in 1 line only, the top one, if you disconnect the data lines power one up and turn the contrast all the way up only the top line will go black, I use this to tell if a processor has started or not.
If you are getting data displayed on the top line not the bottom the display must not have initialized correctly, if the display works with these 4 lines floating and not with them grounded then that's pretty much certain to be causing the problem.
You can save yourself a pin, the r/w pin can be directly grounded if you dont read from the Lcd, which isnt really necessary in a lot of projects.
 
Lcd's power up in 1 line only, the top one, if you disconnect the data lines power one up and turn the contrast all the way up only the top line will go black, I use this to tell if a processor has started or not.
If you are getting data displayed on the top line not the bottom the display must not have initialized correctly, if the display works with these 4 lines floating and not with them grounded then that's pretty much certain to be causing the problem.
You can save yourself a pin, the r/w pin can be directly grounded if you dont read from the Lcd, which isnt really necessary in a lot of projects.
Correct, but if you look at what i posted, then at start up the first data line can be 1XX or 0XX if its 0XX then the lcd is initialized in 1 line mode. if you initialize again but are in 4 bit mode then the lower 4 bits are ignored and your stuck in 1 line mode. Or thats kind of how i read it.

Reading some more, the data lines dont float, in 4 bit mode the lower 4 datalines go into high Z, i cant find the sheet but give me a few and i will dig it back out.
 
Sure. I set 4 bit mode. It works great on breadboard/protoboard, and also on the PCB if I let them float.



Thank you very much for the info.

I worked with LCDs many times for prototyping. I never grounded, of course.
But I've seen schematics doing it (easy to find some doing a quick search).
As I was making a PCB, I decided to do things the right way, and I supposed that letting they float wasn't. Wrong!
Alot of schematics show them wired for 8 bit mode, this is because the code is a bit easier as you dont need to nibble and shift. This is probably why they grounded. Also as Eric alluded to, if your writing and reading to the LCD on the R/S line then other funky **** can happen.

Read that info in the thread i linked to, once you get your head around the appalling documentation, you can do some ultra cool stuff with those displays.
 
Elerion
Here's a thread from awhile back on whether the common Hitachi controller comes up in 4-bit or 8-bit mode:
https://www.electro-tech-online.com/threads/lcd-controller-start-up-mode.146459/#post-1239977

That question seems to persist.

Good luck.

John
John that isnt the same question, when the lcd is initialized the above pic i posted shows that if you ground the lower 4 bits (actually D3) then you tell the controller to display 1 line. if you keep D3 grounded then you can initialize until the cows come home in 8 or 4 bit mode. It will STILL only display 1 line. If D3 is tied high then it will ALWAYS display 2 lines. Its explained in the pic above.

If you use 4 bit mode then there is a command to switch between 1 or 2 lines, but that will only work if the D3 pin is 'floating', its not relevant if the lcd boots in 8 or 4 bit mode.

The other thing he hasnt mentioned but is also doing is putting the display into 5x7 dot format. D0 and D1 dont care if they are high or low. but D2 sets the Dot format and D3 the number of lines, these are set at power on if the data lines are connected and therefore before the display is initialized. Keeping them grounded or held high will stop them being over ridden
 
Regarding the thread you linked too, i didnt read the whole thing, but the LCD powers up in the mode depending if D4 is high or low at power on, if floating then like any micro pin its pot luck as to which state its actually in, that is why i assume some see it power up in 4 bit and some in 8 bit.
 
I will try and make this clearer for the OP
lcd2.PNG


As it shows this sets up in initialization, i suspect the the 4 high datalines when you power up are immediately already high, the reason i say this is because if you set the top 4 high and ground the lower 4 you put the lcd in command mode. but regardless of that the above table explains what is happening in your case, so if you send a software command it wont make a difference if you keep D3 grounded because your setting 1 line mode. if you use this LCD's without a micro and just use switches to control it you get a good understanding how it works. I linked to the thread but the files you want to read i will post in a second.
 
heres the pdf. I am 100% sure thats the problem you got. when i first used these lcd's i had utter mares with them, so i ended up reading everything i could find on them, they are easy to use but really simple things can trip you up lol

And sorry OP, i am really not good at explaining stuff, so hopefully the pdf and the pic i posted will explain it better than i have
 

Attachments

  • lcd1.pdf
    240.7 KB · Views: 330
Last edited:
reading a different file the reason the lower 4 can be left unconected in 4 bit mode is because they apparently have internal pull ups on, reading further these are set after you have done your thing, so technically they are not floating once you have initialized, below is the extract
lcd3.PNG
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top