LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass data into a sub vi?

Hi, I'm trying to pass an integer value into a sub vi that displays this value on a tank indicator. I've connected the tank indicator in the sub vi to one of the terminals but in the calling vi it seems to see the terminal as an output not an input. I can't find any way of selecting whether the terminal is an input or an output. How do I change the terminal to an input?

I'm using LabView7.0 Express on a Mac.

Hope you can help.
Dave G.
0 Kudos
Message 1 of 5
(3,127 Views)
That's because the indicator on you subVI is an output and not an input. Change it in the subVI to be a control or create a control in the subVI and wire that to the indicator.
0 Kudos
Message 2 of 5
(3,127 Views)
Hi Dennis,

Thanks for your reply. I thought that the tank would have to be an indicator to receive data from within the program and display it on the front panel and that a control receives data from the front panel and returns it to the program. I now realise this is not the case but it is a bit confusing to call something that is displaying or indicating data from within the prgram a 'control'.

Once I changed the tank indicator to a control the sub vi terminal worked ok as an input.

Thanks for your help.

Dave G
0 Kudos
Message 3 of 5
(3,127 Views)
Think from the perspective of the VI, not the "program": a control is always an input to the VI on whose front panel it's placed, and an indicator is always an output. Whether the control or indicator is displayed to the user or not is really secondary.

If you're using a control to both pass data into your subVI and display it to the user, you may want to disable it so the user can't alter the displayed value - that might not affect the operation of your program but it could be confusing!

The alternative would be to use a numeric control offscreen as the input terminal to your subVI and wire the value from that control directly into an onscreen tank indicator.
0 Kudos
Message 4 of 5
(3,128 Views)
In the attached VI, the user enters a start run value, and that value iterates when the attached device, a Lab Jack, detects the leading edge of a 5 V square wave. There's also an elapsed time function. On its own, the VI executes as intended, but when implemented as a sub VI, indicators wired to the appropriate nodes on the icon in a while loop do not update with execution (i.e. elapsed time, run, and start program numeric indicators don't continually update.) However, when I look at the front panel of the sub VI, the indicator values are continually updated. I've read the help documents about refnum, references, and property nodes; how do I implement these tools to display continually updated values generated by the sub VI in the front panel of a VI?
0 Kudos
Message 5 of 5
(3,045 Views)