液晶显示时间,日期,星期,和温度,上图在楼下


由于在晚上,低级的诺基亚照不了相,有空再上图
好的,这是DS1302的
#include<reg52.h>
#include"user.h"
void write_bity(uchar ADD)
{
uchar i,com;
com=ADD;
for(i=0;i<8;i++)
{
SCL=0;
IO=com&0x01;
SCL=1;
com>>=1;
}
}
uchar read_bity()
{
uchar i,temp;
for(i=0;i<8;i++)
{
temp>>=1;
SCL=1;
SCL=0;
if(IO) temp|=0x80;
}
return temp;
}
void write_data(uchar ADD,uchar dat)
{
RST=0;
SCL=0;
RST=1;
write_bity(ADD);
write_bity(dat);
SCL=1;
RST=0;
}
uchar read_data(uchar ADD)
{
uchar temp1;
RST=0;
SCL=0;
RST=1;
write_bity(ADD);
temp1=read_bity();
SCL=1;
RST=0;
temp1=ACC;
temp1=(temp1/16*10)+(temp1%16);
return temp1;
}