From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sudden stop possible when a continuos loop running ?

all

I have a main VI and display results/graphs using references from a subvi. I have a STOP button on my main vi, which when pressed must immedietly stop the subvi. The subvi however contains a DAQ acquire VI which acquires like 32667 every loop. Currently my stop button works only before/after the acquisition is completed. Also there is some data processing after data is acquired which again goes into a long loop.

Is it possible for my stop button to override everything and close these VIs and acquisition immedietly ?



Kudos are the best way to say thanks 🙂
0 Kudos
Message 1 of 15
(2,956 Views)
You could use the VI server to launch your subVI and then use the VI server again to abort your subVI. See attached sample.
Download All
0 Kudos
Message 2 of 15
(2,933 Views)
Thanks for the reply. Would your method work, if I have references from the subVI to display the data on my main VI ?

I have about 10 references that I have. I am not sure how to implement your idea with this.

Kudos are the best way to say thanks 🙂
0 Kudos
Message 3 of 15
(2,909 Views)
Depends on how you want to do it. You could use global variables, or you can use the method "Set Control Value". See updated attachments.
Download All
Message 4 of 15
(2,889 Views)
That's very cool. Your examples are simple and very explanotary for someone who's not used these before. Thanks very much. I have a clear idea of what I need to do.

Kudos are the best way to say thanks 🙂
0 Kudos
Message 5 of 15
(2,878 Views)
No problem. Glad to help. In case you wanted to see how you would use a global variable to accomplish the same thing, here's an updated example. Note that if you're using LV8 you can use shared variables instead of global variables. Same concept, but shared variables are not supposed to have the same overhead that global variables have.

Message Edited by smercurio_fc on 03-13-2006 09:58 AM

Message 6 of 15
(2,874 Views)
Does the flatten to string work for intensity charts/graphs ? Everything works except for intensity graphs...wonder why

Kudos are the best way to say thanks 🙂
0 Kudos
Message 7 of 15
(2,859 Views)

Very usefull to know these methods.

But be aware that they are rather brute...  It's similar to pressing the abort button. Depending on your application, you might want quit your data acquisition and processing in a little more elegant way. 

You might want to set a global variable (or a reference to an indicator) that the subvi can check, to see if it should stop prematurely.  Suppose that your subvi needs to acquire 1000 values, and report back the average. Let the subvi check that global variable after each iteration.  That way, it can break off, and return quickly after pressing stop in the main vi.  The advantage is that you can make sure that you close down the acquisition device properly.

Depends on your application wether you need to stop the subvi properly.   Devices typically should be closed properly.  But just a calculation on data doesn't.

Message 8 of 15
(2,848 Views)
I agree with Anthony's statement that the "Abort VI" method is a brute-force approach - I use it only when necessary. I was just providing an example of one way to do it. It really all depends on what you're trying to accomplish. Your original statement was that you wanted to stop the subVI immediately, and the "Abort VI" method does this. Whether or not that's the right way for your application... only you can answer that.

With respect to intensity graphs it also works. Not sure what you may be doing that's causing the problem. Take a look at the attached example and compare to what you're doing. Hope you don't mind psychedelic-looking graphs. Smiley Happy
0 Kudos
Message 9 of 15
(2,834 Views)
Yeah ABORT VI is important but I have a DAQ stop VI which will stop my device before stopping the VI 🙂

Intensity graph works now. My mistake was I did not assign the refnum to show the data type.

Using your method, I can have a subvi with just controls and indicators and call all these on my main VI and still run a live update right ? With references looks like I need to be very careful with the datatype.

Kudos are the best way to say thanks 🙂
0 Kudos
Message 10 of 15
(2,824 Views)