1. 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.
    Dismiss Notice

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

Discussion in 'General Electronics Chat' started by Elerion, Jul 14, 2017.

Tags:
  1. Elerion

    Elerion Member

    Joined:
    Dec 1, 2015
    Messages:
    102
    Likes:
    2
    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?
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,223
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    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
     

    Attached Files:

    • A02.gif
      A02.gif
      File size:
      43.3 KB
      Views:
      28
    Last edited: Jul 14, 2017
  3. Elerion

    Elerion Member

    Joined:
    Dec 1, 2015
    Messages:
    102
    Likes:
    2
    Why should grounding them hurt?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND

    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
     
  6. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,223
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi,
    How is R/W connected,
    E
     
  7. Elerion

    Elerion Member

    Joined:
    Dec 1, 2015
    Messages:
    102
    Likes:
    2
    Yes, but they are ignored.

    R/W is directly controlled by a microcontroller output. So is E and RS.
     
  8. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,301
    Likes:
    648
    Location:
    Derbyshire, UK
    No they aren't - the display boots up set to 8 bit mode, you have to actively set it to 4 bit mode - presumably you're doing that before anything else?.
     
  9. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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.
     
    • Like Like x 1
  10. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    OK got it!

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

    Attached Files:

    • lcd.PNG
      lcd.PNG
      File size:
      84.9 KB
      Views:
      22
    • Like Like x 1
    • Thanks Thanks x 1
  11. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
  12. Elerion

    Elerion Member

    Joined:
    Dec 1, 2015
    Messages:
    102
    Likes:
    2
    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!
     
  13. dr pepper

    dr pepper Well-Known Member Most Helpful Member

    Joined:
    Oct 6, 2008
    Messages:
    4,731
    Likes:
    258
    Location:
    North west UK
    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.
     
  14. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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.
     
  15. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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 chit 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.
     
  16. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,998
    Likes:
    512
    Location:
    Cleveland, OH, USA
  17. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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
     
  18. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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.
     
  19. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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.
     
  20. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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
     

    Attached Files:

    • lcd1.pdf
      File size:
      240.7 KB
      Views:
      31
    Last edited: Jul 15, 2017
  21. Little Ghostman

    Little Ghostman Well-Known Member Most Helpful Member

    Joined:
    Jan 7, 2011
    Messages:
    3,737
    Likes:
    433
    Location:
    SCOTLAND
    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
     

Share This Page