#include<reg51.h>
#define port P0
void lcddata(unsigned char);
void lcdcmd(unsigned char);
void Delay(unsigned char);
sbit RS=P1^0;
sbit RW=P1^1;
sbit EN=P1^2;
void main()
{
unsigned int i;
unsigned char A[5]={0x38,0x01,0x0f,0x06,0x80},D[7]="KISHORE",W[8]={'W','I','N','E','Y','A','R','D'};
for(i=0;i<5;i++)
lcdcmd(A[i]);
Delay(2);
for(i=0;i<7;i++)
lcddata(D[i]);
Delay(2);
lcdcmd(0xc0);
for(i=0;i<8;i++)
lcddata(W[i]);
}
void lcdcmd(unsigned char cmd)
{
port=cmd;
RS=0;
RW=0;
EN=1;
Delay(2);
EN=0;
}
void lcddata(unsigned char dat)
{
port=dat;
RS=1;
RW=0;
EN=1;
Delay(2);
EN=0;
}
void delay(unsigned char value)
{
unsigned char j;
for(j=0;j<value;j++);
}
No comments:
Post a Comment