Go Down

Topic: Problem with lcd.setCursor command starting text in wrong column (Read 857 times) previous topic - next topic

ScottMurchison

I wired up a new 16x4 LCD panel to my ITEADUINO and ran a simple program. The problem is that in rows 2 and 3, the text starts at position 4 instead of position 0.

The display looks like this;

Row 0
Row 1
       Row 2
       Row 3

The program is simple and looks like this;

LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13;   

void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH);
  lcd.begin(16,4);   
  lcd.clear();                   
  lcd.setCursor(0,0);           
  lcd.print("Row 0"); 
  lcd.setCursor(0,1);           
  lcd.print("Row 1");
  lcd.setCursor(0,2);           
  lcd.print("Row 2");
  lcd.setCursor(0,3);         
  lcd.print("Row 3");
}

I can change the commands to lcd.setCursor(-4,3);  but this makes no sense to me as to why I should have to.

Has anyone seen this problem and is there a fix?

Scott

ScottMurchison

I am using this LCD display.
http://imall.iteadstudio.com/eone-high-cost-effective-1604-characters-lcd-blue.html

bperrybap

Use a better library:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
The liquidcrystal library that comes with the IDE doesn't properly handle all the different LCD geometries.
fm's library uses the proper addresses for that geometry.
It is a drop in replacement for the library that ships with the IDE.
It is also much faster.

--- bill

floresta

#3
Mar 29, 2013, 04:26 am Last Edit: Mar 29, 2013, 04:30 am by floresta Reason: 1
Quote
The liquidcrystal library that comes with the IDE doesn't properly handle all the different LCD geometries.

Specifically it doesn't handle cursor positioning on rows 3 and 4* of the 16x4 displays correctly.

Don

* I guess I should have said "on the lower two rows"

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy