LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Outputting values from a sub vi

I have created a sub vi to use in my main code which reads information from a tag input and measures the min/max and average values of that tag as an output. The outputs are shown as indicators on the sub vi front panel and this information is being collected with no problem. However, as soon as I import my sub vi into my main code I can’t extract the values as outputs, even though the values are shown in the sub vi front panel?

Is there any particular reason outputs would show in the sub vi front panel but not in the main code front panel?

Apologies for the confusing description – I have attached an example of my code which makes it clear what the issue is. I have used a random number generator to simulate the tag input values.

Many thanks,

Stuart Wilson

0 Kudos
Message 1 of 5
(2,965 Views)

Hello

If you want to show the subvi values in main vi front panel while subvi is running, you will have to pass references to front panel indicators to the subvi . Search "references" in labview examples to learn how to use them.

If not, the from panel indicatos will be updated when subvi stops running.

 

Hope it helps

Alipio

---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 2 of 5
(2,960 Views)
Perhaps your subvi is not a subvi.
Two options:
+ Create a new subvi.  Look for subvi in the help
+ Make your a vi a subvi.  Go to the front panel.  Right click on the incon on top right part of the window, below the minimize/restore/close buttons.  Select "show connector".  Ensure that there are connections (the square is divided in some coloured parts).  More help if you look for "terminals" in the help
Carlos Arcediano del Amo
0 Kudos
Message 3 of 5
(2,956 Views)
try this Sub vi with your main program
0 Kudos
Message 4 of 5
(2,953 Views)
All/Binoy, I didn't realise the sub vi had to stop before letting the data flow out. Indeed, Binoy, your sub vi has worked perfectly and my faith in LabVIEW has been restored. Many thanks. And I am intrigued about referencing as an alternative so will look into this. All of your input is greatly appreciated, sincere thanks, Stuart
0 Kudos
Message 5 of 5
(2,945 Views)