fourstix / QwiicSerLCD

Version of Arduino LiquidCrystal Library for Sparkfun Serial Enabled LCD with a Qwiic Adapter
MIT License
1 stars 14 forks source link

Questions: Shift Display and Scrolling #31

Closed rmerriam closed 2 years ago

rmerriam commented 2 years ago

Hi,

Thanks for reading this.

I'm working on a Raspberry Pi C++ library for the 4x20 display. Your code is very helpful in getting mine working. The basic display, cursor, and writing is working fine. But a couple points are strange.

I'm using the I2C interface but will also implement the serial. Firmware is 1.4.

When I do a display shift left or right the text will shift to the 2nd line down. If I'm on the 1st line it goes to the 3rd. On the 2nd it goes to the 4th. The 3rd goes to 1st and 4th goes to 2nd. Have you encountered this? I've looked at the HD44780U documentation but it isn't clear on this behavior.

The autoscroll is just weird. With not scrolling set characters appear from left to right as expected. I'm sending 1234567890abcdefgh one character at a time from center of first line.

  1. Send scrolling 4. Text appears to left. Basically reverse of 'normal'. But from 1st line writes 1 char to line 2 then continues on the right of line 3.
  2. Send a 5. Text appears in reverse moving to right. Original characters flow to left of 3rd line. First char after overflow (the 'a') appears on 2nd. Rest of new characters "b..." appear on line 1.
  3. Send a 6. Text appears to right and flows from line 1 to line 2. Okay.
  4. Send a 7. Text appears in normal order moving left. Text overflows to right, 3rd line but new characters appear in center of line 4.

Maybe shouldn't mix the increment and left modes? That would make 4 and 6 the only valid values to send. The value 5 is only to reverse text flow, the lef to right and right to left functions.

Probably need diagrams or video to see what is happening. Mainly asking is this what you see?

It almost appears the display size is not set properly.

fourstix commented 2 years ago

Hi,

Yes, if one digs deep into the spec sheet, this weirdness is vaguely documented. On a 20x4 display the lines are interwoven 1 to 3, 2 to 4 as you noticed. That's why some of the functions are documented with the phrase "On a 16x2 display" and the 20x4 behavior isn't clearly specified.

So it's not you, it's the design of the LCD display. Scroll Left, Scroll Right and Auto-scroll work as one would expect on a 16x2 display, but not on a 20x4 display.

Adafruit's LCD tutorial mentions this briefly on the bottom of this page: https://learn.adafruit.com/character-lcds/arduino-code

My advice for the 20x4 display is to manually keep track of the line lengths and write the correct text line by line.

Have a great day, Gaston

rmerriam commented 2 years ago

Thanks for the response. I have a vague memory of seeing this previously. My group with the library and test program repos is at https://gitlab.com/robot-libraries/lcd if you care to look. It is for the Pi and uses the pigpio library for the heavy lifting on I2C and serial, when I get to the latter. Be aware I'm pushing hard on C++20 using the GCC 11.2 compiler.