wannabecontroller Posted May 11, 2019 Report Share Posted May 11, 2019 I find this hard to believe. I am unable to find any documentation on the web including youtube on what the heck a refnum is Can someone please point me towards some documentation or perhaps a quick explanation? Thanks in advance Quote Link to comment
LogMAN Posted May 11, 2019 Report Share Posted May 11, 2019 Disclaimer The following details are oversimplified for the sake of clarity. Feel free to point out important details that aren't covered by this post. --- There is a higher chance of finding better results by searching for "labview reference". Here are a few examples. https://labviewwiki.org/w/index.php?search=reference&title=Special%3ASearch&go=Go https://labviewwiki.org/wiki/Control_References http://www.ni.com/example/28769/en/ That said, you should be familiar with the normal data flow in LabVIEW. Data goes from one end of a wire to the other. A branch in the wire will create a copy in memory if either branch of the wire is changed. Loosely speaking, a wire represents the data. A refnum on the other hand doesn't represent the data, but the location of the data in memory (*). It is similar to a pointer in C-like languages. This changes the behavior of the wire Data still goes from one end of a wire to the other. Each branch of a wire receives exactly the same value as the other (no copy is made). (**) In order to access the data you need to make use of Property Nodes, Invoke Nodes and more. The benefit is, that you can access the same value from different places in your program. Even better, this is not limited to controls. It works for controls and indicators, VIs, objects, the project, the whole application and everything. https://labviewwiki.org/wiki/Refnum http://zone.ni.com/reference/en-XX/help/371361R-01/lvconcepts/controlling_front_panel_objects/ However, it doesn't work for variables and due to its nature, race conditions can occur if you don't take care of the execution in your program. This is why for variables there is a more specialized type of reference, the data value reference (DVR). It allows you to access the same variable in memory from different places in your program. http://www.ni.com/product-documentation/9386/en/ There is obviously much more to it than these few points. However, the links above should give you some insight. (*) Here is some information about the memory structure of a refnum. https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019ZT5SAM&l=en-US (**) Technically speaking a copy is still made if you change the "value" on either branch of the wire, but since it is a pointer you shouldn't change it under any circumstances. 1 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.