LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass data between the main VI and VI within a sub-VI?

I have a main VI which has sub-VIs. I am simply trying to pass a boolean value, programmatically, from the sub-VI of the sub-VI to the main VI. I have passed data using references from a sub-VI to a main VI all the time. I am now trying to go one level lower. I have been all over the boards trying to find an answer but I cannot. Or maybe I am just not understanding some answers. Any help would be appreciated.
 
Thanks,
Troy
0 Kudos
Message 1 of 13
(3,097 Views)

You can pass the value back over the vi's terminals back to the vi's caller, from where you pass it also back over the terminal.

You could also use the reference, but this is usually just necessary, if there is an action to take place in the main vi while the sub vi is executing. If possible, avoid it and try to use the dataflow.

This are just two possible ways, but there are much more. Every way with its advantages and disadvantages.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 13
(3,096 Views)

Becktho,

Do you mean to say that:

If I have a sub-vi executing a while loop, with the iteration passed to a numeric indicator on the FP of the sub-vi, I can show the iteration count on my main-vi by simply passing the sub-vi's numeric indicator's reference to another numeric indicator on the front panel of my main-vi? And this will happen even while my sub-vi's While Loop is still executing?

Thanks,

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 3 of 13
(3,092 Views)
No. You can pass a reference of you counter on the main vi's frontpanel to the sub vi and set there its value.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 13
(3,084 Views)

Becktho, Thanks!.

Sorry if my small aside interrupted the real thread.

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 5 of 13
(3,077 Views)
No problem if you have learned something 😉
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 6 of 13
(3,074 Views)
Maybe I am not understanding your explanation. I have a main VI--->sub VI--->sub VI. I am trying to get the value from the second sub VI to the main VI. This sub VI I am trying to get the boolean value from is "two layers" down from the main. I can connect a VI reference through all the VIs connector panes but I still am not updating the reference until the lowest level sub VI has finished executing. I do not see a way to wire the reference from the main VI to the lowest level sub VI connector pane which is what I have to do to get the value as that VI is executing.
0 Kudos
Message 7 of 13
(3,070 Views)
Sorry but now I can't follow. Now your talking about a VI reference - that puzzles me a little.
 
Could you post what you have done so far?
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 13
(3,067 Views)
Not a VI reference but a front panel indicator reference. Maybe I am not explaining it right. Hopefully this will clear it up. I have the front panel of the main VI. On that panel I have a boolean indicator that I want to update programmatically from the sub-VI of a sub-VI to the main. So the main is running, then a sub-VI is called. Within this sub-VI there is another sub-VI that is called. It is from this second sub-VI that I want to pass a boolean value back to the main indicator as this second sub-VI is executing. I appreciate the help so far.
0 Kudos
Message 9 of 13
(3,059 Views)
Are you trying to get the value of the boolean from the lowest level subVI to the main VI while the subVIs are still running?

Dataflow does not allow this. If both need to be running and updating simultaneously, the VIs need to be running in parallel. Then the data can be passed via a queue or a functional global.

Lynn
0 Kudos
Message 10 of 13
(3,058 Views)