1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| #include "STC15F2K60S2.H" #include "sys.H" #include "displayer.H" #include "key.H" #include "beep.H"
code unsigned long SysClock=11059200; #ifdef _displayer_H_ code char decode_table[]={ 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x00, 0x08, 0x40, 0x01, 0x41, 0x48, 0x3f|0x80, 0x06|0x80, 0x5b|0x80, 0x4f|0x80, 0x66|0x80, 0x6d|0x80, 0x7d|0x80, 0x07|0x80, 0x7f|0x80, 0x6f|0x80 }; #endif
char a;
void myKey_callback() { char k; SetBeep(1000,10); k=GetKeyAct(enumKey1); if( k == enumKeyPress ) a |=0x01; else if( k == enumKeyRelease ) a &=~0x01; k=GetKeyAct(enumKey2); if( k == enumKeyPress ) a |=0x02; else if( k == enumKeyRelease ) a &=~0x02; k=GetKeyAct(enumKey3); if( k == enumKeyPress ) a |=0x04; else if( k == enumKeyRelease ) a &=~0x04; }
void my10mS_callback() { LedPrint(a); }
void main() { DisplayerInit(); KeyInit(); BeepInit(); SetDisplayerArea(0,7); Seg7Print(1,2,3,4,5,6,7,8); SetEventCallBack(enumEventSys10mS, my10mS_callback); SetEventCallBack(enumEventKey, myKey_callback); MySTC_Init(); while(1) { MySTC_OS(); } }
|