LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass numeric value to front panel from several layers of subVIs

I have several numeric values that I want to pass to the main front panel VI but the issue is it is buried within 3 other subVIs. I don't want to pass them between each subVI, especially since in the end I'll have 24 to pass. Is there a nice way to jump straight to the front panel instead of having to go through each subVI?

0 Kudos
Message 1 of 6
(3,189 Views)

There are several ways to do it, depending on your architecture.

  • User events
  • Pass an array of references to the indicator into the subVIs and update the indicators there
  • Action engines or functional globals
aputman
Message 2 of 6
(3,179 Views)

You said you have 24 values to pass.  Are they all passed together?  Grouping them in a Cluster simplifies the "passing" logic.

 

Another question to ask is if this is a "push" (the data "shows up" on the Top Level VI without the TLVI "asking for it" or a "pull" (the Top Level VI asks "What's the Current Value of this variable?").  If you are "pushing", passing an array of references to the sub-VI lets it "do the work" without the TLVI even noticing.  Alternatively, User Events or a Queue (with the TLVI "waiting" for a new Element, which takes no CPU time) are things to consider.  If "pulling", I often use the Functional Global (a.k.a. a VIG, VI Global).

 

Bob Schor

0 Kudos
Message 3 of 6
(3,171 Views)

In this gallery I have a collection of screen shots that show how I have used what I call a GUI controller.

 

Clicking on those images will show you a larger version (example can be found here )

 

 

Below each image you will find a link to the discussions where those images were originally used.

 

Those image and discussion may be helpful.

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 6
(3,159 Views)

@Bob_Schor wrote:

You said you have 24 values to pass.  Are they all passed together?  Grouping them in a Cluster simplifies the "passing" logic.

 

Another question to ask is if this is a "push" (the data "shows up" on the Top Level VI without the TLVI "asking for it" or a "pull" (the Top Level VI asks "What's the Current Value of this variable?").  If you are "pushing", passing an array of references to the sub-VI lets it "do the work" without the TLVI even noticing.  Alternatively, User Events or a Queue (with the TLVI "waiting" for a new Element, which takes no CPU time) are things to consider.  If "pulling", I often use the Functional Global (a.k.a. a VIG, VI Global).

 

Bob Schor


They are not passed all at once, but one right after another in a sequential order. I think technically this is pulling in your example. The user pushes a button on the main GUI and that causes some response with an external circuit, then values are read from that circuit and reported back to the front panel. I am thinking about using a functional global, I am just not sure how to actually pass the data from the functional global VI to the main VI. It doesn't update on the front panel.

0 Kudos
Message 5 of 6
(3,105 Views)

Using the FGV, in order for the front panel to update, you need a separate, parallel loop that is continually checking the FGV.  Otherwise the loop that has the subVI in it will be holding waiting for the lower level subVI's to finish executing.

 

You could also use queues or user events to pass messages to the higher level VI.  Of course you'll still need something in parallel to the loop running the subVI.

0 Kudos
Message 6 of 6
(3,102 Views)