/* 1. Compiler: TC 2.0 2. Mode: Large 3. Project: Key_led.prj Key_led.c ..\lib\8000l.lib ..\lib\tcpipl.lib 4. Explain: To contral the led of 8133 by button of 8133. * Press 'q' or to quit this program. 5. Hordware: 8831 It's compiled by Tony ----------------------------------------------------------------------------------- */ #include #include #include #include #include #include"..\LIB\8000.h" #include"..\LIB\vxcomm.h" /*------------------------------------------------------------------------------------*/ int IsSystemKey(void); int GetSystemKey(void); void ClearSystemKey(void); void main(void) { int data; int key; int type; int ver; int quit=0; 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 I-8831."); return; } Print("\r\nTest sys key for led..."); Print("\r\nPress 'q' to quit program..."); ClearSystemKey(); while(!quit){ if(IsSystemKey()){ switch(GetSystemKey()){ case SKEY_MODE: SetLedL1(2); break; case SKEY_UP: SetLedL2(2); break; case SKEY_DOWN: SetLedL3(2); break; } } if(Kbhit()){ data=Getch(); if(data=='q' || data=='Q') return; else { Putch(data); if(data=='\r') Putch('\n'); } } } }