Arduino: How to control a KS0108 based graphic LCD

From Luky-Wiki
Revision as of 18:13, 25 February 2016 by Lukas Dzunko (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Attention: this page is work in progress.

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 column 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 (column) * 8 (dots):

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:

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

Column organization:

Dot 0
Dot 1
Dot 2
Dot 3
Dot 4
Dot 5
Dot 6
Dot 7

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