Sie sind auf Seite 1von 20

WWW.8051.

in
www.8051.in

Liquid Crystal Display


An LCD is electronically modulated optical device shaped into a thin, flat panel made up of any

number of color or monochrome pixels filled with liquid crystals. powered electronic devices because it requires very small amounts of electric power
www.8051.in
2

It is often used in battery -

Liquid Crystal Display


LCDs have become a cheap and easy way to get text display for an embedded system.
Common displays are set up as 16 to 20 characters by 1 to 4 lines. The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line).

www.8051.in

An Example

www.8051.in

UNDERSTANDING LCD

www.8051.in

Dot Matrix
A 5X7 display consists of a

matrix of lights or mechanical indicators arranged in a rectangular configuration. By switching on or off selected lights, text or graphics can be displayed.
www.8051.in
6

Dot Matrix Example

www.8051.in

Pin Out

15 VCC (Backlight) , 16- GND www.8051.in

Pin-Description
8 data pins D7:D0:

Bi-directional data/command pins. Alphanumeric characters are sent in ASCII format.


RS: Register Select RS = 0 -> Command Register is selected RS = 1 -> Data Register is selected R/W: Read or Write 0 -> Write 1 -> Read E: Enable (Latch data)

Used to latch the data present on the data pins. A high-to-low edge is needed to latch the data.
VEE : contrast control

www.8051.in

Important Note:
For Contrast setting a 10K pot should be used as shown

in the figure. Two types of data is given to the LCD data to be displayed, command or special instruction.

www.8051.in

Display Data Ram (DDRAM)

www.8051.in

For a 2x16 LCD the DDRAM address for first line is

from 80h to 8FH & for second line is C0H to CFH. So if we want to display 'H' on the 7th position of the first line then we will write it at location 87h.

www.8051.in

LCD Commands Table

www.8051.in

INTERFACING LCD TO 8051

www.8051.in

Project Assignment 4

www.8051.in

www.8051.in

Embedded C Program
#include<reg52.h> sfr ldata = 0x90; sbit rs = P2^0; sbit rw = P2^1; sbit en = P2^2; void lcdcmd(unsigned char value); void lcddata(unsigned char value); void msdelay(unsigned int itime); void main() { lcdcmd(0x38); msdelay(150); lcdcmd(0x0E); msdelay(150); lcdcmd(0x01); msdelay(150); lcdcmd(0x07); msdelay(150); lcdcmd(0x8B); msdelay(150);

www.8051.in

lcddata('C'); msdelay(150); lcddata('H'); msdelay(150); lcddata('I'); msdelay(150); lcddata('P'); msdelay(150); lcddata('A'); msdelay(150);

lcddata('D'); msdelay(150); lcddata('R'); msdelay(150); lcddata('O'); msdelay(150); lcddata('I'); msdelay(150); lcddata('T'); msdelay(150); lcddata('S'); }
www.8051.in

void lcdcmd(unsigned char value) { ldata=value; rs=0; rw=0; en=1; msdelay(1); en=0; return; } void lcddata(unsigned char value) { ldata=value;

rs=1; rw=0; en=1; msdelay(1); en=0; return; } void msdelay(unsigned int itime) { unsigned int i,j; for(i=0;i<itime;i++) for(j=0;j<1275;j++); }

www.8051.in

THANKS

Visit

www.8051.in

for more

www.8051.in

Das könnte Ihnen auch gefallen