Driving an Alphanumeric LCD with avrPrayog

LCD’s of Many kinds

Image Name Description
an 16×2 Alphanumeric LCD with back light It is most frequently used LCD module among makers, you may have seen this LCD in Coin Telephones, Weighting Machines etc. It is available with various color back light options (Blue, Green, White) and more Rows like 16×1, 16×2, 16×3, here 16 is number of columns or characters that can be displayed in a row at once
QVGA resolution LCD This kind of LCDs are used in Mobile Phones, these are available in both B/W and colored, many resolution QVGA, QQVGA are available, Interfacing protocol is somewhat complex
128×64 Graphics LCD This Graphics LCD is similar to any Monochrome LCD used in Mobile phones, but this LCD is designed to make its interfacing easier with Microcontrollers and other processors, so that it can be used in applications easily, its useful, easy to interface but costly
Nokia 3310 LCD I have to mention this LCD here, this LCD gained popularity among makers after people made open source library for it available to the community, its awesome, cheap and easy to use. This LCD gave us the Power to make our Hacks and designs more visually empowered

Interfacing with avrPrayog

Each kind of LCD has its own specific protocol for its interfacing with outside world. However we will be learning about 16×2 alphanumeric LCD interfacing with avrPrayog here. Interfacing protocol of 16×2 alphanumeric LCD does not have any specific protocol name because the protocol is pretty simple, basically its not a protocol at all, its all about writing to registers, When you have control data make RS (register select) pin High-Low and choose whether the 8 bit data on D0-D7 is Control data or actual data to be displayed.

Figure below shows the Pin configuration of Standard HD44870 based LCD, in most of the standard modules the Pin Outs is written at the backside of LCD panel. Standard HD44870 alphanumeric module has 16 pins…



In case you don’t know, it runs on accurate 5V, you can control the back light using pin 15 and 16, these two Pins are for Back light control ON-OFF.



People have already written pretty nice, easy to use libraries for these kind of LCD interfacing, for AVR’s one such library was written by a guy name Peter Fleury You can download the 4 bit LCD interfacing Library here, See online user manual and function reference of Peter Fleury’s library here

Example Firmware using avr-gcc

#include < avr/io.h >
#include "lcd.h"

int main(void)

    /* initialize display, cursor off */

    /* clear display and home cursor */

    /* put string to display (line 1) with linefeed */


    /* cursor is now on 1st char of second line, write second line */


I code, I simulate, I make it real!