In hardware there are devices called precision interval
generators or precision interval timers, PIGs and PITs. One
of their functions that is often used to time out real time
events is a downcounter. A downcounter tells you when a pre
-set time interval has elapsed.
Here is a turbo pascal 5.0 unit called "lilpit" that has
software PITs. There are two sets, one with one-second
resolution and one with about 50 millisecond resolution. The
trade off for resolution is execution time. The one_second
flavor runs about 3 times faster than the millisecond kind.
The software is simple to interface. You have to "preset or
START the timer with a call specifying how long you want it to
run. After that, you "poll" or TEST the timer to see if it has
expired. There are some examples in the source code at the top
of pascal source module LILPIT.PAS. Take a look at them.
Lastly, there are some bells and whistles. There is a global
debugging flag named "LILPIT_FATAL_ERROR" that catches some
programmer or system slips. There is a very fast time/date
string conversion function named "AT_TOD" and there is a
simplistic timer number allocate/deallocate scheme named
"get_a_timer_number" and "unget_a_timer_number." Lastly, there
is an initialization/error recovery entry point called
"reset_pit."
Enjoy and Merry Christmas.
WOBURN SOFTWARE ASSOCIATES
6 Lawson Street
Woburn MA 01801-3718
|