Measurements Using Two Counters
You can measure digital frequency or the period of a TTL signal using two counters. Two methods are the high-frequency measurement method and the large range measurement method.
High-Frequency Measurement Method
If you measure the digital frequency or the period of a TTL signal with higher frequency, you can use the high-frequency method. To perform measurements using this method, NI-DAQmx uses the paired counter to generate a pulse train with a period specified using the measurement time attribute/property. The measurement time is generally much larger than the period of the input signal being measured to reduce quantization error. However, the measurement time must be small enough to keep the counter from rolling over. The measurement 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. The value returned is calculated as follows:
Period (in seconds) = Measurement Time / Number of Periods Counted
Frequency (in Hertz) = Number of Periods Counted / Measurement Time
Tip As you increase time, the accuracy of the reading also increases. However, if you specify too large a time, the counter may roll over, leading to an inaccurate frequency or period measurement. |
Large Range Measurement Method
If you measure the digital frequency or the period of a TTL signal, you can use this two-counter method to measure signals with large ranges. This method is useful when you have a widely varying signal to measure and would like increased accuracy throughout the entire range. Refer to the quantization error section for more information on increasing measurement accuracy with the large-range measurement method. You can also use this method to measure signal frequencies that are faster than your counter timebase rate as long as the input signal does not exceed the maximum input frequency supported by the counter.
To perform measurements using this method, NI-DAQmx uses the paired counter to divide the input signal by a value specified by Divisor. However, you need to be careful the Divisor you choose does not cause the counter to roll over. This Divisor has the effect of shifting the measurable frequency range upward. For example, if you are using a 24-bit counter and your Counter Timebase Rate is 100 kHz, the measurable frequency range is approximately 0.006 Hz to 50 kHz. However, with a Divisor of 4, the measurable frequency range becomes 0.024 Hz to 200 kHz. The divided input signal is then measured using the low frequency one counter measurement method. The measured period is then scaled using the Divisor, and returned according to the following formula:
Period = Measured Period / Divisor
Frequency = Divisor / Measured Period
Tip As you increase the divisor, the accuracy of the reading also increases. However, if you specify too large a divisor, the counter may roll over, leading to an inaccurate frequency or period measurement. |