1 of 12

LCD INTERFACING

2 of 12

Table 12-1: Pin Descriptions for LCD

Pin Symbol I/O Description

1 VSS -- Ground

2 VCC -- +5V power supply

3 VEE -- Power supply to control contrast

4 RS I RS = 0 to select command register, RS = 1 to select data register

5 R/W I R/W = 0 for write, R/W = 1 for read

6 E I/O Enable

7 DB0 I/O The 8-bit data bus

8 DB1 I/O The 8-bit data bus

9 DB2 I/O The 8-bit data bus

10 DB3 I/O The 8-bit data bus

11 DB4 I/O The 8-bit data bus

12 DB5 I/O The 8-bit data bus

13 DB6 I/O The 8-bit data bus

14 DB7 I/O The 8-bit data bus

3 of 12

Table 12-2: LCD Command Codes

Code (Hex) Command to LCD Instruction Register

1 Clear display screen

2 Return home

4 Decrement cursor (shift cursor to left)

6 Increment cursor (shift cursor to right)

5 Shift display right

7 Shift display left

8 Display off, cursor off

A Display off, cursor on

C Display on, cursor off

E Display on, cursor blinking

F Display on, cursor blinking

10 Shift cursor position to left

14 Shift cursor position to right

18 Shift the entire display to the left

1C Shift the entire display to the right

80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38 2 lines and 5x7 matrix

Note: This table is extracted

from Table 12-4.

4 of 12

Figure 12-2. LCD Connections

5 of 12

Figure 12-3. LCD Timing for Read ( L-to-H for E line)

tD = Data output delay time

tAS = Setup time prior to E (going high) for both RS and R/W = 140 ns (minimum)

tAH = Hold time after E has come down for both RS and R/W = 10 ns (minimum)

Note: Read requires an L-to-H pulse for the E pin.

6 of 12

Figure 12-4. LCD Timing for Write (H-to-L for E line)

tPWH = Enable pulse width = 450 ns (minimum)

tDSW = Data setup time = 195 ns (minimum)

tH = Data hold time = 10 ns (minimum)

tAS = Setup time prior to E (going high) for both RS and R/W = 140 ns (minimum)

tAH = Hold time after E has come down for both RS and R/W = 10 ns (minimum)

7 of 12

LCD Data Sheet

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0

0 0 1 A A A A A A A

where AAAAAAA = 0000000 to 0100111 for line 1

and AAAAAAA = 1000000 to 1100111 for line 2.

8 of 12

Table 12-3: LCD Addressing

DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0

Line 1 (min) 1 0 0 0 0 0 0 0

Line 1 (max) 1 0 1 0 0 1 1 1

Line 2 (min) 1 1 0 0 0 0 0 0

Line 2 (max) 1 1 1 0 0 1 1 1

9 of 12

Figure 12-5. Cursor Addresses for Some LCDs

16 x 2 LCD 80 81 82 83 84 85 86 through 8F

C0 C1 C2 C3 C4 C5 C6 through CF

20 x 1 LCD 80 81 82 83 through 93

20 x 2 LCD 80 81 82 83 through 93

C0 C1 C2 C3 through D3

20 x 4 LCD 80 81 82 83 through 93

C0 C1 C2 C3 through D3

94 95 96 97 through A7

D4 D5 D6 D7 through E7

40 x 2 LCD 80 81 82 83 through A7

C0 C1 C2 C3 through E7

Note: All data is in hex.

10 of 12

Table 12-4: List of LCD Instructions

11 of 12

Table 12-4: List of LCD Instructions

12 of 12

Table 12-4: List of LCD Instructions

Notes:

1. Execution times are maximum times when fcp or fosc is 250 kHz.

2. Execution time changes when frequency changes. Ex: When fcp or fosc is 270 kHz: 40 µs x 250 / 270 = 37 µs.

3. Abbreviations:

DD RAM Display data RAM

CG RAM Character generator RAM

ACC CG RAM address

ADD DD RAM address, corresponds to cursor address

AC Address counter used for both DD and CG RAM addresses.

1/D = 1 Increment 1/D = 0 Decrement

S = 1 Accompanies display shift

S/C = 1 Display shift; S/C = 0 Cursor move

R/L = 1 Shift to the right; R/L = 0 Shift to the left

DL = 1 8 bits, DL = 0: 4 bits

N = 1 1line, N = 0 : 1 line

F = 1 5 x 10 dots, F = 0 : 5 x 7 dots

BF = 1 Internal operation; BF = 0 Can accept instruction