Go to Post The toughest regional is always the one you are competing in! - AcesPease [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-03-2011, 12:19
sheleski sheleski is offline
Registered User
None #0910 (Foley Freeze)
Team Role: Programmer
 
Join Date: Jun 2010
Rookie Year: 2009
Location: Madison Heights
Posts: 8
sheleski is an unknown quantity at this point
Question Device Get References - Best Practice Question

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
Reply With Quote
  #2   Spotlight this post!  
Unread 10-03-2011, 12:43
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-03-2011, 06:49
Doug Norman's Avatar
Doug Norman Doug Norman is offline
Registered User
no team (National Instruments)
Team Role: Engineer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Austin, TX
Posts: 134
Doug Norman will become famous soon enoughDoug Norman will become famous soon enough
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.
__________________
Doug Norman
National Instruments
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 04:12.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi