A liquid-crystal display (LCD) is a flat-panel display or other electronic visual display that uses the light-modulating properties of liquid crystals. Liquid crystals do not emit light directly.
LCDs are available to display arbitrary images (as in a general-purpose computer display) or fixed images with low information content, which can be displayed or hidden, such as preset words, digits, and 7-segment displays as in a digital clock. They use the same basic technology, except that arbitrary images are made up of a large number of small pixels, while other displays have larger elements.
LCDs are used in a wide range of applications including computer monitors, televisions, instrument panels, aircraft cockpit displays, and signage. They are common in consumer devices such as DVD players, gaming devices, clocks, watches, calculators, and telephones, and have replaced cathode ray tube (CRT) displays in nearly all applications. They are available in a wider range of screen sizes than CRT and plasma displays, and since they do not use phosphors, they do not suffer image burn-in. LCDs are, however, susceptible to image persistence.
The LCD screen is more energy-efficient and can be disposed of more safely than a CRT can. Its low electrical power consumption enables it to be used in battery-powered electronic equipment more efficiently than CRTs can be. It is an electronically modulated optical device made up of any number of segments controlling a layer of liquid crystals and arrayed in front of a light source (backlight) orreflector to produce images in color or monochrome. Liquid crystals were first discovered in 1888 .By 2008, annual sales of televisions with LCD screens exceeded sales of CRT units worldwide, and the CRT became obsolete for most purposes.
In this chapter we are interfacing HD44780 LCD which is 16*2 dot-matrix liquid crystal display controller and driver LSI displays alpha numerics ,Japanese kana characters, and symbols. It can be configured to drive a dot-matrix liquid crystal display under the control of a 4- or 8-bit microprocessor. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers.
- Command/Instruction Register- stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing, clearing the screen, setting the cursor position, controlling display etc.
- Data Register - stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.
Before starting your project you should learn basic operation of the 16*2 LCD . Please refer your LCD model manufacturer data sheet . But commen characteristic of all LCD s are similar operations .
Please remember the following command code to program a LCD
|Hex Code||Command to LCD Instruction Register|
|1||Clear screen display|
|E||Display ON, Cursor ON|
|80||Force the cursor to the beginning of the 1st line|
|C0||Force cursor to the beginning of the 2nd line|
|30||Function set :8-bit,1 line ,5*7 dots|
|38||Function set :8-bit,2 line ,5*7 dots|
|20||Function set: 4-bit,1 line ,5*7 dots|
|28||Function set :4-bit ,2 line ,5*7 dots|
|08||Display off cursor off (clear display without clearing DDRAM content|
|0C||Display on cursor off|
|0F||Display on cursor blinking|
|18||Shift entire display left|
|1C||Shift entire display right|
|10||Move cursor left by one character|
|14||Move cursor right by one character|
|80+add||Set DDRAM address or cursor position on display|
|38||Use 2 lines and 5x7 matrix|
the above commands of lcd are based on model HD44780 this may be vary with different manufacturer . so better you should use your own model of lcd data sheet .
And the pin configuration of the 16*2 LCD is given below .
|2||VCC||Main power supply||+5 V|
|3||VEE||Power supply to control contrast||Contrast adjustment by providing a variable resistor through VCC|
|4||RS||Register Select||RS=0 to select Command RegisterRS=1 to select Data Register|
|5||R/W||Read/write||R/W=0 to write to the registerR/W=1 to read from the register|
|6||EN||Enable||A high to low pulse (minimum 450ns wide) is given when data is sent to data pins|
|7||DB0||To display letters or numbers, their ASCII codes are sent to data pins (with RS=1). Also instruction command codes are sent to these pins.|
|10||DB3||8-bit data pins|
|15||Led+||Backlight VCC||+5 V|
|16||Led-||Backlight Ground||0 V|
now connect your circuit as shown in circuit diagram below
make sure pin number 16 of lcd is connected to ground , and pin number 10 of microcontroller is connect to VCC and that of 11 should be connect to Ground for proper operation.
further you can find a good tutorial with circuit connection and code explanation in AVR section of this website . So i suggest you to learn more about liquid crystal display with a real world example in AVR section