Documente Academic
Documente Profesional
Documente Cultură
DisplayHELLO!on162LCDusingAT89C51|BraveLearn
LCD Pinout
http://bravelearn.com/displayhelloon16x2lcdusingat89c51/
1/3
9/12/2016
DisplayHELLO!on162LCDusingAT89C51|BraveLearn
Now to display simple HELLO we will first simulate the circuit in Proteus or equivalent software:
Circuit Diagram:
Now to run this circuit you first need to create HEX file using Keil or other equivalent software:
Code:
#include reg51.h
//LCD
sbit rs = P3^0;
//register select pin
sbit rw = P3^1;
//read write pin
sbit e = P3^2;
//enable pin
void delay(unsigned int time)
//Function to provide time delay in msec.
{
int i,j ;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void lcdcmd(unsigned char item)
//Function to send command to LCD
{
P2 = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
return;
}
http://bravelearn.com/displayhelloon16x2lcdusingat89c51/
2/3
9/12/2016
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
DisplayHELLO!on162LCDusingAT89C51|BraveLearn
void lcddata(double item)
//Function to send data to LCD
{
P2 = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
return;
}
void main()
{
lcdcmd(0x0E);
//turn display ON for cursor blinking
lcdcmd(0x01);
//clear screen
lcdcmd(0x06);
//display ON
lcddata('H');
lcddata('E');
lcddata('L');
lcddata('L');
lcddata('O');
lcddata('!');
while(1){}
//Stuck into infinite loop after displaying HELLO! so to avoid blinking
}
http://bravelearn.com/displayhelloon16x2lcdusingat89c51/
3/3