LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop acquisition at once

Solved!
Go to solution

Hi

I have a data acquisition and Rs-232 control all in a while loop.

The biggest problem is it takes a certain amount of time when

I press abort or stop button to actually stop. How can I set this

stop button to the highest priority or as an interrupt so that

whenever I use stop, application stops instantly. Right now it doesnt

respond to stop when its acquiring. 

0 Kudos
Message 1 of 9
(5,438 Views)

Rule #1 : Never stop a VI with the abort button. It is like using a tree to stop a car !

 

Obviously, the stop button will be read only once in every iteration of the loop. So the first thing is to ensure (dataflow) that the button is read after the acquisition. Doing so, a change of its value during the acquisition will be detected in the current iteration and the loop will stop without an additional iteration.

 

What is the duration of the acquisition ? If it is too long to get an acceptable response time of the loop, you must redesign it to acquire a smaller number of samples at once.

  1. Configure and start the acquisition prior entering the loop
  2. Acquire the signal in the loop (set number of samples for one read to get a good answer to user actions)
  3. Stop and clear the acquisition once the loop has ended 
LV ships with several examples showing how to do this.  
Message 2 of 9
(5,425 Views)

Thanks for your quick response. The usual acquisition time

is around 3-4 seconds. The data flow is simple but its required 

to be continous. It acquires data and then based on a condition

automatically increases or decreases using Visa write and read

commands to the control device, and this process continues until

a refernce value of acquisition is reached.

 

Sometimes when you want to stop the code in the middle of the process 

it takes couple of seconds respond if its in the midle of acquisition. I only

want that to go away andit respond instantly. Shouls I create an event 

structure for that.   

0 Kudos
Message 3 of 9
(5,410 Views)

Let me try and rephrase what JB suggested because his reply is what you need to do.

 

Instead of doing the acquisition in a single 3-4 second chunk, grab a smaller amount of data (100ms worth?) then check the Stop button. If no stop, grab another 100ms of data, add it to the end of the previous data and check Stop button again. Doing this, the stop button will be acted on in no more than 100ms.

 

Once the data acquisition process starts, there is no way to interrupt it except to use the Abort button (which is bad) and that may not work depending on the hardware being used.

 

An Event Structure won't really help as it is designed to react to front panel actions, but still cannot stop an acquisition in process.



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 4 of 9
(5,393 Views)
This is exactly what I tried to explain with my limited English ! Thank you Ed.
Message 5 of 9
(5,366 Views)
could you please send me the final vi for this....
0 Kudos
Message 6 of 9
(5,357 Views)

Here's the basic DAQ setup.

 

Basic Cont DAQ.GIF

 

The important thing here is what values you set the "Sample Rate" and "Samples to Read" controls to. I usually try to keep a 10:1 ratio between these. So if you set a sample rate of 1000Hz, set Sample to Read to 100. This will grab 100 samples from each channel each iteration of the loop and will let the loop iterate at a 100ms rate. With a 100ms loop rate, the loop will stop when you click the stop button.



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 7 of 9
(5,331 Views)

Your example is really good. I was acquiring data from a color meter using DLL files.

The only question is if I donot get any samples within 100 ms, then it could be an issue.

The amouint of data I am geting is not very high, but the speed is slow. Anyway I really liiked

your idea. Is there anyway else I could implement sample rate and sample to read controls.

I think I should have explained about my code. Since I am using .dll file I dont think I could use

the DAQ functions. I will see if it works.

 

 Yesh

 

0 Kudos
Message 8 of 9
(5,319 Views)
Solution
Accepted by topic author Yesh

You're correct in that you will not be able to use the NI DAQ functions for acquiring data from another manufacturers hardware, but the over concept would be the same. Acquire a smaller amount of data so the the application is not stuck in a 3-4 second acquisition process. If 100ms isn't long enough to get any data, you can lengthen that time as needed. It will end up being a balancing act between amount of data to grab and how "responsive" you want the Stop button to be.

 

Without knowing how the configuration for your hardware works, I can't really give any advice on how to set the sample rate and samples to read. Sometimes you just need to do a little trial and error until you find a good balance. 



Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
Message 9 of 9
(5,306 Views)