2011-04-28 01:13 PM
4X20 Character LCD
#character-lcd #rtfm #hd44782011-05-17 05:33 AM
2011-05-17 05:33 AM
2011-05-17 05:33 AM
Code as shown initializes the Lcd to display just rows 1 and 3. You have initialized it as a 1 row display (via 0x30) - instead use 0x38) - again sent 3 times with adequate delays.
Without any direct ''addressing'' the Lcd module will allow you to ''fill'' row 1 (top) and upon the 21st char the cursor will jump (magically) to the left edge of row 3. Once initialized as a 2 row unit you can access rows 2 and 4 - with the same ''jump'' behavior from row 2 to row 4. Here's the memory map of the Lcd - enabling you to transition from row 1 to 2, 2 to 3, and 3 to 4 - as/if desired. Row 1 0x80 Row 2 0xC0 Row 3 0x94 Row 4 0xD4 To generate these addresses the ''RS'' line must be held ''L or 0.'' Data is written with RS held ''H or 1.'' Rows 2 and 4 cannot be accessed unless the display is initialized into 2 row mode. Older lcds may require a slight negative contrast Vo voltage when placed into 2 row mode. (due to higher multiplex ratio) Older Lcds require 5V level on their Vdd-Vss. We've found no instances of the 3V3 data signal levels from MCUs being inadequate to control the Lcd - some newer Lcds will accept 3V3 on their power pins - often the Vo voltage must be reduced and/or driven slightly negative. Using the correct initialization code and address scheme will enable all 4 lines on a properly functioning 4x20 Lcd... (edit) further note: code posted is a ''mish-mash'' of both 4 and 8 bit D-Bus transfer to the Lcd - this is not good. 4 bit code is used to save 4 GPIO - but requires dual transfers (with E pulse) for each byte. Your existing code appears to start with 4 bit mode (the 3, mistaken 0x30 transfers) and only later ''adds'' the 2 row set-up. Delete all mentions of 1 row code - stay with 0x38 (2 row) and all 4 lines should appear...