Configuring a Time Measurement in NI-DAQmx
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.
To perform buffered time measurements, use the Timing function/VI with the Implicit timing type. After the acquisition begins, NI-DAQmx consecutively measures each sample of the input signal and stores it in the input buffer. Due to this consecutive measurement, the rate of the input signal implicitly determines the rate of the acquisition. Depending on the phase of the input signal in relation to the start of the measurement, the first sample of buffered measurements 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.With bus-powered M Series USB devices, such as the NI 6210, NI 6211, NI 6212, NI 6215, NI 6216, and NI 6218, you can take buffered time measurements with the sample clock timing type. After the acquisition begins, your device consecutively measures each sample of the input signal but does not store it to the input buffer unless there is an active edge of the sample clock source signal. Using this timing type, the sample clock rate determines the acquisition rate rather than the input signal. With this buffered time measurement method, 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.
For non-buffered time 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.