01-20-2012 10:41 AM
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.
Solved! Go to Solution.
01-20-2012 10:56 AM
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.
01-20-2012 11:07 AM
Attached are the VIs
01-20-2012 11:26 AM
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
SubVI
01-20-2012 12:21 PM
It works! I used your approach. See the attached vis.
Thank you.
01-20-2012 06:03 PM
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)
07-19-2012 10:06 PM
07-19-2012 11:10 PM - edited 07-19-2012 11:13 PM
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!
Done. You can now access all your front panel controls and indicators anywhere in your program as shown below.
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.