#include"reg52.h"
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="I LOVE MCU!";
sbit snd=P2^7;
sbit shuju=P2^6;
sbit duxie=P2^5;
#define LCD1602_DATAPINS P0
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
{
for(y=110;y>0;y--);
}
}
void minglin(uchar com)
{
snd=0;
shuju=0;
duxie=0;
LCD1602_DATAPINS =com;
delay(5);
snd=1;
delay(5);
snd=0;
}
void shujuduan(uchar date)
{
snd=0;
shuju=1;
duxie=0;
LCD1602_DATAPINS =date;
delay(5);
snd=1;
delay(5);
snd=0;}
void init()
{
minglin(0x38);
minglin(0x0c);
minglin(0x06);
minglin(0x01);
minglin(0x80);
}
void main()
{
uchar num;
init();
for(num=0;num<11;num++)
{
shujuduan(table[num]);
}
while(1);
}
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="I LOVE MCU!";
sbit snd=P2^7;
sbit shuju=P2^6;
sbit duxie=P2^5;
#define LCD1602_DATAPINS P0
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
{
for(y=110;y>0;y--);
}
}
void minglin(uchar com)
{
snd=0;
shuju=0;
duxie=0;
LCD1602_DATAPINS =com;
delay(5);
snd=1;
delay(5);
snd=0;
}
void shujuduan(uchar date)
{
snd=0;
shuju=1;
duxie=0;
LCD1602_DATAPINS =date;
delay(5);
snd=1;
delay(5);
snd=0;}
void init()
{
minglin(0x38);
minglin(0x0c);
minglin(0x06);
minglin(0x01);
minglin(0x80);
}
void main()
{
uchar num;
init();
for(num=0;num<11;num++)
{
shujuduan(table[num]);
}
while(1);
}