11-07-2006 11:24 PM
11-07-2006 11:54 PM
11-08-2006 01:00 AM
11-08-2006 01:21 AM
11-08-2006 01:34 AM
11-08-2006 02:19 AM
11-09-2006 06:08 AM
hi,
I am able to pass the data from the main VI to sub VI using reference. but, i don't know how to send data from sub VI to Main VI using reference. if it is not possible can u suggest me any other way of doing this.
-Visswa
11-09-2006 11:31 AM
Create an indicator in main vi. Right click on indicator and click on Create - Reference. The reference appears on the block diagram.
In your subvi, create a Control Refnum on the front panel. In block diagram, right click on Ctl Refnum and select Create -> Property -> Value. Right click on Value property and select Change to All Write. Wire Ctl Refnum to top terminal of Value property. Wire whatever indicator you want to transfer to main to the value property through a To Variant function. On front panel, wire the Ctl Refnum to a terminal in the connector pane. Save subvi.
Back in main, add your subvi on the block diagram. Wire the Reference to the subvi connector pane terminal for the Ctl Reference. Whenever the subvi is run and the indicator data changes, you will see it change on the main front panel indicator.
According to NI, Labview has no pointer data type. But the Reference is just that, a pointer. By passing the pointer of your main indicator to the subvi, and changing its value there, the subvi is writing to the same memory location as the main vi indicator, so it shows up instantly in main.
09-26-2007 02:58 PM
09-26-2007 05:50 PM - edited 09-26-2007 05:50 PM
Almost a year has past since my last post and your new one. Were you on vacation that whole time?![]()
You said that you got it working last week, and now after files were moved it doesn't work anymore. Put the files back where they were. The main vi has to know where the subvi is. I would need to see your code to see how you call the subvi. If you call it by reference, and you have moved the subvi, you have to change the path of the subvi in the main.
If you call the subvi by its icon, and you move the subvi, the icon should be a grey question mark if the main can't find it. Then you have to right click and select Replace, and find the subvi. If the icon looks OK but is grey, right click on it and select Relink to Subvi.
Message Edited by tbob on 09-26-2007 03:53 PM