03-26-2014 09:24 PM - edited 03-26-2014 09:25 PM
I have multiple SubVIs (SubVI-A and SubVI-B) being called by my MainVI. All control variables and indicators are located in the MainVI.
There are many control variables as inputs to the SubVIs and indictors comming out of the SubVIs to be displayed on the MainVI.
While my SubVI is executing (ex: SubVI-A), I want my indicators on the MainVI to display the outputs instantaneously. The reason for this is because there is another SubVI (ex: SubVI-B) in the MainVI that requires SubVI-A's output instantaneously to carryout its funcation.
How do I do this?
03-26-2014 09:28 PM
To update indicators in other VI's, use references. You pass a reference from the main VI to the subVI, and use the Value property node in the subVI to update the indicator on the main VI.
If you are just passing data between VI's, use queues, or an Action Engine.
Search the forums for help on both. These questions have been asked and anwered many times before.
03-26-2014 10:15 PM
Do you remember this message thread?
03-27-2014 11:30 AM
Yes I do remember that solution, however, I was trying to see if there are any other ways other than "References & Property Nodes". The reason for this is that for varibles that I require instantenous output, I have to put the property node inside a while loop, and it was slowing down my program because I have so many outputs that I reqiure instantenou outputs for.
Just wondering, would Global Varibles be also a solution?
03-27-2014 01:31 PM
Yes. Global Variables can be a solution. Usually not recommended for the same reasons as local variables. You can have problems with race conditions. Missing data, state or repeated data. Multiple writers can step on each other's toes.
As long as you are aware of the pitfalls, and can be certain they won't be detrimental for your particular situation, yes you can use global variables to pass data between VI's in the same application.
03-27-2014 07:15 PM
03-28-2014 09:11 AM
I like to use User Events to pass the data back up to the main VI. The main VI then handles the events with an event structure and update the controls/indicators as needed.
03-28-2014 09:20 AM
i agree with crossrulz, events is the prettiest/best solution if events dont scare you. 🙂
/Y