|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||||
|
|||||
|
Re: Device Get References - Best Practice Question
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.
|
|
#3
|
||||
|
||||
|
Re: Device Get References - Best Practice Question
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. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|