Home     Projects     Micro     Tools     Delphi     Developer     Site map
HOME  
 
   
 
Basic information Dot matrix charaterr LCD

The infromation in this document is a HD44780-Based LCD Modules compatible.
The general Dot matrix character LCD has 14 pins as following.

Pin Number Symbol
1 Gnd
2 Vcc
3 Vo
4 RS
5 R/W
6 E
7 DB0
8 DB1
9 DB2
10 DB3
11 DB4
12 DB5
13 DB6
14 DB7
 


Signal name No. of
Lines
I/O Connected
to
Function
DB4-DB7 4 I/O CPU 4 lines of high order data bus. Bi-directional transfer of data
between MPU and module is done through these lines. Also DB7
can be used as a busy flag. These lines are used as data in 4 bit
operation
DB0-DB3 4 I/O CPU 4 lines of low order data bus. Bi-directional transfer of data
between MPU and module is done through these lines. In 4 bit
operation, these are not used and should be grounded.
E 1 I CPU Enable - Operation start signal for data read/write.
R/W 1 I CPU Signal to select Read or Write
“0”: Write
“1”: Read
RS 1 I CPU Register Select
“0”: Instruction register (Write)
: Busy flag; Address counter (Read)
“1”: Data register (Write, Read)
Vo 1 - Power Supply Terminal for LCD drive power source or use for dimming.
Vcc 1 - Power Supply +5Vdc
Gnd 1 - Power Supply Groung


HD44780 instruction set
Instruction Code Description Execution time**
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
Clear display 0 0 0 0 0 0 0 0 0 1 Clears display and returns cursor to the home position (address 0). 1.64mS
Cursor home 0 0 0 0 0 0 0 0 1 * Returns cursor to home position (address 0). Also returns display being shifted to the original position. DDRAM contents remains unchanged. 1.64mS
Entry mode set 0 0 0 0 0 0 0 1 I/D S Sets cursor move direction (I/D), specifies to shift the display (S). These operations are performed during data read/write. 40uS
Display On/Off control 0 0 0 0 0 0 1 D C B Sets On/Off of all display (D), cursor On/Off (C) and blink of cursor position character (B). 40uS
Cursor/display shift 0 0 0 0 0 1 S/C R/L * * Sets cursor-move or display-shift (S/C), shift direction (R/L). DDRAM contents remains unchanged. 40uS
Function set 0 0 0 0 1 DL N F * * Sets interface data length (DL), number of display line (N) and character font(F). 40uS
Set CGRAM address 0 0 0 1 CGRAM address Sets the CGRAM address. CGRAM data is sent and received after this setting. 40uS
Set DDRAM address 0 0 1 DDRAM address Sets the DDRAM address. DDRAM data is sent and received after this setting. 40uS
Read busy-flag and address counter 0 1 BF CGRAM / DDRAM address Reads Busy-flag (BF) indicating internal operation is being performed and reads CGRAM or DDRAM address counter contents (depending on previous instruction). 0uS
Write to CGRAM or DDRAM 1 0 write data Writes data to CGRAM or DDRAM. 40uS
Read from CGRAM or DDRAM 1 1 read data Reads data from CGRAM or DDRAM. 40uS


Bit names
Bit name Setting / Status
I/D 0 = Decrement cursor position 1 = Increment cursor position
S 0 = No display shift 1 = Display shift
D 0 = Display off 1 = Display on
C 0 = Cursor off 1 = Cursor on
B 0 = Cursor blink off 1 = Cursor blink on
S/C 0 = Move cursor 1 = Shift display
R/L 0 = Shift left 1 = Shift right
DL 0 = 4-bit interface 1 = 8-bit interface
N 0 = 1/8 or 1/11 Duty (1 line) 1 = 1/16 Duty (2 lines)
F 0 = 5x7 dots 1 = 5x10 dots
BF 0 = Can accept instruction 1 = Internal operation in progress


DDRAM address for a 1-line LCD (N=0)
Display size Visible
Character positions DDRAM addresses
1*8 00..07 0x00..0x07
1*16 00..15 0x00..0x0F
1*20 00..19 0x00..0x13
1*24 00..23 0x00..0x17
1*32 00..31 0x00..0x1F
1*40 00..39 0x00..0x27

DDRAM address for a 2-line LCD (N=1)
Display size Visible
Character positions DDRAM addresses
2*16 00..15 0x00..0x0F + 0x40..0x4F
2*20 00..19 0x00..0x13 + 0x40..0x53
2*24 00..23 0x00..0x17 + 0x40..0x57
2*32 00..31 0x00..0x1F + 0x40..0x5F
2*40 00..39 0x00..0x27 + 0x40..0x67


DDRAM address for a 4-line LCD(N=1)
Display size Visible
Character positions DDRAM addresses
4*16 00..15 0x00..0x0F + 0x40..0x4F + 0x14..0x23 + 0x54..0x63
4*20 00..19 0x00..0x13 + 0x40..0x53 + 0x14..0x27 + 0x54..0x67
4*40 (00..39) on first and
(00..39) on second controller
(0x00..0x27 + 0x40..0x67) for first controller
(0x00..0x27 + 0x40..0x67) for second controller

Interfacing to MCU

The LCD has 2 mode to interface with microcontroller are 4-bit interface and 8-bit interface

Interfacing to a 4-bit MPU
The HD44780U can be connected to the I/O port of a 4-bit MPU. If the I/O port has enough bits, 8-bit data can be transferred. Otherwise, one data transfer must be made in two operations for 4-bit data. In this case, the timing sequence becomes somewhat complex. (See Figure 18.) See Figure 19 for an interface example to the HMCS4019R. Note that two cycles are needed for the busy flag check as well as for the data transfer. The 4-bit
operation is selected by the program



Interfacing to an 8-bit MPU
See Figure 17 for an example of using a I/O port (for a single-chip microcomputer) as an interface device. In this example, P30 to P37 are connected to the data bus DB0 to DB7, and P75 to P77 are connected to E, R/:, and RS, respectively.




Initializing by Instruction

4-bit initialize



8-bit interface


Copyright(c) 2005-2008 sixca.com, All right reserved.
Best view @ 800X600, IE 6.0 up   
Terms of Use  Privacy Policy