LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instantaneous Outputs from SubVIs to MainVI

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?

0 Kudos
Message 1 of 8
(3,102 Views)

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.

0 Kudos
Message 2 of 8
(3,094 Views)
0 Kudos
Message 3 of 8
(3,081 Views)

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?

0 Kudos
Message 4 of 8
(3,041 Views)

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.

0 Kudos
Message 5 of 8
(3,020 Views)
Do the sub-vi really take such long time? For moving the unformation to the 2nd vi simply wire inputs and outputs of the vi's.
Property nodes are slow, i'd update an AE in the sub-vi and have a small loop that updates the indicators e.g. Twice per second.
/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 8
(3,000 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 8
(2,975 Views)

i agree with crossrulz, events is the prettiest/best solution if events dont scare you. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 8
(2,968 Views)