KS0108 128x64 LCD Hardware Control
Understanding the hardware control lines is extremely important if the driver code is to operate correctly. This page shows some of the important aspects of the display worth knowing.
Pinout
Pin Number | Pin Name | State | Function / Info |
1 | VSS | 0 V | GND |
2 | VDD | 5 V | Logic supply voltage |
3 | VO | Contrast Adjustment voltage | |
4 | D/I | H/L | H: Data mode L: Instruction mode |
5 | R/W | H/L | H: Read L: Write |
6 | E | H→L Enable Signal | |
7 | DB0 | H/L | |
8 | DB1 | H/L | |
9 | DB2 | H/L | |
10 | DB3 | H/L | |
11 | DB4 | H/L | |
12 | DB5 | H/L | |
13 | DB6 | H/L | |
14 | DB7 | H/L | |
15 | CS1 | H | Chip Select Signal for IC1 |
16 | CS2 | H | Chip Select Signal for IC2 |
17 | RES | L | Reset Signal |
18 | Vout | Supply Voltage for LCD | |
19 | A | 4.2 V | LED Power |
20 | K | 0 V | LED Power |
The lines DB0 to DB7 can carry either data for display, or command instruction. Pin 4 allows the programmer to let the LCD computer know whether the byte in the bus is data for display, or command instruction. When pin 4 is high, it treats the byte in the bus as display data, and when low, it treats it as a command instruction.
Chip Select
PIN 15 (CS1) | PIN 16(CS2) | |
H | L | 1st half of the display IC 1 |
L | H | 2nd half of the display IC 2 |
From a programming perspective, the chip select control lines CS1 and CS2 should toggle, and when CS1 is logic one, CS2 should be logic zero.
Setting Y Address
D/I | R/W | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
0 | 0 | 0 | 1 | C | C | C | C | C | C |
COLUMN 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||
COLUMN 63 | 1 | 1 | 1 | 1 | 1 | 1 |
The "Y Address" sets the column number through the instruction mode. The instruction mode has to be set first so that the chip treats the data in the bus as an instruction.
Setting Page (X Address)
D/I | R/W | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
0 | 0 | 1 | 0 | 1 | 1 | 1 | P | P | P |
PAGE 0 | 0 | 0 | 0 | ||||||
PAGE 1 | 0 | 0 | 1 | ||||||
PAGE 2 | 0 | 1 | 0 | ||||||
PAGE 3 | 0 | 1 | 1 | ||||||
... | ... | ... | ... | ||||||
PAGE 7 | 1 | 1 | 1 |
You set the page in instruction mode.
Sending Display Data
D/I | R/W | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
1 | 0 | D | D | D | D | D | D | D | D |
You need to set the data mode first to let the LCD computer know that the data in the bus is for display purposes.
This Article Continues...
128x64 LCDProgramming the 128x64 LCD
KS0108 128x64 LCD Hardware Control
128x64 Timing and Modes
128x64 LCD Graphics Driver Design
128x64 ASCII Text Driver Design
128x64 Bar Graph