LabVIEW Waveform Time Output Is Longer Than Input to NI DAQmx Write Function

Updated Oct 15, 2021

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

I made a LabVIEW VI that generates a 8 second long waveform data, and then outputs the waveform data from a DAQ analog output channel. 

But when I output this as an analog output using DAQmx Write function, the signal output duration is different to the waveform data. 
In my case, the output duration was quicker, at 7.5 seconds. The whole waveform is output, and by analyzing the signal, it is evident that the sampling rate is faster than which is causing this unexpected behavior. 
 
What am I doing wrong in my VI that is causing my waveform data to output at a different sampling rate?
 

Solution

There are several possible reasons why the sampling rate of the output may differ from the waveform signal in the programming environment.
A good starting point will be to first check if the sampling rate specified with the DAQmx Timing function matches that of the "dt" attribute of the waveform signal. 

In LabVIEW, a simple solution will be to set the DAQmx Timing to "use waveform" (picture below).
(The DAQmx Timing function can be set to "use waveform" via the dropdown menu found below the icon)
By doing so, the "dt" component of the waveform data will be respected for the output sampling rate, thus the output signal will be as intended.

image.png

 

Additional Information

As a side note, you can also use the DAQmx Timing property node to check the sampling clock rate to confirm the settings. 
image.png