Go Down

Topic: Writing to a 16x1 LCD. (Read 677 times) previous topic - next topic

adilmalik

I have a hd44780 16x1 lcd screen. The problem is that it has to be addressed as (8,2) instead of (16,1), now i want to print an array on it, which is longer then 8 letters, but i don't know how to auto move the cursor to the second segment when the word is > 8 letters.

Code: [Select]

char * words[] = {"abcdefghig",..............}
void setup() {
lcd.begin(8, 2);
}
lcd.setCursor(0, 0);
lcd.print(words[1]);


P.S I want to keep the array as i will add more words into it.The arduino will select which word to print using my inputs.

bperrybap

So you are saying that the memory layout is such that the 8th character is at lcd memory
location 0x40? (2nd line on most lcds)

If so, you need to have some special code in the low level lcd code to detect when the data is
crossing over and send command to reposition the cursor position.

Luckily there is a library that already does this.
Take a look at this library: http://www.pjrc.com/teensy/td_libs_LiquidCrystal.html

The lcd library code will detect a need to line wrap after column 7 and then reposition to the next line
automatically for you.

--- bill

bperrybap

So you have the LiquidCrystalFast library installed and it's not working?
Did you change your sketch to use the LiquidCrystalFast header and constructor?

--- bill

Go Up