LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Value:Get Method doesn't work

I am using labview 8.2, and I am trying to access controls and indicators from a sub-vi that I ran.  I created a reference to a sub vi and then used "call by reference node" to run the vi.  Then I am taking that reference to the sub vi and using the invoke node to invoke  "Ctrl Val.Get" and I never have any data there, it is the default values.  The actual data doesn't appear.   If I take that same vi reference and also put it into a sub-panel the sub-vi looks perfectly fine and all the data is there.  What am I doing wrong that wont allow me to access the controls or indicators?
 
I also included a sample program that demonstrates the issue.  If you run main.vii and hit the button "run sub-vi" no data will appear in "all control values" even though you can see it in the sub panel. 
 
Thanks.
Brad Remenak
Certified LabVIEW Architect
Download All
0 Kudos
Message 1 of 5
(2,808 Views)

Another problem I found with using sub panels, is the sub vi doesn't show any data in it unless you do some sort of property method on a control.  For instance in my sample code if you delete the code block in the subvi.vi that sets the control "num" visible to true, and run main.vi like before, the sub panel will show the subvi in it but there will only be default data in the subvi.

Thanks,

Brad Remenak
Certified LabVIEW Architect
0 Kudos
Message 2 of 5
(2,797 Views)
remenak,

regarding your vis, you should definetly make some serious rework.....just the two most important hints:
1) Never open a reference without closing it afterwords.
2) Do not overuse variables; in your case: locale variables.

Regarding your question:
If you work with not strikt definitions of references, it will work.

Additional note:
I completly do not understand your issue. The way you are using VI server in you example is (sorry to say that) nonsense. If you choose to run VIs via VI server, you want to unload them as soon as possible (by closing the reference).
Another point is that you should work with wire-connections, not with references/variables and property nodes. This is a) a mayer risk for errors and b) could slow down your application by a serious amount (roughly about 100-1000). Since you already accessed the returnvalue of the subvi (i dont understand why you did this with the variable....) why dont you use this in the further programming?


Well, i hope that i am not too harsh with my post, but i get a bit angry everytime when someone uses methods/structures not supposed to be used in those ways and then they are asking: why does it not work or does not deliver the expected performance....

hope this helps anyways...
Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 5
(2,792 Views)

These vi were put together to show my error, they are not my main application or what my main application is. And yes there are errors in the way it is written.

 

Back to my question... To get the control values you can not use strict type references?  And what I am trying to do will never work?

 

Why do you want to unload references as soon as possible?  What if you wanted to use them later on in the program, and closed them later?

 

I am accessing the returned value, but again this is an example to show the problem.  And since they are strict tyope variables, what if I wanted to access a different variable that wasnt returned?

Brad Remenak
Certified LabVIEW Architect
0 Kudos
Message 4 of 5
(2,787 Views)
The best way to pass data between VIs is usage of functional global variables. These are special VIs most often just for containment of data. Perharps you should take a closer look into them.

regarding your unload-question:
Either you include the VI statically in your application or you use VI server to load them dynamically. If you use VI server, you do this for conservement of memory. If you dont unload the VIs after use, you dont free the memory, you do not conserve memory.
The only application where you dont use VI server to conserve memory is if you load VIs from llbs from an exe. This can improve code-variability if you have to use different modules.

hope this helps,
Norbert
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 5
(2,779 Views)