|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Using Global Variables Instead of Get Refnum
Is it possible to use a global variable to store the registry refnum for the motors/sensors etc. instead of the refnum get vi?
It can make things a bit easier and prevent stupid name typo mistakes. |
|
#2
|
|||||
|
|||||
|
Re: Using Global Variables Instead of Get Refnum
It's certainly possible to use global variables to store RefNum values. The first year of the NI control system, it was normal to do it that way.
Two years ago we discovered a big drawback to not using the RefNum Registry, though. That's the mechanism that lets Test mode work to give you manual access to all the robot inputs and outputs that you use. So we use sort of a hybrid scheme, where we do a RefNum Set in Begin.vi, and also keep the RefNum in another place for easier and less typo-prone access. |
|
#3
|
||||
|
||||
|
Re: Using Global Variables Instead of Get Refnum
One way some teams do this is by creating a typedef enum updated with a list of all their RefNum names. Then they simply drop that enum followed by the Format Into String function any place they need a RefNum name. It's a bit of extra code, but makes it so they don't have to remember the names or correct spellings - they simply pick it from the enum list.
|
|
#4
|
|||||
|
|||||
|
Re: Using Global Variables Instead of Get Refnum
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|