Beginners Robotics Guide : Using LCDs with AVRs
by, 03-07-2010 at 06:23 PM (37878 Views)
Liquid Crystal Displays ( LCD ) are widely used as output in small systems especially robots . With there ability to display human readable text they are also a great add on to robots and can output great amount of information or be used as a system from which the user can interact . In this simple tutorial you will learn how to interface LCD's , what are the signal required on various pins and C code for using 16x1 and 16x2 LCD's.
LCD : Liquid crystal display ( because its has a crystalline structure and still it flows ) . To learn how it works you can read in scientific book . Now lets come to the point how to interface/connect a intelligent LCD (by intelligent i mean it has a controller built in ) Here is a step by step guide just follow the steps ...
STEP 1 : Identify : Determine what you want LCD are available in many flavors which are specified as follows 16x1 , 16x2 , 20x2 in the format AxB where A is the number of columns ( chatters ) and B is the number of Rows ( lines ) An LCD might also be Back lit .
STEP 2 : Connect : most of the LCD's follow the standard Hitachi Pin out which is simply ...
In some LCD's you might not find the 15 and 16 pin so don't worry .
here is how you must wire them up
An Intelligent LCD Need Only a few Commands And data to function
Command Set for the LCD
* : Does Not Matter
DDRAM : Display Data RAM
CGRAM : Character Generator RAM
Address : These are where the characters are meant to be displayed before sending data into the LCD the address can be specified if you want the string to be printed somewhere in the middle after that the address simply increase each time a new character is passed .
A simple 16x1 might be something like this
**All Address are in Hex
***When using an LCD of type 16x1(the on shown above ) specify 2 line display to use it fully ( The Lcd consider the second half as the next line )
Just look up the LCD documentation for the address locations
After You Connect the LCD to the Micro controller And Apply Power The LCD will just show some squares on the screen which might not even cover the whole screen . Adjust the contrast till these squares are barely visible .
For saving Pins on the micro controller i have simply put the RW line connected to the ground (and used a small delay instead of checking the line for the busy flag for the writing )
How to Program in C
* In the 4 bit interface .The lines D0 - D3 are disconnected and the interface is set to 4 line only D4-D7 are connected . When the data is to be written the higher order bits are written first then enable line is pulsed then the lower order bits are written then the line is pulsed
Complete Source Code : source.zip
How to use Intelligent LCD's - Julyan Ilett
Library for Hitachi 44780 based 1 or 2 line Text LCD displays - Knut Baardsen