GLCD Hookup Guide-ATmega32

Graphical LCD

Unlike a character LCD which can only display alphanumeric characters, a graphical LCD can display any type of element provided by the user. It means a graphical LCD can display images, fonts, and other structures. With the help of a graphical LCD, one can display 8192 pixels on the screen. OpenLab uses KS0108 display controllers for controlling LCD panels on the GLCD.

KS0108 is a dot matrix display controller from Samsung with 64 channel output. It receives input as 8-bit parallel data and stores in data RAM which has a capacity of 512 bytes (512×8 = 4096 bits). To drive a 128×64 graphic display, two such controllers are required as each will be controlling a half of 64×64 pixels. A common driver KS0107 generates timing signals for these two controllers. There are also other display controllers for graphics LCD, an example is Toshiba T6963C. But we will be discussing KS0108 based graphic LCD interfacing in this article.

The 16×2 character LCDs have their own limitations.They can only display characters of certain dimensions. Graphical LCDs are used for displaying custom characters and images.Various graphical LCDs are available in the market with different sizes.
OpenLab uses a 128×64 graphical LCD with two KS0108 controllers.
The GLCD is divided into two halves whereas each half is controlled by a KS0108 controller. GLCDs with KS0108 controllers follow paging scheme.

According to the paging scheme in KS0108 controller GLCDs, each half is divided into 8 pages. A page will have 8 rows with 64 bytes in each(columns ). Thus a single page will have 512 bytes. Each page consists of 8 rows and 64 columns. So two horizontal pages make 128 columns and 8 vertical pages make 64 rows. CS stands for controller select. Pin diagram and description of the pins are given below.

Pin Diagram

Pin Description

JHD12864 is a 20-pin GLCD module. It has 8 data lines, 6 control lines, and 6 power and displays related pins. Pin descriptions are given below. The GLCD module’s pins from 7 to 14 are data pins. We use these pins to transfer the data to the display RAM.

Power Pins

1 and 2 pins are Vdd and Vss pins. Connect these pins to 5V and ground respectively.
The pin 18 is the output of a negative voltage generator. It generates -10V in the case of JHD12864 GLCD module. By using a potentiometer, we can generate the required operating voltage by feeding the negative voltage to the Vo pin. The resulting LCD voltage will be Vdd-Vo (If the pot is in minimum, 5-(-10) = 15V). From the datasheet of JHD12864 module, the maximum LCD voltage allowed is 18V. We can vary Vo to change the contrast of the display.
The 19 and 20 pins are Anode and cathode of backlit LED, limit the current through it by putting a resistor in the line. We can use a pot if you need to vary this too.

Control Signals

CS1 and CS2 pins are used to select the KS0108 controller from the two. CS1 selects the left side controller and CS2 selects the right one which in turn selects the corresponding side of the displays 64×64 pixels. RST is the reset pin, it is used to reset the entire display content by clearing whole of the display RAM. R/W pin selects the type of operation being performed by the GLCD, a High indicates read operation and a Low indicates write operation. Data/Instruction (D/I) selects between data transfer or instruction. The Enable pin is the clock of GLCD. It is used to clock the data/instruction to the display module.

OpenLab GLCD Module

OpenLab has a separate section in which GLCD can be interfaced with the microcontroller with much ease. The GLCD module is connected already. The user only needs to power on the module and connect the data and control ports.

PORT D should be connected to GLCD2and PORT A should be connected to GLCD1. PORT A is configured as control port and PORT D is configured as a data port.

Graphical LCD uses two ports, J41 and J42. By default, we can connect it to J43 (Port D) and J44 (Port A).
The switch SW2 should be turned on to use the graphical LCD.

Pin Arrangement

GLCD1 – Control Port

EN – LCD Enable bit
R/W – Read/ write bit. High for read and low for write
RS – Register select bit
CS1, CS2 – Chip select bits of internal controller
RST – Reset
NC – No connection

GLCD2 – Data Port

How to Use Graphical LCD with OpenLab

* Connect J42 (GLCD1) to J44 (Port A) or to any other available port. Please note that first six pins are needed to operate GLCD
* Connect J41 (GLCD2) to J43 (Port D) or to any other available port. It uses all the 8 pins of that port. So you can use port D/port B for this purpose.
* Turn on SW2 to switch on the section.
* Define the used ports as output