I have found a bug inside the LCD_4bit.c source file:
void set_cursor (unsigned char column, unsigned char line) {
unsigned char address;
address = (line * 40) + column;
address = 0x80 + (address & 0x7F);
lcd_write_cmd(address); /* Set DDRAM address counter to 0 */
}
--> address = (line * 0x40) + column; // the offset of 40 does not make sense
I am a little bit confused, that it still works with 40 as factor for set_curor(0, 1).
Greetings Oliver
0x40 is the right value.
Yes. After re-examining the datasheet, I would agree with that.
It's a common mistake to take the examples too seriously though.
I really can't, especially when I see this is the same blinky example (just after a call to set_cursor):
for (i = 0; i < 20000000; i++); /* Wait for initial display */
Ouch.