LCD 4x20 issue on line 3/4 with over 16 characters

I have a 4x20 display that almost works perfect. I can output 20 chars on line 1 and 2 but the moment I add over 16 chars to line 3 or 4 the display freaks out and distorts the text on all lines. It has lines through the middle of the text and everything gets dim.

The below code snippet works perfect:

      lcd.setCursor(0,0); 
      lcd.print("12345678900987654321");
      lcd.setCursor(0,1); 
      lcd.print("12345678900987654321");      
      lcd.setCursor(0,2); 
      lcd.print("1234567890012345");
      lcd.setCursor(0,3); 
      lcd.print("1234567890098765");

if I change it to add 1 more character to line 3 such as this:

      lcd.setCursor(0,0); 
      lcd.print("12345678900987654321");
      lcd.setCursor(0,1); 
      lcd.print("12345678900987654321");      
      lcd.setCursor(0,2); 
      lcd.print("12345678900123454");
      lcd.setCursor(0,3); 
      lcd.print("1234567890098765");

I get a big line through lines 1 and 3. If I add an extra character to line 4 then I get the line through lines 2 and 4.

I have tried adding delays as I saw mentions of this in other threads but no luck so far. Any ideas. (I am using Arduino 0017 w/ LiquidCrystal.h)

Joe

I tried this on a 4x20, and I wasn't able to replicate the problem in code alone, but I was able to replicate it when any of the pins DB4 - DB7 were loose. So it could be a physical connection issue. Has anyone else had this problem, with known good physical connections?

What happens if you write 1 byte to the setCursor(16,3) position?

Did you set the LCD Correctly?

lcd.begin(20, 4);

I haven't been able to get the same results, all though, if I do continue to print on line 1, instead of going down to line 2, it skips to line 3. Then after line 3 is full, it goes back to line 2, fills up line two, then skips down to line 4 to fill up line four...
Then heads back to line 1 to start filling that again. setCursor works fine for all lines.. and columns.

... if I do continue to print on line 1, instead of going down to line 2, it skips to line 3. Then after line 3 is full, it goes back to line 2, fills up line two, then skips down to line 4 to fill up line four...
Then heads back to line 1 to start filling that again.

This is normal behavior, but you knew that - didn't you?

Don

Indeed, I still don't understand why it's "normal" but there's alot I don't understand! :smiley: Was kind of a pointer, so if he encounters the same problem, he knows he's not the only one! :wink:

I have been playing with my 20x4 lcd recently as well, i am having a similar issue.

I set up a example (liquid crystal) serial display sketch and when i type out a sentence to try and take up all 4 lines and send it

it will show up in this order.. line 1,3,2,4

I changed the code to say lcd.begin(20, 4);

any tips? thanks.

Indeed, I still don't understand

Check out the LCD Addressing link at http://web.alfredstate.edu/weimandn for an explanation.

Don

I must have blacked out because I forgot I had this post out here. Got lost on a different project and came back to this one and quickly ran into this same LCD issue I needed to fix.

Mitch_CA:

If I use the following and just send a char to 16,3 I get the char but also a big white line through the 2 and 4th line.

#include <LiquidCrystal.h>
LiquidCrystal lcd(53, 52, 51, 50, 49, 48);

void setup()
{
lcd.begin(20, 4);
}

void loop()
{
lcd.setCursor(16,3);
lcd.print("R");
delay(200);
}

tigoe: I checked the connections and they look good, but I might try pulling the board apart and re checking everything under the LCD (it is currently mounted to a PCB)

ps: I am on the mega now as you can tell by the PINS I am using.

Joe

Joe:

lcd.setCursor(16,3);
lcd.print("R");
delay(200);

Why is this stuff in loop()? Put it in setup() and see what happens.

Don

I remember reading something about the lcd library being setup for 16 characters per line or something like that, and you have to change the start positions of the lines to get it to work correctly with a 20 x ??. Might have been fix already but just something else to check on.

Hi Donn, This was part of a larger bit a code that I stripped down a bit to try and narrow the issue (changed vars to hard-coded values, etc.). I will move this up to the setup to see what happens.

Matt, I will dig around a bit to see what I can find. This sounds logically as I can print all 20 chars on the first two rows and only up to 16 on the 3 and 4th.

Joe

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248809589
Seems like it is setup for a 4x20 LCD by default, hopefully it is a software issue (that is easily fixed) and not your LCD.