/* LED.c: Shows how to use the DelayMs function to switch the LED ON or OFF. Compiler: BC++ 3.1, Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) MSC 6.0, MSVC 1.52. Compile mode: Large Project: LED.c ..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XL.Lib or 7188EL.Lib) Hordware: 7188E Detail description: Function used: TimerOpen --> begin to use 7188E timer TimerClose --> stop to use timer DelayMs --> delay time interval. unit is ms Press 'q' to quit program. [07/Dec/2006] by Liam [July,13,2011] by Nicholas */ #include #include "..\..\lib\7188e.h" void main(void) { int LedMode=0; unsigned long value; int quit=0; Print("\n\rTest DelayMs() ..."); Print("\n\rNow LED must flash once every second"); Print("\n\rPress 'q' to quit\n\r"); LedOff(); while(!quit) { if(Kbhit()) { switch(Getch()) { case 'q': quit=1; break; } } Delay(500); if(LedMode) { LedMode=0; LedOff(); } else { LedMode=1; LedOn(); } } LedOn(); }