- while(1)
- {
- int temp;
- SixCountdown();
- ForeAlarm();
- temp = key_scan();
- ShowTemp();
- switch(state)
- {
- case 0:FlagClear();led_hc595_drive(0xff,0xff,0xff,0xff,0x00);break;
- case 1:ShowNormal(); EA=1; break;
- case 2:ShowSetHMorMS(); DigdotClose(); EA=1; break;
- case 3:ShowEnd(); EA=1; break;
- case 4:ShowVolume(); EA=1; break;
- case 5:ShowAlarm(); EA=1; break;
- default:break;
- }
- switch(temp)
- {
- case 0x7D: //1 计时器1 SW1
- KeySwitch(0); //按键判断
- break;
- case 0x3F: //2 计时器3 SW3
- KeySwitch(2); //按键判断
- break;
- case 0xF5: //3 计时器5 SW5
- KeySwitch(4); //按键判断
- break;
- case 0xFC: //4 温控设置键 SW13
- break;
- case 0xCF: //5 温度增加 SW12
- break;
- case 0x7B: //6 计时器2 SW2
- KeySwitch(1); //按键判断
- break;
- case 0x6F: //7 计时器4 SW4
- KeySwitch(3); //按键判断
- break;
- case 0xF3: //8 计时器6 SW6
- KeySwitch(5); //按键判断
- break;
- case 0xFA: //9 除冰 SW14
- break;
- case 0xBE: //10 温度减少 SW15
- break;
- case 0xB7: //11 TIME SW7
- timer++;
- if((timer==1)&&(ONOFF==0)) //设置时间显示模式
- {
- state=2;
- }
- if((timer==1)&&(ONOFF==1)) //设置时间界面End
- {
- DigdotClose();
- state=3;
- }
- if(timer==2) //关闭显示
- {
- if(state==3)
- {
- NumExchange(Hset,Mset,H,M);
- }
- state=0;
- timer =0;
- }
- break;
- case 0xE7: //12 REMINDER SW8
- alarm++;
- DigdotClose();
- BlinkClose();
- SetTimerClose();
- setHM=0;
- if(alarm==1)
- {
- state=5;
- }
- if(alarm==2)
- {
- NumExchange(Halarm1,Malarm1,H,M);
- }
- if(alarm==3)
- {
- NumExchange(Halarm2,Malarm2,H,M);
- }
- if(alarm==4)
- {
- NumExchange(Halarm3,Malarm3,H,M);
- alarm=0;
- state=0;
- }
- break;
- case 0xDD: //13 ON/OFF SW9
- state1=(state1?0:1);
- ONOFF++;
- state++;
- if(ONOFF==1)
- {
- state=1;
- }
- if(ONOFF==2)
- {
- state=0;
- ONOFF=0;
- }
- break;
- case 0xDB: //14 INCREASE SW
- increase++;
- switch(alarm)
- {
- case 1: adjustAlarm(Halarm1, Malarm1, Blink, SetTimer, 1); break;
- case 2: adjustAlarm(Halarm2, Malarm2, Blink, SetTimer, 1); break;
- case 3: adjustAlarm(Halarm3, Malarm3, Blink, SetTimer, 1); break;
- default: adjustAlarm(H, M, Blink, SetTimer, 1); break;
- }
- break;
- case 0x9F: //15 DECREASE SW11
- decrease++;
- switch(alarm)
- {
- case 1: adjustAlarm(Halarm1, Malarm1, Blink, SetTimer, -1); break;
- case 2: adjustAlarm(Halarm2, Malarm2, Blink, SetTimer, -1); break;
- case 3: adjustAlarm(Halarm3, Malarm3, Blink, SetTimer, -1); break;
- default: adjustAlarm(H, M, Blink, SetTimer, -1); break;
- }
- break;
- default:break;
- }
复制代码 |