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); } //