Best Practices for Stopping a DAQmx Task Mid Write or Read

Updated Jan 3, 2019

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

Are there best practices for stopping a DAQmx task in the middle of a write or read? I'd like to be able to stop it in case of an error, or if an operator presses the stop button. 

Solution

There are a few different recommendations for stopping a DAQmx task in the middle of a write or a read:
  • In DAQmx reads or writes that are in a while loop, use an Unbundle by Name function to get the status of the error, and wire that to an Or operation with a boolean stop control. An example of this is shown below:
  • For finite tasks, make use of the Is Task Done VI in a while loop to poll the task, and use the same boolean control and error status to stop mid-task if need be.