I use the LCD2004 with the I2C backpack, and I slightly modified the HelloWorld test sketch from folder hd44780_I2Cexp:
hd44780_I2Cexp lcd2(0x27);
// LCD geometry
const int LCD_COLS = 20;
const int LCD_ROWS = 4;
....
void loop() {
int r = lcd.moveCursorLeft();
int s = lcd.status();
Serial.print("AC "); Serial.println(s & 0x7F);
delay(1000);
}
The sketch outputs "Hello, World!" to the screen, then starts moving the cursor to the left. After reaching the left-most position of line 1, it jumps to the right-most position of line 4, goes through it to the left, jumps to line 2, then to line 3, then back to line 1.
The debug output is (AC is supposed to be the cursor address):
04:16:45.486 -> AC 10
04:16:46.488 -> AC 9
...
04:16:53.491 -> AC 2
04:16:54.509 -> AC 1
04:16:55.521 -> AC 0
04:16:56.484 -> AC 103
04:16:57.484 -> AC 102
...
04:17:34.562 -> AC 65
04:17:35.554 -> AC 64
04:17:36.583 -> AC 39
04:17:37.596 -> AC 38
...
04:18:03.612 -> AC 12
04:18:04.636 -> AC 11
04:18:05.644 -> AC 10
I'm surprised the link lasted as long as it did since I retired from Alfred State College in 1997. Send me a message with your email address and I'll reply with a PDF version of that web page.
Well it is, but it likely isn't what you are expecting/wanting.
The hd44780 library status() returns the raw hd44780 "busy status & address" directly from the chip.
The "AC" bits are the DDRAM Address Counter.
It is essentially the ram address where the characters are stored.
The odd looking movements of the cursor to discontinuous locations on a 20x4 display is due to the way the DDRAM memory locations are mapped to the physical display.
Here is live link that explains hd44780 memory mapping:
Column and Row are an invention by the LiquidCrystal API.
These are not part of the hd44780 chipset.
The chipset is simplistic and simply uses a DDRAM address to set a cursor position.
When you call setCursor(col, row) the library converts the col and row to a DDRAM address to give to the chipset.
I'd also recommend reading the datasheeet:
As it has additional information about this.
Unfortunately, at this point in time the hd44780 library lineWrap() only works for printing (output).
It does not do any mappings for shifts, or things like cursorLeft / cursorRight.
Note:
I'll add updating moveCursorRight() and moveCursorLeft() to support lineWrap() in the next release.