Differences between the DAQmx Stop Task and Clear Task VIs

Updated Apr 24, 2023

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Issue Details

What is the difference between the DAQmx Stop Task and Clear Task VIs? When would it be appropriate to use each one? 

Solution

The DAQmx Stop Task VI and DAQmx Clear Task VI are both used to end tasks in data acquisition programming.
The main difference is how these VIs act with allocated resources.
  • Stop Task VI , simply stops the task and does not release the resources. You can start the task again without recreating it.
DAQmx Stop Task
Figure 1. DAQmx Stop Task (VI)
 
  • Clear Task VI, stops the task and clears it. Before clearing the task it releases any resources the task reserved. You have to recreate the task before you are able to use it again. Refer to the Creation and Destruction of Tasks in NI-DAQmx article for more information about when to use this VI. 
DAQmx Clear Task
Figure 2. DAQmx Clear Task (VI)

Additional Information

If you plan on performing the same acquisition multiple times in your program, calling the DAQmx Clear Task VI would be inefficient and will dramatically lower the speed compared to the DAQmx Stop Task VI. With the same physical and timing parameters, starting and stopping the same task over and over is the preferred method for efficiency.