
Chapter 9 | Counters |
Figure
| Counter |
|
|
|
|
|
| ||
Sample Clock | Armed |
|
|
|
|
|
| ||
|
|
|
|
|
|
|
|
| |
(Sample on |
|
|
|
|
|
|
|
|
|
Rising Edge) |
|
|
|
|
|
|
|
|
|
SOURCE |
|
|
|
|
|
|
|
|
|
Counter Value | 0 1 2 1 | 2 3 1 2 | 3 | 1 | |||||
|
|
|
|
|
|
|
|
|
|
|
| 2 | 2 |
| 2 | ||||
Buffer |
|
|
|
| 3 |
|
| 3 |
|
|
|
|
|
| 3 | ||||
|
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
|
|
Figure
Notice that the first count interval begins when the counter is armed, which occurs before the first active edge on Gate.
Note that if you are using an external signal as the Source, at least one Source pulse should occur between each active edge of the Gate signal. This condition ensures that correct values are returned by the counter. If this condition is not met, consider using duplicate count prevention, described in the Duplicate Count Prevention section.
Controlling the Direction of Counting
In edge counting applications, the counter can count up or down. You can configure the counter to do the following:
•Always count up
•Always count down
•Count up when the Counter n B input is high; count down when it is low
For information about connecting counter signals, refer to the Default
Counter/Timer Pinouts section.
ni.com |