Section 4. Sensor Support
43
Note: The PulseCount () instruction should not be used in a conditional
statement or subroutine. To ensure all pulses are detected, it must be executed
each scan.
Execution of PulseCount () within a scan involves determining the accumulated
counts in each dedicated 16-bit counter since execution of the last PulseCount
(). PulseCount () parameter (POption) determines if the output is in counts
(POption = 0) or frequency (POption = 1). Counts are the preferred output
option for measuring number of tips from a tipping bucket rain gage, or the
number of times a door opens. Many pulse sensors, such as anemometers and
flow meters, are calibrated in terms of frequency (Hz or counts / second), and
are usually measured with the frequency option.
Resolution of the pulse counters is one count. Resolution of frequency is
(1/scan interval). For example, the frequency resolution of PulseCount()
returning a result every 1 second is 1 Hz. The resultant measurement will
bounce around by the resolution. For example, if you are scanning a 2.5 Hz
input once a second, in some intervals there will be 2 counts and in some 3. If
the pulse measurement is averaged, the correct value will be the result.
Accuracy is limited by a small scan interval error of ±(3 ppm of scan interval +
10 µs) plus the measurement resolution error of ± 1 Hz. The sum is essentially ±
1 Hz. Extending a 1 second measurement interval to 10 seconds, either by
increasing the scan interval or by averaging, improves the resulting frequency
resolution from 1 Hz to 0.1 Hz. Averaging can be accomplished by the Average
() instruction or by computing a running or spatial average through
programming.
4.4.1 Pulse input Channels
Read More! Review pulse counter specifications p. 35. Review pulse counter
programming in CRBASIC Help for the PulseCount () instruction.