Chapter 7Timing Techniques On Pc Compatibles

There are two groups of algorithms described here for measuring time on a PC. One is a calibrated approach which measures the execution speed of the program and calibrates this speed with a real-time clock. The other uses the PC’s real-time clock to measure time changes, and keeps track of the overall time by summing these small time measurements. Interrupts are also used to help ensure that the range of the real-time clock is not exceeded.

7.1 Calibrated Time

At a fixed point in the execution of the program, a counter is incremented. This would most likely occur at the beginning or end of an execution scan. The total count is then multiplied by a calibration constant to yield time. This constant ...

Get Control Software for Mechanical Systems: Object-Oriented Design in a Real-Time World now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.