LCD Rows 3/4 not starting in correct column

Hi guys,

I got an LCD off eBay: http://www.cstech.plus.com/ebay/4_line_display.pdf
This is using a teensy 2.0
I have wired it up with the following code but rows 2/4 start displaying on columb 5 for some reason.

#include <LiquidCrystal.h>
LiquidCrystal lcd(0, 1, 2, 4, 5, 6, 7);
//                0 = RS   4 = D4   7 = D7
//                   1 = R/w  5 = D5
//                      2 = E    6 = D6

void setup() {
  delay(1000);
  lcd.begin(16, 4);
  lcd.setCursor(0,0);
  lcd.print("1111111111111111");
  lcd.setCursor(0,1);
  lcd.print("2222222222222222");
  lcd.setCursor(0,2);
  lcd.print("3333333333333333");
  lcd.setCursor(0,3);
  lcd.print("4444444444444444");
}
void loop() {
}

Any help would be greatly appreciated.

P.s. If i do the following it works but surely that isnt right?

  lcd.setCursor(-4,2);
  lcd.print("3333333333333333");
  lcd.setCursor(-4,3);
  lcd.print("4444444444444444");

See here:

and here:
http://web.alfredstate.edu/weimandn/lcd/lcd_addressing/lcd_addressing_index.html

Oliver

Try using this code. Works for me.

You set the position with :

LCDpos(0,1)  ,etc

The function : void(LCDpos) receives the values passed to it, and sets the LCD cursor position, making adjustment for the 3rd and 4th lines.

void setup() {

  lcd.begin(16, 4);
  lcd.print("hello, world!");

}

void LCDpos(int Lcol, int Lrow) {
  lcd.setCursor(Lcol, Lrow);
  if(Lrow > 1) lcd.setCursor(Lcol + 16, Lrow - 2);
}

void loop() {
  LCDpos(0,1); lcd.print("Line 1");
  LCDpos(0,2); lcd.print("Line 2");
  LCDpos(0,3); lcd.print("Line 3");
  LCDpos(0,4); lcd.print("Line 4");
}

Or get a 20X4 display. The 16X4 display is already very bulky so hope you don't mind extra width :wink: