Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

abort finite aquisition

 

My application generates analog voltages synchronized with a finite analog aquisition over a three minute period.  It is based on the Multi-Function-Synch AI-AO-Ext Dig Trigger.vi example.

 

Is there a way to abort this vi once it has started?

 

Dave

0 Kudos
Message 1 of 12
(4,379 Views)

As far as you didnt change anything on the VI there should be a STOP button.

 

 

0 Kudos
Message 2 of 12
(4,378 Views)
The aquisition is part of an application. I do not want to stop the entire application, only halt the aquisition.
0 Kudos
Message 3 of 12
(4,380 Views)
Use DAQmx Stop Task.vi to stop the Task programmatically.
0 Kudos
Message 4 of 12
(4,378 Views)
I need to be able to abort the aquisition using a boolean from the front panel of the main vi while it is running. How would I implement this?
0 Kudos
Message 5 of 12
(4,375 Views)

Boolen Control connected to Case Sturcture which TRUE case contains the DAQmx Stop.vi

0 Kudos
Message 6 of 12
(4,373 Views)

I understand how booleans and case structures work. I don't know how to interrupt the DAQmx vi's.

 

 When the start button is pressed on the main vi's gui, this vi is called. Two tasks start, one for voltage generation and one for analog acquisition.

 

How can I get the DAQmx stop function to work from outside of the running subvi?

0 Kudos
Message 7 of 12
(4,369 Views)

Hi dmourer,

 

The key thing to keep in mind when acquiring a finite set of samples is that when you call the DAQmx Read function, it will wait until it receives how ever many samples you specify to read. If this value is the same as what your finite acquisition is requesting, you cannot directly stop the task once it begins reading, as the Read function will be blocking. Thus, the solution is to read smaller chunks of data each time inside of a loop. Using this method, you may stop this loop at any time and then stop/clear the task once you have stopped reading. You will also need to include the DAQmx Is Task Done function inside the loop so that it can stop the loop once the finite acquisition has completed, if it hasn't already been stopped by pressing the button. I created a very quick example of what this looks like and have attached it below. Hope this helps!

Daniel S.
National Instruments
0 Kudos
Message 8 of 12
(4,339 Views)

dansch,

 

Thank you for your suggestion. The problem I have is that timing is critical and the amount of data collected. I am triggering the analog voltage generation, acquisition and another device simultaneously to collect data for 180 seconds at a scan rate of 5000 Hz (900K Samples). I tried using a loop and had trouble. The array gets so large that it bogs down the pc.

 

Is there a way to modify the vi to get the same results, but giving the option to abort?

 

Dave

0 Kudos
Message 9 of 12
(4,333 Views)

Just don't read until after you exit the loop (make sure to add some wait to the loop or it will peg your cpu usage), and only read what is available (-1). You can stop the loop at any time, and when the read is called it would return with the values read. Note that it will only return what has already been acquired - if you stop it before the 900k samples are read it will only return what has already been acquired. 

 

Cheers, 

Andrew S

0 Kudos
Message 10 of 12
(4,330 Views)