"justify">} _key=NOT_DEFINE; (key & KEY_MODE == KEY_MODE)
{_key=KEY_MODE;
} / / ST1
{(key & KEY_UP == KEY_UP)
{_key=KEY_UP;
} goto ST2;
}: (bounce_tmr == BOUNCE_TIME) / / ST2
{(cur_key == NOT_DEFINE)
{_tmr=0; _key=NOT_DEFINE;
} goto exitKS;
} / / ST3
{(cur_key == NOT_DEFINE) / / RESET_TMR
{_tmr=0; _key=NOT_DEFINE;
} / / ST4
{(cur_key!=prev_key) / / OTHER_KEY
{_tmr=0; _key=cur_key;
}
{_tmr + +;
} (bounce_tmr == BOUNCE_TIME) / / ST5
{= cur_key;
} goto exitKS;
}
}: {}
} Timer ()
{(mode!=0)
{goto ExitTmr;} / / Tmr1
{(sec_L!=0) {sec_L -; goto ExitTmr;} / / Tmr2
{(sec_H!=0) {sec_H -; sec_L=9; goto ExitTmr;} / / Tmr3
{(min_L + min_H + hour_L + hour_H == 0) {goto StopT;} / / / Tmr4
{_L=9; (min_L!=0) {min_L -; sec_H=5; goto ExitTmr;}
{(min_H + hour_L + hour_H == 0) {goto StopT;} / / Tmr5
{_H=5; (min_H!=0)
{_H -; _L=9; ExitTmr;
}
{(hour_L + hour_H == 0) {goto StopT;} / / Tmr6
{_L=9; (hour_L!=0)
{_L -; _H=5; ExitTmr;
}
{(hour_H == 0) {goto StopT;} / / Tmr7
{_H=5; _H -; _L=9; ExitTmr;
}
}
}
}
}
}
}
}
}
}: / / час таймера минув (ct_beep == 0)
{_beep=6; DIR |=0x08; OUT |=0x00;
} {}
if (SW_Load == 0) / / включення зовнішнього навантаження
{DIR |=Power_On; OUT |=0x00;
} / / відключення зовнішнього навантаження
{DIR |=Power_On;
P1OUT |=Power_On;
}: {}
} Beep ()
{(ct_beep)
{0: break; 0x0FF: break;// Bp11: {ct_beep=0x0FF; P1DIR |=0x08; P1OUT |=0x08;} break;// Bp2: ct_beep -;// Bp3
}
} init_spi (void) {DIR |=0x72;// P1 output |=USIPE6 + USIPE5 + USIMST + USIOE;// Port, SPI Master &=~ USISWRST;// USI released for operation |=USI16B; |=USISSEL_2; OUT |=(REG_SHCP) | (REG_STCP) | (REG_DS);;
} send_data (char data1, char data2) {OUT &=~ REG_STCP;=data1;=data2;=16; (USICNT!=0); OUT |=REG_STCP;;
} Display ()
{_num + +; (cur_num> 5)
{_num=0;
} (cur_num) / / Dis2
...