This header file, by default, has ten timers. It can easily be expanded to up to 127 independent timers. Each timer can be set to any value, not just 0. The value can be retrieved in hours, minutes, seconds, or milliseconds. Each function returns a float variable, so you can get up to 6 decimal digits of accuracy. Each function also has the option of subtracting higher units, or “rolling over”. For instance, the Timer_Msecs(…) function can subtract any whole seconds before returning the value. This is useful for display situations, such as the included timers_demo.c, which displays the current timer value in the standard hours:minutes:seconds.milliseconds format. Extensive documentation is also included.
This header file does not use any of the built-in timers. Please consult the included documentation for further details.
The statistics below are with Release optimization enabled.
File "timers_demo.c" compiled on Jul 21 2012 21:21:38
Compile Statistics: (timers_demo.c)
0.010 Total Compile Time (seconds)
757 Total code bytes, (after 93 bytes removed during optimization)
24 Constant Pool Size (in bytes)
134 Used memory locations (of 12000), 1 Tasks, 7 Procedures
146 User Source file lines, 650 tokens
6,169 System Include file lines, 26,792 tokens
0 Errors, 0 Warnings, 0 Info Messages
CPU ......Lines/sec.....
Seconds Total Source
Scanner/parsing: Setup 0.003 2,232,950 51,624
Scanner/parsing: System 0.000 39,312,329 908,883
Scanner/parsing: User Files 0.002 3,838,470 88,743
Code Generation 0.003 2,342,731 54,162
Code Optimize 0.001 11,562,450 267,318
Total 0.010 640,903 14,817
64 Total symbols added to symbol table
1.083 Avg hash bucket depth (1.0 is best possible)
I’d like to acknowledge this thread. It was very useful in the creation of this header and I recommend it to programmers of all skill levels.
You may also be interested in my other header file: LCD.h.
timers_v1.0.zip (4.19 KB)