4.3 TIMING
Timing is significant in computer controlled processes. If we think of a simple example, a fixed sample period means that the computer program must arrange to read the analog value at a consistent time.
Various schemes for timing include,
trigger and scan - a special input board can be set to read one or more values when timing or triggering conditions met
Values are simply read from/written to locations in memory for both analog and digital values. When the process takes more than a single CPU cycle there will be a flag set to indicate when the operation is done. One example is reading analog values. This process may take hundreds of CPU cycles. We have three options,
There are three fundamental properties of interrupts used for timing,
Hardware - These are actual pins on the outside of the CPU. When a change occurs the CPU will save its current status, and go to a subroutine. When done the system status is restored, and the computer programs resumes where it was interrupted. The number of hardware interrupts is often severely limited, but extra hardware can be added to expand the hardware interrupts. A computer keyboard and mouse typically use hardware interrupts.
Software - These are similar to hardware interrupts, except they are started by a call in software. These are plentiful, and used in all aspects of modern operating systems. MS-Dos makes extensive use of these software interrupts.
Maskable - These interrupts can be turned off by software. When running a critical process we may not want an interrupt to occur (and stop our program temporarily).
We can set priorities for interrupts. If multiple interrupts occur at the same time the highest priority interrupt will be executed first. This allows critical processes to be addressed first.
4.3.1 Interrupts
4.3.2 Clocks and Timers
4.3.3 Watch Dog Timers
4.3.4 Polling
4.3.5 DMA