Pages: [1]   Go Down
Author Topic: Problem with lcd.setCursor command starting text in wrong column  (Read 736 times)
0 Members and 1 Guest are viewing this topic.
Ottawa, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 20
32 year veteran of Ottawa high tech community
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


* lcd.jpg (120.6 KB, 640x480 - viewed 11 times.)
Logged

Ottawa, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 20
32 year veteran of Ottawa high tech community
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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"
« Last Edit: March 28, 2013, 10:30:04 pm by floresta » Logged

Pages: [1]   Go Up
Jump to: