Professional Documents
Culture Documents
Table 7. Instruction Set
Dot-Matrix LCD Units
18 Display Unit Users Manual
Instruction Set
ELECTRICAL CHARACTERISTICS
Absolue Maximum Ratings
See the device specifications for each LCD unit
model.
Electrical Characteristics
See the device specificiations for each LCD unit
model. Some of the currently available specifica-
tions do not describe the test conditions for the
high-level and low-level output voltages. These
conditions are as follows:
Timing Characteristics
!
!
Table 8.
t
AS
PW
EH
t
DSW
t
cycE
t
AH
t
AH
V
IH
V
IL
DB
0
- DB
7
t
Ef
t
H
t
Er
V
IH
V
IL
E
V
IL
R/W
V
IH
V
IL
RS
VALID DATA
LCD27-24
Figure 5. Write Operation Timing Diagram
(For data sent from the external microprocessor to the LCD unit)
!
!
!
!
!
!
!
Table 9. Write Operation Timing Characteristics
(VDD = 5.0 5%, VSS = 0 V, TA = 0 ~ 50C)
Dot-Matrix LCD Units
Display Unit Users Manual 19
ELECTRICAL CHARACTERISTICS
Absolue Maximum Ratings
See the device specifications for each LCD unit
model.
Electrical Characteristics
See the device specificiations for each LCD unit
model. Some of the currently available specifica-
tions do not describe the test conditions for the
high-level and low-level output voltages. These
conditions are as follows:
Timing Characteristics
!
!
Table 8.
t
AS
PW
EH
t
DSW
t
cycE
t
AH
t
AH
V
IH
V
IL
DB
0
- DB
7
t
Ef
t
H
t
Er
V
IH
V
IL
E
V
IL
R/W
V
IH
V
IL
RS
VALID DATA
LCD27-24
Figure 5. Write Operation Timing Diagram
(For data sent from the external microprocessor to the LCD unit)
!
!
!
!
!
!
!
Table 9. Write Operation Timing Characteristics
(VDD = 5.0 5%, VSS = 0 V, TA = 0 ~ 50C)
Dot-Matrix LCD Units
Display Unit Users Manual 19
Write Operation Timing Characteristics
If the above conditions are not satisfied, the inter-
nal reset circuit will not operate normally. In such a
case, the LCD unit must be initialized by executing
a series of instructions (see the Execution by In-
structions section).
t
AS
PW
EH
t
DDR
t
cycE
t
AH
t
AH
V
OH
V
OL
DB
0
- DB
7
t
Ef
t
DHR
t
Er
V
IH
V
IL
E
V
IH R/W
V
IH
V
IL
RS
VALID DATA
LCD27-25
Figure 6. Read Operation Timing Diagram
(For data sent from the LCD unit to the external microprocessor)
!
!
!
!
!
!
!
Table 10. Read Operation Timing Characteristics
(VDD = 5.0 5%, VSS = 0 V, Ta = 0 ~ 50C)
!
! !
Table 11. Power Conditions for Internal Reset
0.1 ms ! t
rCC
! 10 ms t
OFF
"
1 ms
0.2 V 0.2 V 0.2 V
4.5 V
NOTE: * t
OFF
indicates Power-off Period.
V
DD
LCD27-26
Figure 7.
Dot-Matrix LCD Units
20 Display Unit Users Manual
If the above conditions are not satisfied, the inter-
nal reset circuit will not operate normally. In such a
case, the LCD unit must be initialized by executing
a series of instructions (see the Execution by In-
structions section).
t
AS
PW
EH
t
DDR
t
cycE
t
AH
t
AH
V
OH
V
OL
DB
0
- DB
7
t
Ef
t
DHR
t
Er
V
IH
V
IL
E
V
IH R/W
V
IH
V
IL
RS
VALID DATA
LCD27-25
Figure 6. Read Operation Timing Diagram
(For data sent from the LCD unit to the external microprocessor)
!
!
!
!
!
!
!
Table 10. Read Operation Timing Characteristics
(VDD = 5.0 5%, VSS = 0 V, Ta = 0 ~ 50C)
!
! !
Table 11. Power Conditions for Internal Reset
0.1 ms ! t
rCC
! 10 ms t
OFF
"
1 ms
0.2 V 0.2 V 0.2 V
4.5 V
NOTE: * t
OFF
indicates Power-off Period.
V
DD
LCD27-26
Figure 7.
Dot-Matrix LCD Units
20 Display Unit Users Manual
Read Operation Timing Characteristics
LKS Expansion Board
LCD + Keypad + Stepper Motor
Video Demo
Programming
Step 1: Write a function to send
Instructions to LCD
Step 2: Write a function to Initialize LCD
(initialize once)
Step 3: Write a function to send Data to
LCD
Step 4: Write a function to display a string
to LCD
Demonstration #1
Flowchart for instCtrl() - function to send
instruction to LCD (8-bit)
Flowchart for instCtrl()
function
Sample Code (C)
void instCtrl(unsigned char inst)
{
IO_PDR2.byte = inst; // load 8-bit instruction to 8-bit LCD data lines
IO_PDR5.bit.P50 = 0; // set RS to 0 (instruction register)
IO_PDR5.bit.P51 = 0; // set RW to 0 (write mode)
IO_PDR5.bit.P52 = 1; // set E to 1 (initial state)
delay(1); // base delay is 16 us
IO_PDR5.bit.P52 = 0; // set E to 0 (H-L: final state)
readBF(); // read busy flag;
}
Reading the Busy Flag
Sample Code (C)
void readBF()
{
unsigned char flag;
IO_DDR2.byte = 0x00; // set direction of LCD data lines to input
IO_PDR5.bit.P50 = 0; // set RS to 0 (instruction register)
IO_PDR5.bit.P51 = 1; // set RW to 1 (read mode)
IO_PDR5.bit.P52 = 1; // set E to 1 (initial state)
do {
flag = IO_PDR2.bit.P27; // read bit 7 of Port 2 (busy flag)
} while (flag);
IO_PDR5.bit.P52 = 0; // set E to 0 (H-L: final state)
IO_DDR2.byte = 0xFF; // set direction of LCD data lines back to output
}
Seatwork #1
Flowchart and code for dataCtrl() -
function to send instruction to LCD (8-bit)
Flowchart and code for initLCD() -
function to send initialize the LCD (2-line,
Cursor on, blink off)
Demonstration #2
Flowchart for instCtrl() - function to send
instruction to LCD (4-bit)
Flowchart for
dataCtrl()
function 4-bit interface
(8-bit transfer)
Sample Code (C)
void instCtrl(unsigned char inst)
{
IO_DDR2.byte = inst >> 4; // transfer the upper 4-bit of inst to 4-bit LCD data line
IO_PDR2.bit.P24 = 0; // set RS to 0 (instruction register)
IO_PDR5.bit.P52 = 0; // set RW to 0 (write mode)
IO_PDR5.bit.P53 = 1; // set E to 1 (initial state)
delay(1); // delay for 16 us
IO_PDR5.bit.P53 = 0; // set E to 0 (H-L: final state)
IO_DDR2.byte = inst; // transfer the lower 4-bit of inst to 4-bit LCD data line
IO_PDR5.bit.P53 = 1; // set E to 1 (initial state)
delay(1); // delay for 16 us
IO_PDR5.bit.P53 = 0; // set E to 0 (H-L: final state)
readBF(); // read busy flag
}
Flowchart for instCtrl()
function 4-bit interface
(4-bit transfer for LCD initialization
purposes)
Seatwork #2
Flowchart and code for dataCtrl() -
function to send data to LCD (4-bit)
Demonstration #3
Displaying text to the LCD
displaying Hello! at the center of the 2nd line
Character Display Addresses
Line 1 (0x80 - 0x93)
Line 3 (0x94 - 0xA7)
Line 2 (0xC0 - 0xD3)
Line 4 (0xD4 - 0xE7)
Hello!
Line 1 address continue to Line 3 while Line 2 continues at Line 4.
Sample Code (C)
.
.
instCtrl(0xC6); // move cursor to 2nd line 7th column
dataCtrl(H); // prints H at current cursor position
// then shifts the cursor to the right*
dataCtrl(E); // prints E
dataCtrl(L); // prints L
dataCtrl(L); // prints L
dataCtrl(O); // prints O
dataCtrl(!); // prints !
.
.
* assuming configuration is cursor shift to right
Sources
Sharp HD44870 LCD Datasheet
Displaytech 204A Datasheet