Difference between revisions of "Arduino: How to control a KS0108 based graphic LCD"

From Luky-Wiki
Jump to: navigation, search
(Created page with "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 ...")
 
(Internal memory organization)
Line 5: Line 5:
 
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 setying Y Address or simply address.
 
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 setying Y Address or simply address.
  
Memory organization:
+
Memory organization - 2 (controller) * 8 (page) * 64 (address) * 8 (dot):
 
{|class="wikitable" align="center" style="text-align: center;"
 
{|class="wikitable" align="center" style="text-align: center;"
! Controller #1 CS1=1, CS2=0 || Controller #2 CS1=0, CS2=1
+
! colspan="2" | 2 (controller) * 8 (page) * 64 (address) * 8 (dot)
 +
|-
 +
! Controller #1 <br> CS1=1, CS2=0 || Controller #2 <br> CS1=0, CS2=1
 
|-
 
|-
 
| Page 0 || Page 0
 
| Page 0 || Page 0
Line 46: Line 48:
 
| D7 || D7 || D7 || D7 || || ... || || D7 || D7 || D7 || D7
 
| D7 || D7 || D7 || D7 || || ... || || D7 || D7 || D7 || D7
 
|-
 
|-
|}  
+
|}
  
 
== Command Set ==
 
== Command Set ==

Revision as of 14:32, 31 December 2012

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 setying Y Address or simply address.

Memory organization - 2 (controller) * 8 (page) * 64 (address) * 8 (dot):

2 (controller) * 8 (page) * 64 (address) * 8 (dot)
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:

0 1 2 3 ... 60 61 62 63
D0 D0 D0 D0 ... D0 D0 D0 D0
D1 D1 D1 D1 ... D1 D1 D1 D1
D2 D2 D2 D2 ... D2 D2 D2 D2
D3 D3 D3 D3 ... D3 D3 D3 D3
D4 D4 D4 D4 ... D4 D4 D4 D4
D5 D5 D5 D5 ... D5 D5 D5 D5
D6 D6 D6 D6 ... D6 D6 D6 D6
D7 D7 D7 D7 ... D7 D7 D7 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