Problems getting a i2C LCD to display anything

Today i received one of those cheap 2004A LCD screens with a piggy-backed I2C interface. No labels or instructions but dirt cheap with free shipping from China. Hooking it up was easy enough and i did get the backlight working but no matter what i tried or which library i installed I could not print anything on the screen.

After an hour or two of increasing frustration it suddenly occured to me that LCD screens can be illegible if the contrast is way off. So i carefully turned the small trimmer on the back of the I2C interface and my text appeared on the LCD. I nearly jumped with joy.

It still wouldn't print entire strings but a quick hack of the LiquidCrystal_i2c write() function fixed that (return 1 instead of 0).

But when i'm printing a string > 20 characters the output skips a screen row. Is this a bug in the core Print() function?

But when i'm printing a string > 20 characters the output skips a screen row. Is this a bug in the core Print() function?

No. This is a function of how the LCD controller works. This type of behavior is frequently called a 'feature' not a 'bug'.

For all the gory details behind this 'feature' you can follow the LCD Addressing link at http://web.alfredstate.edu/weimandn.

Don

floresta:
No. This is a function of how the LCD controller works.

Ahh... i see, thanks. Curioser and curioser! But i've already written my own printstr() that gets the job done. My C is a bit rusty but in the end i got the result i was after. Pity there's no getCursorPosition() in the library, that would have made things a lot easier.

Pity there's no getCursorPosition() in the library, that would have made things a lot easier.

That would require reading data from the LCD controller which is possible with but not implemented in the LiquidCrystal library.

Since you have control over the initial cursor position and since you can count the characters you send to the display you can figure this out yourself.

Don