LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How does references work in Labview?

For some reason when I use references in Labview, the execution slows down considerably.  How does this reference work?  Specifically, at the memory level.  The most obvious is that the reference is a pointer to that location but, it makes no sense to me as why it slows down the execution process.  The only way around this is that I have to use globals...which I haven't tried yet.  Can someone please explain.
0 Kudos
Message 1 of 8
(3,613 Views)

References are not pointers to memory blocks or to variables, but to front panel objects. Using references and property nodes to read and write the values of controls forces LV to execute the code in the UI thread, which makes it slower. Additionally, it forces LV to update the display, making it even slower.

There are several methods for communication between different VIs such as globals, LV2 style globals (also called functional globals and several other names), queues, notifiers and some others. It is important to note that since LV doesn't have variables in the classic sense (the wires serve as the variables) you should be careful to avoid race conditions. Searching for "globals" or "lv2 globals" should give you some more details.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
Message 2 of 8
(3,608 Views)

TST,

I've been wondering why the functional globals are also referred to as "LV2" globals?  Is this a concept that was introduced in Labview 2.0?  Or does it refer to something else?

0 Kudos
Message 3 of 8
(3,594 Views)


@Ravens Fan wrote:

Is this a concept that was introduced in Labview 2.0?


That's exactly the reason.

The "official" name is usually either LabVIEW 2-style global or Uninitialized Shift Register global.


___________________
Try to take over the world!
0 Kudos
Message 4 of 8
(3,583 Views)
P.S. Your posts seem to be good. Keep it up.

___________________
Try to take over the world!
0 Kudos
Message 5 of 8
(3,577 Views)

Tst,

Thank you for the compliment.

I started with LV 7.1 about a year and a half ago with Basics 1&2.  I took Int. 1&2 about 6 months ago.  It amazes me how powerful of a programming language LV can be.  I've found this forum to be of a very high quality, and the enthusiasm of you and the other "high bar" people is impressive.  I feel like I am able to learn a lot of new concepts by perusing the threads whenever I can.

I'm sure it won't be long before you get that new red bar in the middle.Smiley Happy

-Bill

Message 6 of 8
(3,569 Views)


@Ravens Fan wrote:

I've been wondering why the functional globals are also referred to as "LV2" globals?  Is this a concept that was introduced in Labview 2.0?  Or does it refer to something else?


I am no historian, but I thought that LabVIEW 2.0 did not have support for global variables as we know them today, so you had to manually implement their functionality in code. The easiest way being something we now call a LV2 style global.

(Maybe I am wrong. I started with LabVIEW 4.0. Any clarification would be welcome.) 😉

0 Kudos
Message 7 of 8
(3,549 Views)
That's right, Christian.  Globals as we know them today were introduced in LabVIEW 3.0.
 
-D
Message 8 of 8
(3,541 Views)