Table Of Contents

Configuring a Time-Based Measurement in NI-DAQmx

Last Modified: November 16, 2017

To configure a measurement, you specify the expected range of the input signal. Based on this range, NI-DAQmx automatically picks the internal timebase that provides the highest resolution for your measurement and uses it as the counter timebase. You also can explicitly specify the source of the counter timebase by setting the Counter Timebase Source attribute/property and the rate of the timebase by setting the Counter Timebase Rate attribute/property. For more information on where to connect input signals, refer to Connecting Counter Signals.

For non-buffered time-based measurements, calling the Read function/VI initiates the measurement and returns the next valid sample. Calling the Read function/VI repeatedly does not return consecutive measurements of the input signal.

To perform buffered time-based measurements, you must use Implicit or Sample Clock timing, configured using the DAQmx Timing function/VI.

Implicit Timing

After the acquisition begins, NI-DAQmx measures each consecutive sample of the input signal and stores the measurement in the input buffer. Due to this consecutive measurement, the rate of the input signal implicitly determines the rate of the acquisition.

Sample Clock Timing

Some devices support Sample Clock timing for buffered time-based measurements. After the acquisition begins, your device measures each consecutive sample of the input signal, but does not store it to the input buffer until an active edge of the Sample Clock occurs. Using this timing type, the Sample Clock rate determines the acquisition rate rather than the input signal. When using Sample Clock timing, all measurements returned are a valid, complete cycle of your input signal. Using this method, you can measure signals that are much faster than your sample rate, which minimizes the amount of data transferred from your device to NI-DAQmx.

Averaging

For frequency and period measurements using Sample Clock timing, some devices can return an averaged measurement of all periods since the previous Sample Clock pulse, instead of measuring only the period immediately preceding the current Sample Clock pulse. Use the EnableAveraging DAQmx Channel property/attribute, associated with each of those measurement types, to enable averaging.

Invalid Initial Samples

Depending on the phase of the input signal in relation to the start of the measurement, the first sample of a buffered measurement is often invalid. For instance, if you are performing a buffered period measurement, and you start the measurement when the input signal is halfway through its current cycle, the measured period for the first sample is half its expected value. Subsequent samples indicate the correct values because they are guaranteed to be taken after a full period of the input signal. For this reason, the first sample of buffered period, pulse width, and semi-period measurements often indicates a smaller value than the actual value. For buffered frequency measurements, the first sample often indicates a higher frequency than the actual frequency. Some devices detect these incomplete samples and discard them.

Pulse Measurement

Some devices support measuring individual pulses, returning each sample as a tuple of frequency/duty cycle, high/low time, or high/low ticks.


Recently Viewed Topics