11-08-2005 12:22 PM
11-08-2005 01:46 PM
11-08-2005 02:20 PM
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.
11-08-2005 02:26 PM
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.
11-08-2005 02:57 PM
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.
11-08-2005 07:56 PM - edited 11-08-2005 07:56 PM
Hi BigDave,
"At this point I don't think labview has the facility that I want. " You are dissin my sweatheart (LV)
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.
Message Edited by Ben on 11-08-2005 08:01 PM
11-09-2005 01:20 AM
11-09-2005 08:31 AM - edited 11-09-2005 08:31 AM
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
11-09-2005 08:46 AM