Pages: [1]   Go Down
Author Topic: LCD 4x20 issue on line 3/4 with over 16 characters  (Read 1761 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

Code:
 
      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:

Code:
     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
Logged

New York, NY, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 40
Howdy. I don't check PMs often, so email me!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Waterloo, Canada
Offline Offline
Full Member
***
Karma: 1
Posts: 242
Engineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Spokane, Washington
Offline Offline
God Member
*****
Karma: 1
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... 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
Logged

Spokane, Washington
Offline Offline
God Member
*****
Karma: 1
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Jax Florida
Offline Offline
Jr. Member
**
Karma: 1
Posts: 93
Electronics Addict
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Indeed, I still don't understand
Check out the LCD Addressing link at http://web.alfredstate.edu/weimandn for an explanation.

Don
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 4435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

New Zealand
Offline Offline
Full Member
***
Karma: 2
Posts: 120
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

New Zealand
Offline Offline
Full Member
***
Karma: 2
Posts: 120
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: