How Can I Control Which DAQmx Task Is Running?

Updated Jan 11, 2023

Reported In

Software

  • LabVIEW 2010 Base

Driver

  • NI-DAQmx

Issue Details

I have an application where I would like to continuously obtain data from 2 or more Data Acquisition (DAQ) channels with each channel at different sampling rate. To acquire each channel at a different rate, I know I need to put each channel in a separate task. How can I switch between the tasks to gather data on each of my channels? 

For example, let's say I have two tasks: Task 1 reading data during 1 second at 20 kHz and Task 2 reading data during 0.5 second at 10 kHz. How can I manage to start Task 2 when Task 1 is finished?

Solution

You can start and stop to move between two tasks quickly by taking advantage of the DAQmx Control Task VI's ability to circumvent a few states in the DAQmx Task State Model . This lets you manually switch the driver state without having to fully traverse the Task State Model as would be required when using only the Start/Stop Task VIs.

 

Additional Information

 
The example below uses the unreserve input for the DAQmx Control Task VI, which then sends the specified task back to the verified state of the Task State Model. This frees up the necessary DAQmx resources to run the other task, which can be set at a different sample rate or duration if desired.