DAQmx Data Behavior if Task is Stopped Before Completion

Updated Dec 7, 2017

Reported In

Driver

  • NI-DAQmx

Issue Details

I stopped my DAQmx task using DAQmx Stop Task before the acquisition had enough time to finish.  If there are still samples on the buffer when I call DAQmx Stop Task, what happens to those samples?  Does the task run to completion?  Are the samples still available in the read buffer? 

Solution

The task will stop even if the desired number of samples was not reached, and the samples will be left on the buffer if they are not read yet.  However, they are available to be read after you stop the task.

You are able to see how many samples are in the buffer after the Stop Task function occurs via the Available Samples Per Channel DAQmx Read property node.  

Continue DAQmx Read to recover the samples that would have otherwise been lost from the buffer. 

Additional Information

This question may come up while doing the following example acquisition:  I start a DAQmx task to collect 10,000 samples at a 1KHz sampling rate, which I expect to take 10 seconds. I then call a DAQmx Stop around the 9 second mark.  

WAS THIS ARTICLE HELPFUL?

Not Helpful