07-06-2011 12:47 AM - edited 07-06-2011 12:52 AM
I have multiple subVIs that has a loops inside. The mainVi calls these subVis. I need to pass the parameters and even be able to stop the subVIs from the mainVI. Cannot launch the subVI front panel (which would run it in separate execution).
The only way I have found so far is to create a shared variable (single process) for stop and any parameter that needs to be passed from main VI to subVI. Then monitor the shared variable value in the subVI for change. Is there any pros/cons of using this approach and is there any other approach to achieve this behavior instead of using shared variable?
Can the variable be passed by reference and subVi can read the value? Or is there any way to register the events, generate the event on main Vi and when the mainVI generate the event, subVI receives that event and performs accordingly?
Attach is the zip file.
TIA.
07-06-2011 05:11 PM
Hi lvrat,
A control reference can be passed between VIs, as shown by this example. Additionally, this example describes how to do custom user events, and how to queue them. As far as pros/cons, I recommend passing the control reference, as this will get you the best performance.
02-27-2014 02:24 PM
for any other LV beginner, like me, that follows in these footsteps, reading the VI server reference must occur INSIDE the while loop. Hopefully, that'll save someone 2 hrs