LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

quit from while loop inside a vi that run a while loop

Highlighted

Hello,

 

this is just an example

i have a led that blink inside a subvi and i what to stop it form the ui of the user (MainHelp.vi)

but because the subvihelp.vi dont know the stop button it will not stop when i klick on the stop button

 

How i can work it out with out using global Var

 

thanks for your replay.

0 Kudos
Message 1 of 9
(811 Views)

Hi

 

Here is one method to stop a blinking VI in a SubVI.  I tried not to change your version of how the blinking works.  Since the subVI is running continuously this example calls the VI using static reference and using the control names.  You could also use a queue to pass values to the subVI controls.

 

Your original VI has a lot of stuff that made no sense, so I cleaned them all out or up, so to speak.

 

subVIHelp.png.

 

 mainhelp.png

 

Good Luck.

-------
Mark Ramsdale
-------
0 Kudos
Message 2 of 9
(800 Views)

thanks for your replay

 

there is a a chance you can save it that it can be open in labview 2010

0 Kudos
Message 3 of 9
(780 Views)

Ok thanks

 

i did understand the vi,

 

but what if i have alot of vi?

this is will be a good what to stop a process

 

from where i question is comming from:

i am building a program that control on a vacuum.

i have a SubVI for every output, in the subVI of the output i look if the valve is close/open and just then i quit the SubVI and continue to the next one.

but what if i have a problem in the system the pressure is not good enough and more problem that can occur while i am waiting to valve to close,

just when i exit the SubVI it see the problem and take an action

0 Kudos
Message 4 of 9
(775 Views)

Hi,

 

Glad you liked the example of controlling an LED in a SubVI from a parent VI.

 

The description  is not so clear.  The subVI is looking to see the valve state.  When and where do you look at the pressure?  How long does it take to close the valve, and when do you tell the valve to close?

 

I'm not sure how this example converts to the code you want to develop.  DO you have some smple code?

 

Mark

-------
Mark Ramsdale
-------
0 Kudos
Message 5 of 9
(750 Views)

OK i will try to  expline my self

 

there is two way to say to a valve to open/close

manual:  every valve have a button

auto: sequence of action (open that, close that, heat that ....)

 

the open/close valve look like that

SubVI-VP.png

this is a subVI to open/close Valve P.

 

when i try to expline my self i thought on somehing.

to make a MainMain VI that will run the Main Program, like that

Main_Main.png

the VI 1 in control on the front panel.

when the system is not ok, i dont care about the front panel. i just what to close all the valve and the heat.

when i try that to Labview return me Error 1000

 

thanks for your replay

0 Kudos
Message 6 of 9
(743 Views)

Hi,

 

I have not use the abort VI property, so I am not sure why you are getting error 1000.  This says the VI is not in a state to be aborted.

 

It seems you are using two levels of dynamic dispatch, so that might have something to do with it.

 

If your goal is to shut down all the subVI's that are running valves you probably need a scheme to close those subVI's first, then close the main VI that has called all the SubVI's.

 

Can you restate what the goal is that you are trying to achieve?

 

thanks

 

Mark

-------
Mark Ramsdale
-------
0 Kudos
Message 7 of 9
(725 Views)

Why don't you use a queue or a message to pass the status of those stop buttons bettween the VIs?

 

If the queue have the same name even if you call it from different VIs you are calling the same queue

 

It's only an idea, but I think that it could work.

0 Kudos
Message 8 of 9
(712 Views)

The beautiful solution is to use user events and react to them in the sub-vi. The easy is to use a global variable that stops the sub vi's.

/Y

G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 9
(704 Views)