When working with a 20×4 character LCD, you might be surprised to see the controller set to 2-line mode:
Why would a 4-line LCD’s controller be set to 2-line mode?
It has to do with the way the LCD glass is laid out. Essentially the display is the right and left halves of a 40×2 mapped to the top and bottom of a 20×4.
Here is a diagram to explain:
(click on the image for full-size view)
The key is the address map for the display, which is included in the display’s datasheet. The address map shown above is typical, but not all displays use this exact map.
Be sure to check your display’s datasheet to verify its address map.
Need Additional Help?
If you have any questions about initialization code or how to power up any of our LCD displays, please contact our knowledgeable and friendly support staff by email, phone, or chat.