ds12c887时间显示乱码而且只有秒是在走
时间:10-02
整理:3721RD
点击:
请帮忙看下哪里有错
#include<reg52.h>
#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;
sbit as_ds12c887=P1^2;
sbit ds_ds12c887=P1^0;
sbit 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();*/
}
}
#include<reg52.h>
#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;
sbit as_ds12c887=P1^2;
sbit ds_ds12c887=P1^0;
sbit 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();*/
}
}
我也是这样,小编解决问题吗