LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reference to a type

The change the reference passed from the main vi to the subvi is a control (this is correct). Change the ref passed back to the main vi from the sub vi to an indicator. This should fix your problem.
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 11 of 19
(1,397 Views)
Could you take a look at the image attached?
 
Thanks.
0 Kudos
Message 12 of 19
(1,377 Views)

Sorry, my bad.  I would just pass the value back and forget the references.

Instead of passing the Reference back to the main vi, create an indicator in the sub vi for the value you want to pass. Connect that to a terminal the output of the subvi and that will pass the value to the main.

 

See attached pics.

 

 

Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
Download All
0 Kudos
Message 13 of 19
(1,369 Views)

Unfortunately I have to use references because I need the value to update in real time.

 

At this point I don't think labview has the facility that I want.  To get around this I have used a control and hidden it.

0 Kudos
Message 14 of 19
(1,364 Views)

Don't give up just yet. Here is how you do it with references. You need to create an indicator for the reference you want to pass back to the mainvi.

 

See attchments.

Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
Download All
0 Kudos
Message 15 of 19
(1,361 Views)

Hi BigDave,

"At this point I don't think labview has the facility that I want. " You are dissin my sweatheart (LV) Smiley Happy She can do most anything.

I am just a volunteer here so I can only get serious about answering Q's at night or on week-ends.

I re-wrote you code to do what I THINK you want.

The top level and sub-VI's are illustrated here.

I pass a reference to the control, the indicator and a stop boolean to the sub-VI.

After that the top level just waits for the sub-VI to complete.

The sub-VI reads from the control, does some math and updates the indicator.

If the stop button is true it stops and returns to the top level VI.

The code is attached.
 
************************************
 
Andrew,
 
You can make you images show up in the posting by posting as you have and then...
 
Click on you link for your attached jpg.
 
Copy the URL
 
Go back to your post.
 
Edit it.
 
Go to the place in the text where the image should appear then click on the "Inset image" button.
 
Paste the jpg URL in the dialog box.
 
Re-post your edited answer.
 
Ben

Message Edited by Ben on 11-08-2005 08:01 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Download All
0 Kudos
Message 16 of 19
(1,354 Views)
Big dave,

What you want to do with your picture below is really unclear to me.  If I have understood correctly what you want to do, it won't work.  I'm also not sure that what you want to do will work in any other language either.

By using a property node, you need a reference.  This you have clearly understood.  However, ask yourself what the reference is TO.  It must be a reference to an object, and the data contained in the reference will in some way be associated with this particular object.  A reference is NOT a class descriptor.  It is a reference to an actual object.

If you want to simply generate a reference to an object, then the object must exist first, otherwise you have a problem.  Other languages may allow such invalid references, but LV does not.  This object is created on the front panel, and can then be hidden.  This is the way LV works, and there's nothing wrong with it.

You MUST have a non-constant object (either control or indicator on the front panel) in order to be able to create VALID references.

Simply create the control you require on the FP, hide it and use this as the source for the reference.

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 17 of 19
(1,332 Views)
Hi Shane,
 


A reference is NOT a class descriptor.  It is a reference to an actual object.


If you want to simply generate a reference to an object, then the object must exist first, otherwise you have a problem.  Other languages may allow such invalid references, but LV does not.  This object is created on the front panel, and can then be hidden.  This is the way LV works, and there's nothing wrong with it.

I know a reference is not a class descriptor, the problem I have is that the only way to dereference this reference is to use a control/indicator then hide that control/indicator.  One should be able to use the "Type Cast" object to simply dereference and type cast the reference from the subvi WITHOUT the need for hiding an indicator/control.  Hiding a control/indicator just so I can get the value out from the subvi is ugly in my opinion.


Simply create the control you require on the FP, hide it and use this as the source for the reference.

You have answered my question in your above quote,

Thanks for the help guys,

Paul.

Message Edited by bigdave on 11-09-2005 08:34 AM

0 Kudos
Message 18 of 19
(1,320 Views)
Hi Dave,

There are ways of "re-casting" references, but they all require current valid references of a new sort in some way compatible with the old type.  I suppose the crux of the problem is that LV doesn't accept these references as being seperate from the objects as you have already noticed early on.  The only way to actually get AT the references is to have an object........

Catch 22

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 19 of 19
(1,314 Views)