View Full Version : Device Get References - Best Practice Question
sheleski
10-03-2011, 12:19
Since this is my first year as Mentor and using Labview I have a best practice question concern device get references.
Should a device get reference be use once or multiple times with the same vi?
Steven
Alan Anderson
10-03-2011, 12:43
I can't say it's the best practice, but I try not to duplicate things when I can just wire the existing value to multiple places.
Doug Norman
11-03-2011, 06:49
I agree with Alan. The main idea is to use the Set Reference once (typically in Begin.vi). Then use the Get Reference where needed - typically once in other VIs like Autonomous and Teleop. You could use it multiple places in Teleop, but it might eventually make your code harder to read and maintain.
They main reason we introduced the Set Reference and Get Reference was to encourage the use of a single Open VI in Begin.vi. Otherwise we found it was common for teams to use one Open in Autonomous, and then the same Open in Teleop without using a Close first. This would cause errors - trying to open a resource that was already opened.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.