Pages: [1]   Go Down
Author Topic: Writing to a 16x1 LCD.  (Read 622 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 0
Posts: 184
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

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
Logged

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

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
Logged

Pages: [1]   Go Up
Jump to: