Specifications
Event Multitasking - 3
Each counter may be assigned through software to any digital I/O line on any Control or expansion card. Once
configured, counting is done independently in the background. The counters have the following features:
1. The count rate may range from 0 to 80 Hz.
2. The counters may be read at any time with the COUNT function. This function is
synchronized with the counter so that valid data is always read.
3. You can program the counter so that the program branches to a subroutine when it reaches a
preset amount using the ON COUNT statement.
4. You can also create a module n counter by having the counter automatically reset when it
reaches a preset count, using the CONFIG COUNT statement.
5. The counters are 16–bit and can accumulate up to 65,535 counts.
6. You can stop and zero the counters individually or in groups with the CLEAR COUNT
statement.
7. You can start the counting individually or in groups with the START COUNT statement.
8. You can suspend counter operation while maintaining the count with the STOP COUNT
statement.
9. You can restart the counters without resetting the count using the RESUME COUNT
statement.
How Counting is Done
A specified input line is sampled 200 times (100 times in 9 Mhz systems) per second. As shown in Figure 1, when the
software detects that the input changes from a high logic state to a low logic state, the counter is incremented.
Count
input
Sample
Counter
Increment
Figure 1
Theoretically, a 100 Hz square wave can be counted. However, due to sample timing variations (dependent upon other
multitasking events), the maximum square wave frequency rate should be 80 Hz. To obtain the full frequency response, the
minimum time the signal is low or high is 8 mS. The software is written to reject high frequency noise.
Defining a Counter
Setting up a counter is done with the CONFIG COUNT statement. The syntax is: