LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI with Case and Local Variables

Hello,

 

My calling code doesn't behave like the subvi.  The subvi has the local variable and property node (SP) in multiple locations.  The calling code SP values don't behave the same, all of the other logic works correctly.  Is there a way to make the calling code SP control behave the same as the subVI SP control ?

 

If I create the subvi by enveloping the case statement and letting Labview build the subvi it works but the code that labview creates is something I don't understand. 

 

Thank You  

Download All
0 Kudos
Message 1 of 8
(3,118 Views)

What do you mean by "it doesn't behave the same"?  What happens with the one method that is different from the other method?

 

I don't know why  you are writing to the local variable of the SP control in the VI you attached.  Once that subVI finishes executing, the value of SP doesn't in anyway get out of the subVI.

 

Why is so much code duplicated between the cases of your subVI?

0 Kudos
Message 2 of 8
(3,091 Views)

In the calling code I have a SP control that I would like to have the same values of the SP control in the subvi (disabled / grayed & local variable value) after the subvi executes.

 

I see now that the SP values don't get out of the subvi and thats what I need it to do.  Something needs to be wired through ?

 

Thanks for your help.  In the main vi there will be multiple instances (like picture) calling subvi.

0 Kudos
Message 3 of 8
(3,038 Views)

If you what to control/handle a front panel control on your main vi in a sub-vi, you need to send a reference of that control to the sub-vi.

0 Kudos
Message 4 of 8
(3,029 Views)

Is SP supposed to be a control (user can adjust) or an indicator (output status only)?  Why can't you just create an SP output and put that the the connector pane.  Then the main VI can just read the value coming out of the subVI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 8
(3,027 Views)

When labview creates the subvi it requires a reference.  Not sure how to send a reference from calling code to the subvi or how to handle it with the subvi I will play with the mechanics.

 

SP is a control that the user adjusts in the main code.  This sends a 0 - 5VDC signal to the device (one of several) under control.  Only in the manual case can a value between 0 - 100% be entered.  All other cases are predefined so rather than manually enter a value the user can select from drop down.

 

Thanks so much guys getting there.

0 Kudos
Message 6 of 8
(3,011 Views)

If you choose a numeric control, you can select that as an input in your connector pane.  That let's you wire a numeric value in without requiring a reference.  This is true for other data types.  That's what is meant by asking you why you don't wire the values directly.

0 Kudos
Message 7 of 8
(2,982 Views)

dkfire mentioned already that you need to pass the control reference of the SP control in the main VI to the subVI. Just right click the SP control in the main VI and select Create/Reference. Then wire the reference to the subVI.

You can also calculate the voltage signal to the MFC based on the %FS values, which simplifies the code (see attached VI)

 

0 Kudos
Message 8 of 8
(2,964 Views)