/* 1. Compiler: TC 2.0 2. Mode: Large 3. Project: Hello2.prj Hello2.c ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: To press any key from keyboard to contral the led. 5. Hordware: 8831 It's compiled by Tony ----------------------------------------------------------------------------------- */ #include #include #include #include #include #include"..\LIB\8000.h" #include"..\LIB\vxcomm.h" /*-----------------------------------------------------------------------------------*/ main(void) { int type; int ver; type=Is8000(); /*detect the current operation system*/ if(type) { ver=GetLibVersion(); Print("Hello 8831! (Flash memory is %d K)\n\r",type); Print("Library version is %d.%02d",ver>>8,ver&0xff); } else { Print("Hello PC!, this program is not run under 8831."); return; } Init5DigitLed(); Set5DigitLedIntensity(3); Print("Now all led off(except the power LED)\n\r"); Print("Press any key to Show 5DigitLed(12345)\n\r"); Getch(); Show5DigitLed(1,1); Show5DigitLed(2,2); Show5DigitLed(3,3); Show5DigitLed(4,4); Show5DigitLed(5,5); Print("Press any key to Show 5DigitLed(5.4.3.2.1)\n\r"); Getch(); Show5DigitLedWithDot(1,5); Show5DigitLedWithDot(2,4); Show5DigitLedWithDot(3,3); Show5DigitLedWithDot(4,2); Show5DigitLedWithDot(5,1); Print("Press any key for 'L3 ON'\n\r"); Getch(); SetLedL3(LED_ON); Print("Press any key to 'L2 ON'\n\r"); Getch(); SetLedL2(LED_ON); Print("Press any key to 'L1 ON'\n\r"); Getch(); SetLedL1(LED_ON); Print("Press any key to 'L3 OFF'\n\r"); Getch(); SetLedL3(LED_OFF); Print("Press any key to 'L2 OFF'\n\r"); Getch(); SetLedL2(LED_OFF); Print("Press any key to 'L1 OFF'\n\r"); Getch(); SetLedL1(LED_OFF); Print("Press 'q' to quit, other key to toggle L1/L2/L3\n\r"); while(Getch() !='q'){ SetLedL1(LED_TOGGLE); SetLedL2(LED_TOGGLE); SetLedL3(LED_TOGGLE); } }