LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

property nodes vs reference

Gurus,

 

Attached is a simple program that does nothing but illustrate my questions. What is the difference between changing/updating information/variables etc by reference and by property node? And which should be used under what circumstances? I have some controls/indicators that will be updated from several locations, sometimes disabled/enable and sometimes blink, so I am using a variety of properties for a single element.

 

Having looked at the help pages, I am confident I understand the difference between property nodes and local variables.

 

"When I read about the horrors of drinking, I gave up reading"
0 Kudos
Message 1 of 5
(4,843 Views)

Hi,

 

the behaviour of a reference is difference from the behaviour of a property node. You can use property nodes to change attributes of a control, like blinking, color etc. You have to use a reference to a control if you want to access these properties from another vi. You can pass a reference by a connector pane to another vi, wire it there to a property node and access the properties of a control which is not part of the active vi. 

 

Hope this helps,

 

Christian


THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
Message 2 of 5
(4,819 Views)

Yeah, it does.

 

So a reference it is a bit like a global variable but with the bonus of changing more than just the value?

 

Does the reference option have any similarity to pointers in other languages?

 

"When I read about the horrors of drinking, I gave up reading"
0 Kudos
Message 3 of 5
(4,810 Views)

 


the behaviour of a reference is difference from the behaviour of a property node. You can use property nodes to change attributes of a control, like blinking, color etc. You have to use a reference to a control if you want to access these properties from another vi. You can pass a reference by a connector pane to another vi, wire it there to a property node and access the properties of a control which is not part of the active vi.

 

 

Nice and crisp explanation. 

0 Kudos
Message 4 of 5
(4,797 Views)

Manc Pablo wrote:

Yeah, it does.

 

So a reference it is a bit like a global variable but with the bonus of changing more than just the value?

 

Does the reference option have any similarity to pointers in other languages?

 


Yes, but don't get caried away!

 

Refernces to controls are like file references where they are a number that lets the environment located a resource. But as you may have seen if you share a ref to a file across multiple threads, there are possiblities of race conditions if the access to the resource is not protected in some way. LV protects the resource by using the UI thread (single threadded) to help but if you don't pay attention to reace-conditions you will run into trouble.

 

But now to the critiacl point.

 

Many converts to LV get the idea that locals (or control references) in LV are like locals in C and use them in a manner similar to what is typically done in text languages as named variables. Named variables in C are just an easy way to keep track of a block on memory. In LV you do not have to keep track of the memory since LV does this for you. It does this for every wire you put on a diagram. In LV the wires are your buffers, memory locations etc. Or as I believe Christian has written, "The wire is the data." If you would like to keep working with your current schema you can put free lables over your wires while you are making the paradigm shift to the dataflow.

 

Controls and indicatrs should not be used for storing or sharing data except in the most simplistic cases. Use your wires to move data from operation to operation. If the data is to be shared, use Functional Globals (also called Action Engines) Queues, etc.

 

I hope I am not sounding preachy with this post. I just want to make sure you don't make the mistake I did when I converted from C to G.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 5
(4,795 Views)