【文件属性】:
文件名称:1602液晶时钟
文件大小:6KB
文件格式:C
更新时间:2017-03-30 16:08:02
1602液晶时钟
单片机开发学习#include
//#include
#define uchar unsigned char
#define uint unsigned int
sbit en=P2^7;
sbit rs=P2^6;
sbit rw=P2^5;
sbit d1=P2^3;
sbit d2=P2^2;
sbit d3=P2^1;
sbit d4=P2^0;
uchar code table1[]=" 2014-03-01 SAT";
uchar code table2[]=" 23:59:52";
uchar hou,min,sec,count,week,year,month,day,i,num;
uchar k1;
void write_week();
uchar month_day();
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void write_com(uchar com)
{
rw=0;
rs=0;
P0=com;
delay(5);
en=1;
delay(5);
en=0;
}
void write_dat(uchar dat)
{
rw=0;
rs=1;
P0=dat;
delay(5);
en=1;
delay(5);
en=0;
}
void init()