Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Suspend DAQmx task while another task is running?

I have an application where I want to continuously obtain data from 4 DAQ channels at a certain rate (probably 200 Hz). Lets say that's Task 1. At specified intervals (usually 1 sec) I want to obtain data from two other channels for about 5 msec at a 10 KHz sample rate (Task 2). I know I can't do both tasks at the same time and I'd rather not get another board for the second task. I think we can live with an interruption in the Task 1 in order to do Task 2. What's the best way to suspend Task 1 so that Task 2 can happen? I think I can see how Task 2 could trigger Task 1 to start when Task 2 is finished, but I'm not sure how to tell Task 1 to stop when it's time for Task 2 to run.
 
George
0 Kudos
Message 1 of 4
(3,272 Views)
In your case, what is the event that decides Taks 1 should stop and task 2 should run??
0 Kudos
Message 2 of 4
(3,261 Views)
Hi George -

You can control the state transitions of a Task using the DAQmx Control Task VI.  This lets you manually change the state the driver is in without having to fully traverse the state model (as would be required if you used a combination of Start/Stop VIs).  You can learn more about the DAQmx Task State Model in the NI-DAQmx Help file.  The file is in the Start menu, under "Programs » National Instruments » NI-DAQ".  Inside the file, the book is located at "NI-DAQmx Key Concepts » Channels and Tasks » Tasks » Task State Model".

Unfortunately, this is the only way to control which Task is active, and it's a software-timed operation.  So you'll be restricted to the jitter of your operating system and its task scheduler.  In Windows, this gives you about 10 ms resolution, which means that you could have no idea whether your 5-ms acquisition starts at the right time.  You can play around with the feature, thoug.  It could work for your application.
David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 3 of 4
(3,250 Views)
>>In your case, what is the event that decides Task 1 should stop and Task 2 should run?? <<
 
Task 2 is in a timed loop. When that loop activates I want Task 2 to run. If Task 1 is busy at the time I can wait until it finishes before Task 2 starts.
 
George
0 Kudos
Message 4 of 4
(3,235 Views)