LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Abort Continuous Acquisition (which is set to acquire a constant number of samples per channel every iteration)?

Solved!
Go to solution

Hi all Smiley Happy

 

I would like to continuously acquire an analog input channel and, when neededbeing able to stop the acquisition as quickly as possible.

 

I'm using a NI USB-6289 board. I have set up a DAQmx analog input task (voltage), set the DAQmx Sample Clock to "continuous samples" and to the required rate (ie 1000, that is 1 kHz). For the acquisition, I have used a while loop with inside the DAQmx Read with the terminal "number of samples per channel" wired in (ie 1000). The while loop waits until 1000 samples are acquired and so continuously reads the channel in uniform batches of 1000 samples ticking every second. The while loop can be easily stopped when the DAQmx has finished acquiring the current batch of 1000 samples, but this requires to wait for the DAQmx to finish its current task.

 

My problem is how to stop the loop while the DAQmx Read is in the middle of receiving the 1000 samples WITHOUT waiting that all the 1000 samples are received? Is there a way to abort the DAQmx Read?

 

I could reduce the "number of samples per second", increasing the reactivity of the while loop but that is not the solution I prefer. I have tried to destroy the task (outside the while loop) but that doesn't immediately stop the acquisition, the DAQmx Read still has to finish acquiring the 1000 samples. I have included a sample subVI. When I was using a PCI card, I had used a timed while loop with inside the DAQmx Read with the terminal "number of samples per channel" wired to -1 (=which means "read everything in the buffer"). In that case it was easy to stop the acquisition at any timethe timed while loop was aborted and the acquisition ceased immediately. But that doesn't work with a NI USB-6289 card (see thread http://forums.ni.com/ni/board/message?board.id=170&message.id=386509&query.id=438879#M386509) because of the different way data are transferred to the PC.

 

Thank you for your help!!!

Have a bright day,

 

LucaQ

0 Kudos
Message 1 of 2
(2,820 Views)
Solution
Accepted by LucaQ

Hi LucaQ,

 

Your solutions are either decrease the number of samples, or recod the time you want to stop and remove the samples that were aquired beyond that time. There is no other way to stop the actual read off of the hardware.

 

Flash

National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(2,786 Views)