ds12c887
请帮忙看下哪里有错
#include
#include"74hc595.h"
#include"boardinit.h"
#include"delay.h"
#include"lcd1602.h"
#include"clock.h"
#include"keyscan.h"
#define uchar unsigned char
#define uinit unsigned int
uchar time=0;
uchar miao,fen,shi;
***it as_ds12c887=P1^2;
***it ds_ds12c887=P1^0;
***it rw_ds12c887=P1^1;
void ds12c887_init()
{
write_byte_74hc595(0x02);
}
void write_ds12c887(uchar add_ds12c887,uchar data_ds12c887)/*写数据*/
{
as_ds12c887=1;
ds_ds12c887=1;
rw_ds12c887=1;
P0=add_ds12c887;
as_ds12c887=0;
rw_ds12c887=0;
P0=data_ds12c887;
as_ds12c887=1;
rw_ds12c887=1;
}
uchar read_ds_ds12c887(uchar add_ds12c887)/*读数据*/
{
uchar ds_date;
as_ds12c887=1;
ds_ds12c887=1;
rw_ds12c887=1;
P0=add_ds12c887;
as_ds12c887=0;
P0=0xff;
ds_ds12c887=0;
ds_date=P0;
as_ds12c887=1;
ds_ds12c887=1;
return ds_date;
}
void main()
{
ds12c887_init();
boardinit();
lcdinit();
disp_1602(1,1," 2015-07-14 ",16);
disp_1602(1,2," 08:11:00 ",16);
while(1)
{
miao=read_ds_ds12c887(0);
fen=read_ds_ds12c887(2);
shi=read_ds_ds12c887(4);
write_twoline(5,shi);
write_twoline(8,fen);
write_twoline(11,miao);
/*
keyscan();
clock();*/
}
}
回帖(2)
2015-11-9 21:58:09
我也是这样,楼主解决问题吗
我也是这样,楼主解决问题吗
举报
2016-1-28 19:46:37
提示: 作者被禁止或删除 内容自动屏蔽
举报
更多回帖