#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code table[]="1234567!";
uchar num=0;
sbit rw=P3^6;
sbit rs=P3^7;
sbit e=P2^5;
void delay(uchar t)
{
uint i,j;
for(i=t;i>0;i++)
for(j=110;j>0;j--);
}
void write_com(uchar com)
{
rs=0;
rw=0;
P0=com;
delay(5);
e=1;
delay(20);
e=0;
}
void write_date(uchar date)
{
rs=1;
rw=0;
P0=date;
delay(5);
e=1;
delay(20);
e=0;
}
void main()
{ e=0;
write_com(0x38);
write_com(0x0c);
write_com(0x06);
write_com(0x10);
write_com(0x80);
for(num;num<16;num++)
{
write_date(table[num]);
delay(5);
}
write_com(0x80+0x40);
for(num;num<16;num++)
{
write_date(table[num]);
delay(5);
}
}
-
最小系统
-
1602
一周热门 更多>