02-15-2012 03:38 AM
[Beginner] In my calling vi there is a sub vi which is basically a while loop with many loops and structures inside it.
I want to start and stop the sub vi from the calling VI only. But the while loop in the sub vi only takes the first value from the control on main vi.
essentially the first pic is a dummy of the sub vi ( with all the structures inside it removed) and of the calling vi.
the sub vi should only start if the initial value of boolean is true.
please help
Solved! Go to Solution.
02-15-2012 03:49 AM
You can control subVI by passing reference.Refer to this document.
Also find the attached VI
02-15-2012 06:57 AM
Either pass the reference as mentioned, or transfer data through Events (in which case you pass the event register thread instead) or my favorite, an Action Engine (AE). In the last case your main vi writes data to an AE and the sub-vi reads from it.
I think Ben has an excellent nugget on AEs.
/Y
02-15-2012 09:21 AM
Ben's nugget:
http://forums.ni.com/t5/LabVIEW/Community-Nugget-4-08-2007-Action-Engines/td-p/503801
02-16-2012 12:47 AM
Aarthi : yes it works.. thank you...
Yamada : I am not sure how to implement it through a thread but I'll surely explore...
Vt92 : thank you for the link..
Can you please tell which is the best way>> ? My main VI is to be the central control for all sub vi s i.e all sub vi s will start and stop accoding to the
control from main vi. Also some of the vi maybe in loops so that it continuously checks for value from main vi and can be started or stooped more than
once while the execution of the main vi..
02-16-2012 01:06 AM - edited 02-16-2012 01:07 AM
The best thing would be to use the LV2G (Functional global).You can follow the link given by vt92. Action engine is the advanced version of LV2G and Ben has given an Awesome explanation on both. So better follow that and use LV2G.
02-16-2012 05:54 AM
does using a functional global use a lot of cpu usage? because it is making my computer really slow, and values from one control is not being written into the functional global, do i hvae to put that control in a loop ? or should it update automatically despite where it lies??
02-16-2012 06:16 AM
Hi
Could you show your functional global and the control which is not being read?
02-16-2012 07:50 AM
I guess You have done one mistake. You have not given the stop condition true that will only cause two things.
Full CPU usage (Since no time delay)
Since stop condition is false it will not come out of it.
try this
02-16-2012 10:04 PM
here are the images. I can attach the VI as well. The main vi has the boolean control start. However this value is not read the second time I change the control. Please tell what am I doing wrong?