LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reference to a type

Hi,

 

I have created a subvi which I now use in my main VI, however, I now want to use the values from the subvi WITHOUT having to have a control in my main VI.  I can't seem to find a tool to convert a reference to a type.

 

Anyhelp would be much appreciated.

 

Thanks,

Paul.

0 Kudos
Message 1 of 19
(4,828 Views)

Hi Paul,

can you not take a constant? You have to wire the SubVI to start it. If you like to transfer values to a started SubVI, you can take local or global variables for example.

 

Regards ThomasD

0 Kudos
Message 2 of 19
(4,805 Views)

Hi,

Thanks for your prompt reply.

When I try and connect my subvi to a variable I receive the following error

"A wire must be connected to one and only one data source, such as a control's terminal or a function output. This wire is connected to two data sinks but zero sources. You must add a source, perhaps by changing an indicator to a control."

I need to convert the reference type outputted by my subvi to a type (i.e. string, integer, etc) than I can use it without the need for a reference from a control or indicator.

 

Thanks again,

Paul.

 

0 Kudos
Message 3 of 19
(4,799 Views)
If, in your subVI, you are using a value property to write to a reference, at the input to the value property, right click and select Create Indicator. If, in your subVI you are using a value property to read from a reference, at the output of the property node, right click and select Create Control. Delete the wire from the value property and wire your control to where the property output was. In either case, you should wire the control/indicator to the connector pane in order to pass/get the value from a main.
0 Kudos
Message 4 of 19
(4,790 Views)

Hi, thanks for your reply.

When I connect the indicator or control in the subvi to the connector plane, the value from the mainvi does not get passed down in run time, hence why I used references.  Is it possible to dereference (as such) the reference?

 

for example

SUBVI ->passes value to main -> change reference to a type (boolean, integer) -> to a case statement in main vi WITHOUT a control or indicator

 

Thanks again,

Paul.

Message Edited by bigdave on 11-07-2005 02:21 PM

0 Kudos
Message 5 of 19
(4,784 Views)
If you wire something from the main VI to the subVI, it will get passed to the subVI. If you expect to pass a new value from main to a subVI while the subVI is running (i.e. it's got a while loop running), that is not how a subVI or a function call in any other programming language works. To pass a new value once a subVI has started and before it returns to main, you have to use a reference or a global variable.
0 Kudos
Message 6 of 19
(4,777 Views)

Hi Dennis, thanks again for your reply,

 

This is exactly what I have done, use references.  In the main vi to access this reference you must then create a control or indicator, then right click and create a reference, then link this reference to the subvi. 

 

I don’t want to have to create an indicator or a control… I just want to use the value outputted by the subvi.

 

Thanks,

Paul.

Message Edited by bigdave on 11-07-2005 03:03 PM

0 Kudos
Message 7 of 19
(4,770 Views)

Hi again,

 

Just to let you all know, I found the "hide" function on the indicators and controls, so I create my controls, then a reference so that I can get the values in/out of my subvi, then hide the controls and connect up the references.  Very poor way of doing what I want, but it works.

0 Kudos
Message 8 of 19
(4,744 Views)

Hi Bigdave,

It sounds you are approaching this in a manner that is not consistant with how LV is intended to operate.

Please post a zip of your top level and sub-VI's so we can look and advise.

We are very good if we have pictures to work with!

Trying to get you started out on the right foot,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 19
(4,741 Views)

Hi Ben,

I have included a simple VI of what I would like to achieve.  Any questions just ask.

Please keep in mind that this is a simple model of what I would like to do.

 

Thanks again,

Paul.

 

Message Edited by bigdave on 11-08-2005 12:13 PM

0 Kudos
Message 10 of 19
(4,734 Views)