Event Counters
Found on many Data Acquisition devices, Event Counters count the number of times a digital signal changes state. A simple example of a digital signal is where one state is below 0.8 volts (Low) and the other is above 2.0 volts (High). When the state changes from Low to High the Event Counter adds one (+1) to its count. Event Counter inputs generally have a high input count rate some as high as 20MHz or more.
How do they work?
The Event Counter has a clock input and a gating mechanism. The gating mechanism determine when and when not to count – like an on/off switch. Depending on the mode of operation, the clock source can be the input to the counter or an on device frequency source (clock).
The Event Counter counts transitions of the clock source and the gating mechanism is simply an enable switch telling it to either count or ignore the signal. Upon initialization, the count is set to zero counts and increments plus one on each clock transition. In the simplest form it counts and can be reset to zero. Some Event Counters allow pre setting values with countdown functions. Like the internal clock, this feature is device dependant.
Can I use it to measure frequency?
To measure frequency, the Event Counter must be read at a regular interval. Knowing the interval and the difference in counts from read to read, the frequency can be found. If, reading the Event Counter once per second (the interval) the counts increased by 1000 each time then the frequency is 1000Hz. The math is simply inverse of the time interval times the difference in counts. The problem is performing the read on a regular or precise interval. Some devices allow for the Event Counters to be read synchronously with the Analog Inputs using on board pacer circuitry, while others do not. In case of synchronous hardware, accurate measurements can be made because the read interval is precisely controlled. If synchronous operation is unavailable then software can be used to read the counter on a regular basis but this is not as accurate. An example of this would be a software timer or event that calls a subroutine based on an elapsed time.
What else can they do?
Advanced Event Counters have dedicated internal clock circuitry separate from the analog input pacing circuitry. The clock allows for precise incrementing of the Event Counter while the input to the Event Counter functions as the gate. An example where a separate clock is needed is the case where the Event Counter is read alongside analog input channels. Here the input pacing used as the gating mechanism while the input functions as the clock signal. This works well when sample rate is low but when the sample rate is high a problem arises. The problem has to do with low frequencies and fast gating. If the analog inputs need to run at 1000Hz and the frequency signal is 100Hz, the counter would have only one count for every 10 samples. Therefore, one out of ten times the calculated frequency would be correct. For good accuracy it is best have a large number of counts per read.
If a separate time base is available as a clock, the Event Counter can count its transitions leaving the input to function as the gate control. The dedicated time base clock opens up additional features other than just frequency measurement. The advance counter can be configured to count from edge-to-edge of a pulse effectively measuring the width. This lends itself to measuring duty cycle which is the percentage of a signal's logic high to low. PWM measurements are primarily duty cycle measurements.
Further still, some devices support (quadrature) position encoders. To support encoders there has to be at least two Event Counters that have the ability to determine phase difference between the two. It does this looking at which one's count increase first. It is the phase that determines direction and counting determines position. Often one Event Counter is for position and the other for frequency to determine speed. Many encoders also have an index signal that occurs once per revolution and in this case a third Event Counter can be use to determine distance by counting the revolutions.
If the Event Counter supports the ability to trigger the device to begin sampling then it would be possible to begin data collection at a specific position. All the features discussed here are device dependant and can vary even within one manufactures product line. When purchasing a device it’s best to discuss your requirements with a Sales or Product Support engineer before purchasing.