内容发布更新时间 : 2024/11/15 2:52:59星期一 下面是文章的全部内容请认真阅读。
default:break; }
}
else
{ newval--;
switch(s1num)
{ case 1: if(newval==0) newval=99; DisplayYear(newval);
break;
case 2: if(newval==0) newval=12;
DisplayMonth(newval);
break;
case 3: if(newval==0) newval=31;
DisplayDay(newval);
break;
case 4: if(newval<0) newval=6; DisplayWeek(newval);
break;
case 5: if(newval<0) newval=23; DisplayHour(newval);
break;
case 6: if(newval<0) newval=59; DisplayMinute(newval);
break;
case 7: if(newval<0) newval=59;
13
DisplaySecond(newval);
break;
default:break;
}
}
WriteSet1302((newaddr-1),((newval/10)<<4)|(newval)); //将新数据写入寄存器
}
//键盘扫描程序
//******************************************* void key_scan(void) { uchar miao,s1num=0;
if(menu==0)
{
delay(5); if(menu==0) {
while(!menu); s1num++;
while(1)
{
if(menu==0)
{
delay(5); if(menu==0) {
while(!menu);
14
s1num++;
}
} rd=0; miao=ReadSet1302(0x81); second=miao;
WriteSet1302(0x80,miao|0x80);
write_com(0x0f);//光标闪射 if(s1num==1)
{ year=ReadSet1302(0x8d);
write_com(0x80+4); //年光标
if(add==0) {
delay(3); if(add==0)
{ while(!add);
turn_val(year,1,0x8d,1); }
}
if(dec==0) { delay(3); if(dec==0) { while(!dec);
turn_val(year,0,0x8d,1);
}
15
} }
if(s1num==2) {
month=ReadSet1302(0x89); write_com(0x80+7); //月光标 if(add==0)
{
delay(3); if(add==0) { while(!add);
turn_val(month,1,0x89,2); } }
if(dec==0) {
delay(3); if(dec==0) { while(!dec);
turn_val(month,0,0x89,2); } } }
if(s1num==3)
{ day=ReadSet1302(0x87);
write_com(0x80+10);//日光标
16