Choosing a Counter Frequency Measurement Method

Updated Aug 10, 2018

Reported In

Driver

  • NI-DAQmx

Issue Details

I have noticed there are several methods to perform frequency or period measurements using counters. How can I determine which counter frequency measurement methods exist, which method should I use for a given input frequency and what is the accuracy of a given measurement?

Solution

There are five methods to perform frequency or period measurements: 
  • Low Frequency with 1 Counter
Measures one period of the input signal using a known timebase. The frequency of the signal is the inverse of its period.

Low frequency with 1 counter is a good method for many applications. It has the lowest measurement time but also the lowest accuracy, which further decreases as the signal frequency increases.
  • High Frequency with 2 Counters
With the two counter, high frequency method, the second counter provides a known measurement time. The counter counts the number of periods of the input signal that occur during the measurement time, averages the results, and returns the averaged value in the Read function/VI.

This method is accurate for high frequency signals. However, the accuracy decreases as the frequency of the signal to measure decreases.
  • Large Frequency Range with 2 Counters
The two counter, larger range measurement is the same as a one counter measurement, but now the user has an integer divide down of the signal. The second counter uses the input signal to create pulse that is measured with a known timebase. Results are an average of the divisor set in the VI.

This method measures high and low frequency signals accurately. However, it requires two counters and it has a variable sample time and variable error % dependent on the input signal.
  • Sample Clocked
For each sample clock period, an embedded counter counts the signal to measure and the primary counter counts a known frequency timebase. The results can either be a single frequency measurement per sample clock or an average between sample clocks. This method is only supported by CompactDAQ, X Series, USB-powered M Series, NI 6612/6614 and NI 6738/6739 devices. Refer to Sample Clock Timing Support for Time-Based Measurements for more information.

This method uses only one counter and is good for high and low frequencies and synchronizing with other measurements. Unlike all other methods, the measurement time and error do not change with the input signal frequency.
  • Dynamic Averaging
This method automatically configures the counter settings based on the range of frequencies to be measured before the start of an acquisition. During the acquisition, the counter dynamically adjusts the number of periods that are averaged to balance measurement accuracy and latency. Only the NI 9361 C Series Counter Input Modules supports this method, and it is the only method supported by the module.

Dynamic Averaging provides the best tradeoff when it comes to accuracy versus latency for a quickly changing signal. 

Additional Information

The best method depends on several factors including the expected frequency of the signal to measure, the desired accuracy, how many counters are available, how long the measurement can take and even, whether the device supports a specific measurement method. 

You need to first eliminate any options that are not compatible with your hardware and if you have enough counters for your application, you simply need to calculate the error for the expected frequency for each available option, considering the measurement time (if applicable). The best method will be the one with the lowest error at a given frequency and measurement time (if applicable). 

The Quantization Error topic from the NI-DAQmx Help shows the error at different input frequencies for the Low Frequency with 1 Counter, High Frequency with 2 Counters, Large Frequency Range with 2 Counters and Dynamic Averaging methods for a quick comparison. If you need a more accurate error calculation, you can use the formulas included in the help topic or refer to the User Manual from your device for further information. 

Note: The Sample Clocked method is not included in the Quantization Error topic because it does not depend on the input frequency. If you need to compare a Sample Clocked Counter Frequency measurement with any other method, refer to the User Manual from your device to calculate the Sample Clocked method error.

WAS THIS ARTICLE HELPFUL?

Not Helpful