LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

forcefully stop daqmx read.vi in finite sample mode of clock

Hello,

 

I have a state machine which configures the daqmx  AI voltage and sample clock (onboard clk). I am using the finite sample mode and ((sample/channel) / rate ) as the formula to calcuate total time to take the values in no.of secs. in this case im trying to acquire data for 5 secs. in next state im reading the data from daqmx read.vi (analog 1d wfm N chan N samp). while in this state if i wanted to stop the program it gives me an error 200284. i guess it is still waiting that 5 secs to complete and then only goes to stop state in my state machine where i clear and stop the task. 

 

so, Is there a  way to forcefully stop the task in finite mode without having the program to wait until it gathers all data?

 

also, is it better to program this timing by using the above formula method or can i use a timed loop to get no.of secs in continuous mode?

 

Thanks in advance

0 Kudos
Message 1 of 4
(3,847 Views)

Use the "DAQmx Control Task" function (found on the functions palette under "DAQmx Advanced Task Options") to halt your acquisition when you detect the error.  Set the action to "abort".  The task will abort but will be in an unstable state.  To stabilize it, you'll need to explicitly stop it.  Then you can clear it.

 

It'll look something like this.

Diane

0 Kudos
Message 2 of 4
(3,842 Views)

problem,

 

im in one of the states in state machine while its reading. im using a stop button to go to next stop state. but the stop button is not being read since the case in which it is running is not run again until daqmx has finished the task. if it was in while loop as you sent it works. i need to abort the running daqmx in a case which is not being revisited or run like a while loop.

 

any ideas

0 Kudos
Message 3 of 4
(3,832 Views)

Sure.  Put a while loop in the case where you're running your acquisition, and use the stop button (ORed to the "IsTaskDone" output to stop the loop.

 

You do need to use a loop the way I showed, in order to make use of the "abort" function.  How you do this is entirely up to you. 

 

I (and many others who are smarter than I) could be more helpful if you would post your code.

0 Kudos
Message 4 of 4
(3,830 Views)