/* TimeTick.c : to demonstrate how to use *TimeTicks 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: TimeTick.c ..\..\Lib\(8000E.Lib,7188XAL.Lib,7188XBL.Lib,7188XCL.Lib or 7188EL.Lib) Hardware: 7188/8000 Detail description: GetTimeTicks() is a global variable for system timeticks the usage of GetTimeTicks() is the same as GetTickCount() function of windows function. [1 Jun,2006] by martin */ #include "..\..\lib\P821.h" void Message(void); void INC(void); unsigned long loopCnt=0; unsigned long tickCnt; int ControlFlag=0; void main() { long i,val; InitLib(); tickCnt=GetTimeTicks(); // begin timer count for(i=0;i<100000;i++) // do something { loopCnt++; } Print("loopCnt++ 100000 times need:%lu ms \n\r",GetTimeTicks()-tickCnt); // calcutlate the time for(;;) // example for using TimeTick as loop control { if(ControlFlag==0) { tickCnt=GetTimeTicks(); loopCnt++; ControlFlag=1; } else { if(GetTimeTicks()-tickCnt>=2000) { Print("LoopCnt:%lu\n\r",loopCnt); ControlFlag=0; } } } } void INC(void) { loopCnt++; } void Message(void) { Print("LoopCnt:%lu\n\r",loopCnt); }