LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI inputs and outputs in Labview 5.1.1

I have a SubVI that is used inside a while loop in the calling VI and there is a cluster outside the while loop and shift registers that retain the prior state of the cluster.  This cluster outside the while loop is an input to the SubVI and contains the ON/OFF state of my heating and cooling appliances.  How do you know what input to the SubVI corresponds to what local variable in the SubVI code?  Why do you need that cluster outside the while loop? In the SubVI I am replacing the state of the heating and cooling appliances in a local cluster and outputting the new cluster back to the calling VI.
 
 
0 Kudos
Message 1 of 14
(4,130 Views)
That makes little sense. Why are there local variables in the subVI and why do you care. The external cluster is how you pass data to a subVI through the connector pane and the subVI has front panel terminals for this.  And I would assume that it is outside the while to initialize the shift register to some know value before you start. Did someone else write the VI and subVI? If the cluster is not initializing the shift register, you really need to post an image of the code or the VI itself.
0 Kudos
Message 2 of 14
(4,127 Views)

Hi BME genuis,

why do you need local variables. Local variables belong to a control. You can search for this control, with right click on the local variable and select -> search for terminal. Can you show your code?

Mike

0 Kudos
Message 3 of 14
(4,125 Views)
Ok, I don't think they are local variables in the SubVI.  I understand now why it is outside the while loop in the calling VI to initialize and why there are shift registers to get the most recent state of the cluster elements.  However, what I don't understand is how you know which cluster inside the SubVI corresponds to what inputted cluster to the SubVI?
0 Kudos
Message 4 of 14
(4,119 Views)
I still don't understand the confusion. A control on the front panel corresponds to some location on the connector pane. On the connector pane, you can click on connector and the front panel control/indicator will be highlighted. You can double click on the front panel terminal to find it on the block diagram or right click on it and select 'Find Terminal'. Giving each control/terminal a name is also recomended. Then, if you have context help open, when you move the mouse over the subVI's icon, you will see an icon of the subVI with the names of the inputs/outputs and the data types.
0 Kudos
Message 5 of 14
(4,115 Views)
Oh, I did not realize there was a function to do this.  How do I get to context help and am I doing this in the calling VI?  What is the connector pane and isnt that in the block diagram?  Essentially I have three clusters in the SubVI and I want to know which of the three is the inputted cluster.  I have a feeling that my cluster out is also my cluster in from the shift register.  My cluster out is used to turn ON/OFF stuff inside the calling VI while loop and then it hits the end shift register.  The front end shift register is wired to the input of my SubVI.
0 Kudos
Message 6 of 14
(4,110 Views)
The connector pane is visible when you click on the VI Icon on the front panel and select Show Connector. The image shows what happens when you click on a connector with the wiring tool. I also shows the help window (Help>Show context Help). The connector pane has to be wired in order to pass data from a main to a subVI. You know what connector is associated with each front panel control, and you know which front panel control is associated with some block diagram terminal, and you know how the main program is wired to the subVI. If your subVI has three inputs but the main only has one wired, what the subVI does not know is which ones are unwired. Unwired inputs of a subVI will use the default values of that control.
0 Kudos
Message 7 of 14
(4,107 Views)

So when you send a variable to a subVI or accept it from a subVI what are you actually doing?  Is it a shared local variable?  Does labview know what variable in the calling VI corresponds to what variable in the subVI? 

When you bundle a cluster by name in order to make an indicator cluster why do you need an input cluster?  The indicator cluster is the one being sent back to the calling VI from the subVI.

 

0 Kudos
Message 8 of 14
(4,101 Views)

You pass data from a main to a subVI with a wire. Whatever data is contained in the wire is what is passed to the subVI.

Clusters are a way to combine one or more controls/indicators into a single object. They are like a structure in C. There are numerous reasons to use a cluster instead of the individual elements. For example, if a subVI required 6 different separate inputs, that would require 6 different connections on the connector pane and 6 separate wires on the main. Making the 6 part of a cluster, you use a single connection on the connector pane and a single wire in the main.

0 Kudos
Message 9 of 14
(4,086 Views)

It sounds like you have never actually used LabVIEW before.

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 10 of 14
(4,067 Views)