LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I obtain a reference to a global variable?

The problem in a nutshell is that I can only access the value of a global variable, but not the properties. With a reference, I can access the properties through a property node.

Martin
0 Kudos
Message 11 of 18
(2,271 Views)
I would use a functional global instead (generally better than ordinary globals). That global could also hold the reference to the listbox however instead I would just add a method to the func.global that gives you read and write access to the listbox contents.

Since it is a global though I would perhaps skip the listbox alltogether though and have a string array, a selection array etc. in the functional global. Then you can read the contents without involving property nodes every time and read it all and present it as a listbox only where that is needed.
Message 12 of 18
(2,041 Views)
I have searched quite extensively in the LabView documentation and on ni.com to find out more about functional globals, but the information is very sparse. Maybe it's just me overlooking something, but at first sight, it looks simply like a normal subVI with uninitialized shift registers. I can of course make such a VI, but it does not automatically have the "Skip subroutine call if busy" in the context menu. How do I tell LabView to perceive this VI as a functional global? Or is this "Skip subroutine call if busy" a feature of version 7 (I use 6.1)?

Martin
0 Kudos
Message 13 of 18
(2,041 Views)
There is no way to tell LV that it is a global, it's not - it's as you say a VI with uninitialized shift registers.

Why would you want to skip the call? One of the good things about func.globals is the fact that they are VIs; if you try to write to it and it's busy the code will wait the microseconds it takes and then access it. If you add error IO you can use data flow to ensure execution order etc. And you can add all sorts of functionality inside it, much like an object with different methods.
0 Kudos
Message 14 of 18
(2,040 Views)
There seems to be cases where you want to skip the call, see Improving Determinism with Functional Globals, LabVIEW 2-Style Globals, in LabVIEW Real-Time - one of the few documents I found about the topic.

But thank you for your answers - standard globals have long been a source of annoyance, since you often want to at a little functionality to them. I only discovered functional globals last week, even though I have been programming LabView since version 3 🙂

I would still like to find the answer to the "Skip the call" part, though...

Martin
0 Kudos
Message 15 of 18
(2,040 Views)
Hi,

If you set the Execution priority (in the VI properties) to subroutine,
you'll get the option "skip subroutine..." when you right click the sub vi
from a diagram.

regards,

Wiebe.

"MartinManscher" wrote in message
news:506500000005000000FA6F0100-1079395200000@exchange.ni.com...
> There seems to be cases where you want to skip the call, see
>
HREF="http://zone.ni.com/devzone/conceptd.nsf/webmain/82E60E34E609C22A862569
F8007E3F4A?opendocument...

- one of the few documents I found about the
> topic.
>
> But thank you for your answers - standard globals have long been a
> source of annoyance, since you often wan
t to at a little functionality
> to them. I only discovered functional globals last week, even though I
> have been programming LabView since version 3 🙂
>
> I would still like to find the answer to the "Skip the call" part,
> though...
>
> Martin
0 Kudos
Message 16 of 18
(2,040 Views)
Thanks - that was the last bit of the puzzle for me 🙂

Martin
0 Kudos
Message 17 of 18
(2,040 Views)
Gee, thanks folks. I know that it's a kind of messy way to do something like that, but it works (even if it takes a bunch of clock cycles). For myself, in the long run I'd probably use a functional global.

I thought about it afterwards and wasn't sure that I'd put the example together correctly. I tossed it together in the last couple of minutes before leaving for a funeral. I must use LabVIEW too much since I thought about this example a couple of times during the service.

I wonder if other people have LabVIEW thoughts while supposedly doing other things. Should we set up a poll?

Rob
0 Kudos
Message 18 of 18
(2,040 Views)