Arduino: How to control a KS0108 based graphic LCD

From Luky-Wiki
Revision as of 14:45, 31 December 2012 by Lukas Dzunko (talk | contribs)

Jump to: navigation, search

Projects with Graphical LCDs are nice and it is not so big deal to access them from MCU. Interface for KS0108 and compatible controllers (Hitachi HD61202, etc.) is similar to HD44780. Compared to HD44780 it is much more simpler because KS0108 don't contain character generator. Data written to RAM are directly displayed on screen. I ommit some of details similar to HD44780. If you are not familiar with this controller then please read article about it first. Result of commands can be checked via LCD Simulator prior to programing MCU. For example i like this one: DjGfXLCDSIM

Small note: It looks like control lines CS1 and CS2 are different from module to module. I recommend to check datasheet from vendor.

Internal memory organization

Standard LCD module have resolution 128*64. This is 1KB (1024 bytes) of visible data. Every bit represent "one" dot on graphical LCD so there is no limitation for displayed data. Display itself is split to two independent parts controlled by two controllers (64*64/left + 64*64/right). Each half contain 8 horizontal pages which are 8 bit high. Control lines CS1/CS2 select controller (e.g. left or right part of display). Page select "line" on display. Inside Page you can select "slice" by setting Y Address or simply address. Command or write request can be send to both controllers at once. Of course read request should be send to only one controller at once (there is shared data line).

Visible internal memory is organized in following way: 2 (controller) * 8 (page) * 64 (address) * 8 (slice):

Controller #1 (CS1=1, CS2=0) Controller #2 (CS1=0, CS2=1)
Page 0 Page 0
Page 1 Page 1
Page 2 Page 2
Page 3 Page 3
Page 4 Page 4
Page 5 Page 5
Page 6 Page 6
Page 7 Page 7

Page organization:

Page
0 1 2 3 ... 60 61 62 63

Slice organization:

Slice
D0
D1
D2
D3
D4
D5
D6
D7


Command Set

Display On/Off

Set Address (Y Address)

Set Page (X Address)

Display Start Line (Z Address)

Status Read

Write Display Data

Read Display Data