00001 00006 #include "net\tick.h" 00007 00008 void main(void) { 00009 00010 //The default tick period is 10ms 00011 TICK8 t8Bit = 0; //Has 8 Bits, range of 0 - 255 = 255 x 10ms = 2.55 seconds 00012 00013 //Infinite loop 00014 while(1) 00015 00016 //Use 8 bit tick, execute every half a second 00017 //This method uses a 8 bit tick, which produces small and fast 00018 //code, but only has a range of 0 - 2.55 seconds. It has a resolution of 10ms. 00019 if ( TickGetDiff8bit(t8Bit) >= ((TICK8)TICKS_PER_SECOND / (TICK8)2) ) 00020 { 00021 t8Bit = TickGet8bit(); 00022 00023 //Add uses code here. This code is executed every half a second 00024 ... 00025 } 00026 } 00027 }
1.5.2