/* *LedData (defined in iview.h)determines the which LEDs will be on, which will be off. while *LedData=0, all LEDs light up, while *LedData=ff, all LEDs are off. LED_F1,LED_F2... are positions to indivual.(defined in iview.h.) */ #include #include int main() { int quit=0; int key; //all led light up InitLib(); InitLCD(); *LedData=0; outp(LED_PORT,*LedData); DelayMs(2000); //all led vanish *LedData=255; outp(LED_PORT,*LedData); while(!quit) { if(Kbhit()) { key=Getch(); switch(key) { case '1': *LedData = (LED_RUN|LED_SHIFT|LED_F2|LED_F3|LED_F4); //F2/3/4 vanish *LedData &= ~(LED_F1|LED_PWR); //F1 light up outp(LED_PORT,*LedData); Print("Key 1 pressed"); break; case '2': *LedData = (LED_SHIFT|LED_PWR|LED_F1|LED_F3|LED_F4); //F2/3/4 vanish *LedData &= ~(LED_F2|LED_RUN); //F1 light up outp(LED_PORT,*LedData); Print("Key 2 pressed"); break; case '3': *LedData = (LED_RUN|LED_PWR|LED_F2|LED_F1|LED_F4); //F2/3/4 vanish *LedData &= ~(LED_F3|LED_SHIFT); //F1 light up outp(LED_PORT,*LedData); Print("Key 3 pressed"); break; case '4': *LedData = (LED_RUN|LED_SHIFT|LED_PWR|LED_F2|LED_F3|LED_F1); //F2/3/4 vanish *LedData &= ~(LED_F4); //F1 light up outp(LED_PORT,*LedData); Print("Key 4 pressed"); break; default:quit=1;break; } } } CloseLCD(); return 0; }