Saturday, May 31, 2008

Key to LCD interfacing

Liquid crystal display is very important device in embedded system. It offers high flexibility to user as he can display the required data on it. But due to lack of proper approach to LCD interfacing many of them fail. Many people consider LCD interfacing a complex job but according to me LCD interfacing is very easy task, you just need to have a logical approach. This page is to help the enthusiast who wants to interface LCD with through understanding. Copy and Paste technique may not work when an embedded system engineer wants to apply LCD interfacing in real world projects.

You will be knowing about the booster rockets on space shuttle. Without these booster rockets the space shuttle would not launch in geosynchronous orbit. Similarly to understand LCD interfacing you need to have booster rockets attached! To get it done right you must have general idea how to approach any given LCD.This page will help you develop logical approach towards LCD interfacing.

First thing to begin with is to know what LCD driver/controller is used in LCD.Yes, your LCD is dumb it does not know to talk with your microcontroller. LCD driver is a link between the microcontroller and LCD. You can refer the datasheet of LCD to know the LCD driver for e.g. JHD 162A is name of LCD having driver HD44780U.You have to interface the LCD according to the driver specification. To understand the algorithm of LCD interfacing user must have datasheet of both LCD and LCD driver. Many people ignore the datasheets and end up in troubles. If you want to interface LCD successfully you must have datasheets.

Why people ignore datasheets? Most of us do not like to read 100 pages of datasheet. But for a accurate technical specification datasheets are must. I will show you a technique to manipulate a datasheet within minutes.

First thing to find out in datasheet is the features viz. operating voltage, type of interface, maximum speed for interface in MHz, size of display data RAM, number of pixels, bits per pixel, number of row and columns.
You must have the pin diagram of LCD.Pin diagram of LCD driver can be omitted.
Study the type of communication protocol whether it is parallel or serial interface. Check how LCD discriminates data bytes and command bytes, which pins on LCD are used for communication. Study Interface timing diagram given in the datasheet.
From datasheet of LCD driver find out whether hardware reset is required at startup, what is the time of reset pulse, is it active low and which pins of LCD are to be toggled.
Major task in LCD interfacing is the initialization sequence. In LCD initialization you have to send command bytes to LCD. Here you set the interface mode, display mode, address counter increment direction, set contrast of LCD, horizontal or vertical addressing mode, color format. This sequence is given in respective LCD driver datasheet. Studying the function set of LCD lets you know the definition of command bytes. It varies from one LCD to another. If you are able to initialize the LCD properly 90% of your job is done.
Next step after initialization is to send data bytes to required display data RAM memory location. Firstly set the address location using address set command byte and than send data bytes using the DDRAM write command. To address specific location in display data RAM one must have the knowledge of how the address counter is incremented.

Go to Next Post to understand the LCD interfacing concepts with clarity.