20
WWW.8051.in www.8051.in

LCD 8051 interfacing

Embed Size (px)

DESCRIPTION

LCD 8051 interfacing

Citation preview

Page 1: LCD 8051 interfacing

WWW.8051.in

www.8051.in

Page 2: LCD 8051 interfacing

Liquid Crystal DisplayLiquid Crystal DisplayAn 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.

It is often used in battery - powered electronic devices because it requires very small amounts of electric power

2www.8051.in

Page 3: LCD 8051 interfacing

Liquid Crystal DisplayLiquid Crystal DisplayLCDs 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

Page 4: LCD 8051 interfacing

An Example

www.8051.in

Page 5: LCD 8051 interfacing

UNDERSTANDING LCD

www.8051.in

Page 6: LCD 8051 interfacing

Dot MatrixDot MatrixA 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.

6www.8051.in

Page 7: LCD 8051 interfacing

Dot Matrix ExampleDot Matrix Example

7

www.8051.in

Page 8: LCD 8051 interfacing

Pin Out

15 – VCC (Backlight) , 16- GND

www.8051.in

Page 9: LCD 8051 interfacing

Pinout

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

Page 10: LCD 8051 interfacing

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

Page 11: LCD 8051 interfacing

Display Data Ram (DDRAM)

www.8051.in

Page 12: LCD 8051 interfacing

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

Page 13: LCD 8051 interfacing

LCD Commands Table

www.8051.in

Page 14: LCD 8051 interfacing

INTERFACING LCD TO 8051

www.8051.in

Page 15: LCD 8051 interfacing

Project Assignment 4

www.8051.in

Page 16: LCD 8051 interfacing

www.8051.in

Page 17: LCD 8051 interfacing

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

Page 18: LCD 8051 interfacing

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

Page 19: LCD 8051 interfacing

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

Page 20: LCD 8051 interfacing

THANKS

Visit www.8051.in for more……

www.8051.in