Pulse measurement tips
The PulseCount()
instruction uses dedicated 32-bit counters to accumulate all counts over the programmed scan interval. The resolution of pulse counters is one count. Counters are read at the beginning of each scan and then cleared. Counters will overflow if accumulated counts exceed 4,294,967,296 (232), resulting in erroneous measurements. See the CRBasic Editor help for detailed instruction information and program examples:
Counts are the preferred PulseCount()
output option when measuring the number of tips from a tipping-bucket rain gage or the number of times a door opens. Many pulse-output sensors, such as anemometers and flow meters, are calibrated in terms of frequency (Hz SI unit of frequency. Cycles or pulses per second.) so are usually measured using the PulseCount()
frequency-output option.
Use the LLAC4 module to convert non-TTL Transistor-to-Transistor Logic. A serial protocol using 0 VDC and 5 VDC as logic signal levels.-level signals, including low-level AC signals, to TTL levels for input to C terminals
Understanding the signal to be measured and compatible input terminals and CRBasic instructions is helpful. See Pulse input terminals and the input types they can measure.
Input filters and signal attenuation
Terminals configured for pulse input have internal filters that reduce electronic noise. The electronic noise can result in false counts. However, input filters attenuate (reduce) the amplitude (voltage) of the signal. Attenuation is a function of the frequency of the signal. Higher-frequency signals are attenuated more. If a signal is attenuated too much, it may not pass the detection thresholds required by the pulse count circuitry.
Pulse count resolution
Longer scan intervals result in better resolution. PulseCount()
resolution is 1 pulse per scan. On a 1 second scan, the resolution is 1 pulse per second. The resolution on a 10 second scan interval is 1 pulse per 10 seconds, which is 0.1 pulses per second. The resolution on a 100 millisecond interval is 10 pulses per second.
For example, if a flow sensor outputs 4.5 pulses per second and you use a 1 second scan, one scan will have 4 pulses and the next 5 pulses. Scan to scan, the flow number will bounce back and forth. If you did a 10 second scan (or saved a total to a 10 second table), you would get 45 pulses. The total is 45 pulses for every 10 seconds. An average will correctly show 4.5 pulses per second. You wouldn't see the reading bounce on the longer time interval.