LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I display a changing variable in a subvi on the front panel of the main vi as the subvi is excuting

Solved!
Go to solution

In the document attached the vi on the right is sub to the vi on the left. On the subvi on the right the variable "Field Reading" is continuously updated on the front panel of the subvi as the "for" loop is executed, but only the last value of the variable is updated on the main vi front panel which is what is expected. My question is how can I display the changing value of "Field Reading" on the main vi front panel as the "for" loop in the subvi is running?

 

Thank you.

0 Kudos
Message 1 of 8
(4,967 Views)

You need a property node and a control reference. You should be able to find more information searching the forums with those terms. If I did not understand correctly it is because I refuse to open Microsoft Office documents from the web. You should post the VIs instead.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 8
(4,961 Views)

Attached are the VIs

Download All
0 Kudos
Message 3 of 8
(4,957 Views)
Solution
Accepted by topic author chuck72352

I don't have the drivers you are using. But here is an example of how to update an indicator from a subVI. To create the reference control in the subVI, select a control refnum from the refnum pallette and drag a numeric (or whatever) over the refnum control.

 

 

Caller VI

main_BD.png

 

 

SubVI

su_BD.png

 

=====================
LabVIEW 2012


Download All
Message 4 of 8
(4,950 Views)

It works! I used your approach. See the attached vis.

 

Thank you.

Download All
0 Kudos
Message 5 of 8
(4,937 Views)

In my LabVIEW projects I create a global VI that has references for all my top-level user-interface front panel controls and indicators. This is loaded with the appropriate refnums during initialisation. This way, if I ever want to access top-level user-interface controls or indicators I just drop the global and select the appropriate control/indicator. Simple and clean.

 

(Don't worry about finding out who's writing to the front panel, you can do a Find)

0 Kudos
Message 6 of 8
(4,917 Views)

Hey vitoi,

Can you provide an example of your solution with the global VI and references?

 

Cheers

0 Kudos
Message 7 of 8
(4,816 Views)

Hopefully I can explain it well enough. It really is simple.

 

1) Create an empty global variable and call it something like User Interface References.vi

2) For each and every control and indicator on your front panel, right-click and select Create/Reference

3) Place these references wherever you like (I use a series of Event cases to perform my initialisation and these all live in one of these event cases). They can be placed anywhere in the main vi.

4) For each of the references, right-click and select Create/Indicator

5) Moving to the front panel, Cut all the indicators and Paste them in the global variable (eg. User Interface References.vi)

6) Moving back to the block diagram, wire the global variable to each of the references and select the same named global variable.

 

All the hard work is now done (until you add another user interface terminal). You should now have something that look as shown below, [except the reference labels would be to the left (not sure why the snippet put them above)]. In my latest program I have 82 references!

 

snippet1.png

 

Done. You can now access all your front panel controls and indicators anywhere in your program as shown below.

 

 

 snippet.png

 

You can just select Value in most cases, but in this particular case I wanted to fire off an Event to do some things (log the alarm) as well as just update the value. So, this is another bonus with the method.

 

Hopefully this all makes sense. If not, let me know.

0 Kudos
Message 8 of 8
(4,810 Views)