LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop the Main Vi from a control on a sub vi

Hello,

 

I am a relatively new Labview user and have inherited code that is designed to perform data acquisition of laboratory equipment as well as control some of the experimental criteria (i.e.. Pressure, linear and rotary motion). As of now, the main_display.vi displays the data, and there is a button on the main_dislpay.vi that calls the ControlPanel subvi. I would like to place a button on the ControlPanel Subvi that is able to stop the Main_Display top level VI. Please help!!

 

 - Trevor

Download All
0 Kudos
Message 1 of 2
(2,418 Views)

There is a few different ways to go about doing this. Looking through the code I saw the usage of FGV's so that is one way you could do it.  The method I would use is using a notifier to send the stop notification to the other programs.  I included an example of how FGV and notifiers would work. If you are unfamiliar with event structures and how to use them I would recommend the FGV way to shut down the sub vi. The nice thing about event structures and notifiers is they don't require any CPU processing until an event happens or a notification happens. This allows the CPU to focus all its attention on other things. The last thing, just a word of advice, I understand that this code has been passed on to you but there is a lot of local variable usage.  When you go to make improvements on this code, I would steer away from these as much as possible.  They can give you unexpected results. If you search for race conditions you can find some examples of what exactl race conditions are and why they are bad.  Hope this helps. 

--Run myMainLoop, this should open up the secondary loop.  If it doesn't just go ahead and open up the second loop file and re run the myMainLoop.

 

-Kyle 

Message 2 of 2
(2,380 Views)