LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass attribute from sub vi to main vi

Solved!
Go to solution

All--

      I have spent the last 2+ hours looking at examples and forum posts and can't find what I need. I have a sub vi that gets a number. Based on the number the subvi enters one of 3 cases. The output of the sub vi is an indicator light and a numeric value. Each case has property nodes that change the caption above the numeric indicator and the color of the led indicator. The sub vi works correctly. How do I get the indicators on the main vi front panel to change when the sub vi indicators change. Please be specific. Don't tell me to create a reference and pass the data to the front panel indicator because that doesn't make any sense to me. This is the first time I trying to use references and right now I'm just not getting it. Thanks in advance for the help.

 

ssmith

0 Kudos
Message 1 of 13
(5,183 Views)

ssmith490D wrote:

All--

      I have spent the last 2+ hours looking at examples and forum posts and can't find what I need. I have a sub vi that gets a number. Based on the number the subvi enters one of 3 cases. The output of the sub vi is an indicator light and a numeric value. Each case has property nodes that change the caption above the numeric indicator and the color of the led indicator. The sub vi works correctly. How do I get the indicators on the main vi front panel to change when the sub vi indicators change. Please be specific. Don't tell me to create a reference and pass the data to the front panel indicator because that doesn't make any sense to me. This is the first time I trying to use references and right now I'm just not getting it. Thanks in advance for the help.

 

ssmith


 

Well I am afraid to do what you want you will have to use references and property nodes to accomplish it. I have attached two VI's (LV 8.6) they should help you out. have a look at them and if you have any more questions then please let me know



Joe.
"NOTHING IS EVER EASY"
Download All
0 Kudos
Message 2 of 13
(5,178 Views)

The thing to remember is that a control reference is like a handle that allows you to interact with a control. Every control has properties that you access through a property node. When you wire the reference to the property node, the node reconfigures itself to give you access the properties that are associated with that specific control. One of the properties that you can set or read is the Value property. There are others that can do things like change the color of the text in string controls or modify the strings that appear in a listbox. With a reference you can also invoke methods that can do things like get an image of the control.

 

So... you need to create a reference and pass the data to the front panel indicator. (Sorry, I couldn't resist).To do this, right click on the indicator on the main VI and from the popup menu select Create>Reference. Pass this reference to the subVI as you would any other piece of data. Inside the subVI, where you want to change the indicator's value, wire the reference to a property node, now right click on the property node and select Select Property>Value. Finally wire to the property the value that you want to appear in the indicator.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 13
(5,167 Views)

Hmmm... have you considered creating a reference and passing it the subvi?

 

(I couldn't resist either).

 

In all seriousness, it isn't that hard.  Just remember to use a property node with the property set to value.  I use this frequently with VI's that have lots of indicators where the updates happen way down in a subVI.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 4 of 13
(5,155 Views)

Thank you all for the comic relief. LOL. I didn't mean that I didn't want to use a reference, because I know that I do. I just don't know how. I'll try Mike's instructions and let you know how I make out, or follow with more questions. Thanks a lot!!

 

ssmith

0 Kudos
Message 5 of 13
(5,129 Views)

I've created the reference as you said, NP. Does the front panel indicators have to be wire now?? I have attached a jpeg that shows the section of the main VI and the subvi called Wind Alert. Open the sub vi and you'll see that the property nodes don't have a terminal for the reference wire from the indicator reference. How do I fix that? Thanks.

 

ssmith

Download All
0 Kudos
Message 6 of 13
(5,119 Views)
Solution
Accepted by topic author ssmith490D

You don't have a reference control in the subVI. A simple way is from the block diagram of the main VI, drag the reference to the front panel of the subVI. Then you can go to the block diagram of the subVI and right click on the reference and select Create>Property - whatever.

 

Don't forget to wire the reference control of the subVI to the connector pane so that you can wire the main's reference to the subVI.

Message 7 of 13
(5,111 Views)

Let me get this straight. So the property nodes inside the sub vi I posted have to be created from the reference(from the main vi FP indicators) not the indicators in the sub vi, which is what I've done. Is that right??

 

ssmith

0 Kudos
Message 8 of 13
(5,103 Views)
That is correct. The indicators in the subVI have no relationship to indicators/controls in the main VI. Totally separate objects.
0 Kudos
Message 9 of 13
(5,098 Views)

Yes that is correct. Since I see now that you could not open my VI's (you could have posted your LV version) her are some pics of the front panel and the block diagram.

 

Main front Panel

 

Main block Diagram

 

Message Edited by Jhoskins on 02-19-2009 11:12 AM



Joe.
"NOTHING IS EVER EASY"
Download All
Message 10 of 13
(5,094 Views)