Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Stop Task doesn't seem to stop a task...

In my application I'm using a Functional Global Variable for all Task-related operations.  I create a task, then I start it, then I read from the DAQmx buffer and everything works fine.  Then I stop the task and the task doesn't seem to stop.  I first saw this problem when I tried to restart the task and I got a message saying the task was reserved.  So then I tried stopping the task and then waiting till the task was done (constantly reading the Done? boolean on the DAQmx Task property node).  The task never got done UNLESS I placed a breakpoint somewhere (probably right before the property node), stopped at the breakpoint, and continued.
 
Should I be doing something else BEFORE I stop the task (like reading all samples from the buffer)?  I thought I had somehow solved this problem a while ago, but I was mistaken.  I first saw this with a USB9215A, but I'm now seeing this with a simulated E-series DAQ.
 
Thanks!
0 Kudos
Message 1 of 3
(3,218 Views)

I found the problem.  I was doing a DAQmx Read after running the DAQmx Stop.  I was expecting the DAQmx Read to generate an exception, however it was actually reading data.  I thought this was because the task hadn't stopped.  I just realized that the DAQmx Read is RESTARTING the task!

Thanks!

0 Kudos
Message 2 of 3
(3,208 Views)
Hey 2and4,

I am glad you found a solution and thanks for posting it!
Regards,

Chris Delvizis
National Instruments
0 Kudos
Message 3 of 3
(3,188 Views)