02-12-2018 10:46 AM
hello,
i am using LabVIEW 2010 , i wants to call different subVIs in same program ,example 3 subVIs are there if i select subVI1 then it should run then if i stop that subVI1 only stop next if i select subVI 2 that has to run . In this concept i am facing small problem when i used to stop subVI 1 main program gets stoped . so how to use different subVI program in same main vi.
Solved! Go to Solution.
02-12-2018 11:01 AM
Obviously you are not programming it right, but we need to see some code to tell what's wrong. How are you calling the subVIs? How are you stopping the various things?
02-12-2018 11:08 AM
This depends on how you are terminating your SubVis. See the example for how I think you want to make sure you terminate your subvis. When you call SubVis from a main vi, you don't want to abort or exit out of the SubVis. Instead, you want them to simply run out of stuff to do. This means, for instance, exiting all for and while loops. See the example I have attached and just open and run the main vi. Then look at the simple code for the two sub vis. Click the buttons to stop them, don't abort or exit.
02-14-2018 12:04 AM
@altenbach wrote:
Obviously you are not programming it right, but we need to see some code to tell what's wrong. How are you calling the subVIs? How are you stopping the various things?
in this program i wants to run main program then if i stop1 vi1 only should stop, after that i wants to perform vi2 but stop is not working.
@altenbach
02-14-2018 12:14 AM
@majoris wrote:
This depends on how you are terminating your SubVis. See the example for how I think you want to make sure you terminate your subvis. When you call SubVis from a main vi, you don't want to abort or exit out of the SubVis. Instead, you want them to simply run out of stuff to do. This means, for instance, exiting all for and while loops. See the example I have attached and just open and run the main vi. Then look at the simple code for the two sub vis. Click the buttons to stop them, don't abort or exit.
in this program i wants to run main program then if i stop1 vi1 only should stop, after that i wants to perform vi2 but stop is not working.
02-14-2018 12:15 AM
in this program i wants to run main program then if i stop1 vi1 only should stop, after that i wants to perform vi2 but stop is not working.
@altenbach
02-14-2018 12:59 AM - edited 02-14-2018 01:00 AM
Hi manoj,
your VIs work exactly as YOU have programmed them!
All of the behaviour is dictated by THINK DATAFLOW!
1. You call a subVI. The subVI opens its frontpanel and runs until you stop it.
2. Then the DATALFLOW goes back to your mainVI, the next iteration of the while loop starts and your subVI is started again (within microseconds): back to point 1.
Simple solution: change the "vi selection" in the mainVI BEFORE you stop the subVI.
Better solution: only start the subVI after the user switches a dedicated START button.
General hint: Implement a better UI handling…