基于利用时钟芯片DS1302实现万年历,1602LCD显示电子表 - 图文(6)

2019-04-14 12:00

TempBuffer[0]=temp_value/10+'0'; //十位 TempBuffer[1]=temp_value+'0'; //个位 TempBuffer[2]=0xdf; //温度符号 TempBuffer[3]='C'; TempBuffer[4]='\\0'; }

void Delay1ms(unsigned int count) { }

/*延时子程序*/ void mdelay(uint delay) {

uint i;

unsigned int i,j; for(i=0;i

for(;delay>0;delay--)

{for(i=0;i<62;i++) //1ms延时.

{;}

}

}

void outkey() //跳出调整模式,返回默认显示 { uchar Second;

if(out==0||wireless_1==1) { mdelay(8);

count=0;

hide_sec=0,hide_min=0,hide_hour=0,hide_day=0,hide_week=0,hide_mont

h=0,hide_year=0;

Second=Read1302(DS1302_SECOND);

Write1302(0x8e,0x00); //写入允许 } }

//////////////////////////////////////////////////////////////////////////////////////////////////////////// void Upkey()//升序按键 {

Up=1;

if(Up==0||wireless_2==1) Write1302(0x80,Second&0x7f);

Write1302(0x8E,0x80); //禁止写入 done=0; while(out==0); while(wireless_1==1);

{

mdelay(8); switch(count) {case 1:

temp=Read1302(DS1302_SECOND); //读取秒数

//读取分数

读取小时数

temp=temp+1; //秒数加1

up_flag=1; //数据调整后更新标志 if((temp&0x7f)>0x59) //超过59秒,清零

temp=0;

break;

case 2:

temp=Read1302(DS1302_MINUTE);

temp=temp+1; //分数加1

up_flag=1; if(temp>0x59) //超过59分,清零 temp=0;

break;

case 3:

temp=Read1302(DS1302_HOUR); // temp=temp+1; //小时数加1

up_flag=1;

读取星期数

取日数

if(temp>0x23) //超过23小时,清零 temp=0;

break;

case 4:

temp=Read1302(DS1302_WEEK); //

temp=temp+1; //星期数加1

up_flag=1; if(temp>0x7) temp=1;

break;

case 5:

temp=Read1302(DS1302_DAY); //读

temp=temp+1; //日数加1

up_flag=1; if(temp>0x31) temp=1;

break;

case 6:

temp=Read1302(DS1302_MONTH); //读取月数

temp=temp+1; //月数加1

up_flag=1; if(temp>0x12)

读取年数

}

temp=1;

break;

case 7:

temp=Read1302(DS1302_YEAR);

temp=temp+1; //年数加1

up_flag=1; if(temp>0x85) temp=0;

break;

default:break;

}

while(Up==0);

while(wireless_2==1); }

//


基于利用时钟芯片DS1302实现万年历,1602LCD显示电子表 - 图文(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:遵义市畜牧渔业雪凝灾害情况调查报告

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: