cancel
Showing results for 
Search instead for 
Did you mean: 

4X20 Character LCD

jensen
Associate
Posted on April 28, 2011 at 22:13

4X20 Character LCD

#character-lcd #rtfm #hd4478
3 REPLIES 3
mrost9
Associate II
Posted on May 17, 2011 at 14:33

HD44780 can only adress 2 lines (IIRC).

For the 3rd and 4th lines they usually have a second Chip Select pin, and are used as if they were a second display.

Posted on May 17, 2011 at 14:33

Alternatively, it may act ''logically'' like a 2-line display, where each ''logical'' line is split over 2 physical lines on the actual display?

See, for example: 

http://www.8052.com/forum/read/12302

The only way to know for certain is to study the datasheet  for the particular display.

jj2
Associate II
Posted on May 17, 2011 at 14:33

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...