Those how are building microcontroller based project for little long must have
got bored with the good
old character LCDs. Whether you are bored or your application require to
present more data to the user in a better way, you need Graphic
LCD. Character LCD Interfacing is quite easy so every one uses
it, but when I comes to Graphic LCD you need a well written and powerful graphic
library. Its not enough that you read the LCD datasheet and connect it your
MCU and start sending data. Because the LCD just appears to be block of memory
whose contents are directly visible on screen. The datasheet can only guide
you how to access this memory. You just can’t do much by writing to the memory.
The graphic library is a piece of software that has complex algorithms to render
graphic primitives like line, rectangles, circles, images and more. It also
helps load fonts and render text and numbers on screen. So it provide high level
access to the LCD screen and applications can be written much more easily.
While I was researching for graphic library for the GLCDs, I found some but
I was not fully satisfied by any of them. So I began to write a clean, powerful,
portable and easy to use library that can handle sever different graphic LCDs
and can be ported to many MCUs. In this article I will use a Graphic
LCD which is based on common KS0108 type controller
with AVR ATmega32 MCU. In future I will port the tutorial and library for PIC
and ARM CPUs.
Introducing the JHD12864E Graphical LCD Module.
Their are several type of graphical LCD module in the market. In this tutorial
I will introduce you to a common graphical lcd module that is easily available
in most part of the globe. If you are in India I request you to buy
one of these from our online
store, in this way you can help us.
KS0108 based 128 x 64 Graphic LCD Module
The specification of this LCD are as follows.
- 128 horizontal pixel and 64 vertical pixel resolution.
- Controlled based on KS0108B
- Parallel 8bit interface
- On board graphic memory.
- Available in Green backlight with dark green pixels.
- Also available in Blue backlight with light blue pixels.
- LED backlight.
- 20 PIN linear connection.
with AVR PIN
|2||Vcc||+5v Supply in|
|4||RS||Instruction/Data Register Select||PD3|
|15||CS1||Chip Select 1||PB0|
|16||CS2||Chip Select 2||PB1|
|18||VEE||NEGATIVE 10V OUT|
Graphic LCD Testing Circuit with AVR ATmega32
I suggest you to make a small circuit with ATmega32,
its life support environment and Graphic LCD to experiment with these LCD. I
have clocked the Test circuit with 16MHz
crystal for maximum speed. Make the circuit as follows.
Schematic for AVR ATmega32 and Graphic LCD Connection.
The RV1 (which is a variable resistor of 10K) is used to adjust the contrast
of the display. If no display is visible on screen use this to adjust
the contrast until you see everything clearly. The AVR’s Fuse bits
must be set as follows to disable JTAG and enable external crystal.This
step is very important and things won’t work if you forget this.
- HIGH Fuse = 0xC9
- LOW Fuse = 0xFF
Graphic LCD Test Circuit Fabrication Tips.
I have used my Low
Cost 40 PIN AVR Development Board for quick testing. I is a bare
bone AVR board with AVR and its life support. The nice thing is that it has
prototyping area surrounding the AVR. I used this area to mount the 20 PIN FRC
Box header for connecting the GLCD.
40 PIN AVR Devboard with Graphic LCD Connector.
In the above image you can see the 20 PIN FRC Box header is soldered. The red
wires connect the PINS of header to the MCUs I/O lines. They also supply power
to the module and its led backlight.
Graphic LCD Connector.
Take a 20 PIN FRC Cable. It has female connectors at both ends. Cut it to half
and solder the wires to 20 PINs on the LCD Module. The image below illustrate
the point. Now you can easily connect and disconnect the graphic lcd module
Graphic LCD with Wire Soldered.
Graphic LCD with Wire Soldering.
Graphic LCD Connected.
AVR Graphic LCD setup is ready!
In the next tutorial we will get our hands wet by writing the "Hello
World" App for the Graphic LCD. I will show you how to create
a AVR Studio Project with Graphic LCD Support by Adding and Configuring our
Solid Graphic Library for AVRs.
So don’t forget to subscribe to the RSS Feed or email delivery of new articles!
See the sidebar for more info. You can also connect via Twitter.
Other Parts of the Tutorial Series
- Part I –
Introduction to GLCD and Hardware Setup
- Part II – Downloading
and Installing ProGFX!
- Part III – Explains
Graphic Primitive Functions.
- Part IV – Font
and Text Handling Functions.