#include<reg51.h> // header file
#define Lcd P2 // Connection to 8 data pins D0-D7
#define lcd1 P3 // Connection of RS, RW, EN Pins
void delay(unsigned int x) //delay function
{
while(x--);
}
void cmd(unsigned int x) // command function
{
P2=x;
delay(10000);
P3=0x04; // RS=0,R/W=0,E=1
delay(100);
P3=0x00; // RS=0,R/W=0,E=0
}
void intiz() //LCD initialization function
{
cmd(0x01); // command for clear the screen
cmd(0x80); // command for first row first column
cmd(0x0e); // display ON cursor blink
cmd(0x38); // 2-lines and 5x7 matrix
}
void dat(unsigned int x) // Data/Command function
{
P2=x;
P3=0x05; // RS=1,R/W=0,E=1
delay(100);
P3=0x01; // RS=1,R/W=0,E=0
}
void main()
{
intiz(); // LCD initialization
dat('A'); // data
dat('l');
dat('i');
}
//Please comment below for any queries
#define Lcd P2 // Connection to 8 data pins D0-D7
#define lcd1 P3 // Connection of RS, RW, EN Pins
void delay(unsigned int x) //delay function
{
while(x--);
}
void cmd(unsigned int x) // command function
{
P2=x;
delay(10000);
P3=0x04; // RS=0,R/W=0,E=1
delay(100);
P3=0x00; // RS=0,R/W=0,E=0
}
void intiz() //LCD initialization function
{
cmd(0x01); // command for clear the screen
cmd(0x80); // command for first row first column
cmd(0x0e); // display ON cursor blink
cmd(0x38); // 2-lines and 5x7 matrix
}
void dat(unsigned int x) // Data/Command function
{
P2=x;
P3=0x05; // RS=1,R/W=0,E=1
delay(100);
P3=0x01; // RS=1,R/W=0,E=0
}
void main()
{
intiz(); // LCD initialization
dat('A'); // data
dat('l');
dat('i');
}
//Please comment below for any queries
No comments:
Post a Comment