LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to Global Variables within XControl does not work

I try to access a global variable or a functional global VI within a XControl. But there seems to be no Connection. Is it working with an own adress Space. How can I access my functional global VI, that I already have filled with data within my main VI.
0 Kudos
Message 1 of 16
(4,504 Views)
Hi ATW

XControl runs in a context different from other VIs, so (functional) global variable access is not available.
An other solution could be the communication via shared variables.

Stefan
Message 2 of 16
(4,484 Views)

I have created an XControl with a Functional Global in it.  I was storing a reference data type in the SR of the FG for use inside other instances of the XControl.  This FG was only to be read internal to the XControl - not in code calling the XControl.

 

If the XControl is used in a main VI and also sub vis placed on the main VI block diagram the information from the XControl FG is available within all instances of the XControl.

 

If I call a subVI dynamically that is when I see the Facade have the correct value showing on the XControl (which means it is reading SOMETHING from the contained FG) - but the actual reference value out of the XControl is 0.  The numerical value part of the data does get read out of the internal Functional Global but it seems like the actual reference value is lost. 

 

Interestingly when I put a probe on the refnum wire out of the Open VI Reference.vi when calling my subVI - that magically makes the FG values read from the shift register valid in the instances of the XControl on the dynamically launched VIs.

 

Should a FG work internally to an XControl?

Message Edited by RVallieu on 04-22-2009 08:38 AM
Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 3 of 16
(4,282 Views)

ok - I found that if I drop a Reinit to default Value on the block diagram of the dynamically called subVI that sets the XCtl to Default (thus firing some events not sure which?) in the Facade VI that the instantiated VI then gets the correct value out from the XControl....

 

This means to me that the FG value is being stored properly - but that I migth be reading it in the wrong spot in the case where VIs are dynamically loaded.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 4 of 16
(4,271 Views)

I tried taking the FG reads and putting them in the Timeout case in the Facade VI since this ALWAYS occurs when they XControl Facade VI is called into action.

 

This did not work.

 

HOW/WHY does an XControl load/react differently when a VI is dynamically loaded vs when you open it from within the project by double clicking on the VI?

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 5 of 16
(4,261 Views)

Re the above Qs by Ryan.

 

Yes I work with Ryan and we are getting lost in the complexities of the XControl.

 

He has exausted my knowledge so I hope someone with a good undrstanding of the XControl and which events fire under which conditions can help us out.

 

I can only offer my humble thanks for helping us out (and a bunch of Kudos if you want them).

 

Thank you!

 

Ben

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

I have found that the Facade VI is firing the Data Change event (at least) when the Dynamic VI is opened.


The FG internal to the XCtl is passing out the value on the block diagram of the Facade correctly - the Data Changed? flag is being set to true.

 

However the value output by the XControl is not correct on the calling VI.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 7 of 16
(4,254 Views)

Another data point:

 

When I make the VI that is called on the Main VI block diagram reentrant and put a couple copies on the calling VI block diagram - the reentrant VI copies of the XCTl work properly

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 8 of 16
(4,251 Views)
I could not replicate using the Reinit to Default Value making the XCtl work - trying it again - must have been something else, like I left the VI FP open.
Message Edited by RVallieu on 04-22-2009 10:27 AM
Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 9 of 16
(4,249 Views)

RVallieu wrote:

Another data point:

 

When I make the VI that is called on the Main VI block diagram reentrant and put a couple copies on the calling VI block diagram - the reentrant VI copies of the XCTl work properly


 

Sorry - I was wrong - reentrant VI did not work.  When I stopped the main VI and then restart that is when the reentrant VIs Xctl works properly.
Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 10 of 16
(4,244 Views)