#include<REGX51.H>
#include<stdio.h>
sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
void delay(int a);
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);
void lcdcmd(unsigned char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
delay(2);
en=0;
return;
}
void lcddata(unsigned char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
delay(2);
en=0;
return;
}
void delay(int a)
{
unsigned int i,j;
for(i=0;i<=100;i++)
{
for(j=0;j<=10*a;j++)
{
}}}
void main()
{
P1=0x00;
lcdcmd(0x38);
delay(2);
lcdcmd(0x0E);
delay(2);
lcdcmd(0x01);
delay(2);
lcdcmd(0x06);
delay(2);
while(1)
{
lcdcmd(0x82);
delay(10);
lcddata(‘T’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘C’);
delay(10);
lcddata(‘H’);
delay(10);
lcddata(‘F’);
delay(10);
lcddata(‘O’);
delay(10);
lcddata(‘R’);
delay(10);
lcddata(‘M’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘R’);
delay(10);
lcddata(‘S’);
delay(10);
lcdcmd(0xC2);
delay(10);
lcddata(‘T’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘C’);
delay(10);
lcddata(‘H’);
delay(10);
lcddata(‘N’);
delay(10);
lcddata(‘O’);
delay(10);
lcddata(‘L’);
delay(10);
lcddata(‘O’);
delay(10);
lcddata(‘G’);
delay(10);
lcddata(‘I’);
delay(10);
lcddata(‘E’);
delay(10);
lcddata(‘S’);
delay(10);
}}
No comments:
Post a Comment