LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

#defines in LabVIEW

In the proces of converting a piece of C++ - code into LabVIEW (6.1)
I ran into a problem:
The C++ code contains a lot of "#define" variables which I have to use.
In the LabVIEW program I want to use the variable-name in stead of its
numeric value
to improve the readability of the LabVIEW code..
I was thinking of using an enumerated list of variable-names , problem is
that the value
corresponding with the variable-name cannot be set , it is always equal to
the item-number of the
variable-name in the enumarated list.

Does anyone have an idea how to use these variable-names in a user-friendly
manner as C-code does ?

Any help is appreciated ,
thanks in advance ,

René Ramekers
the Netherlands
0 Kudos
Message 1 of 7
(4,021 Views)
Hello René,

you can use your approach, if you have an array of the values of those defines. Then you can index the array with the item-number of the define. This way all defines have to use the same data type.
You can also use a global variable for each #define. Then you can use different datatypes for your defines.

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(4,021 Views)
Hi Rene,

Why don't you use the "Ring constant".
Goto edit items -> switch of "sequential values" -> now you can give each item a number you want!

You also have more representation options!

BJK
Netherlands
0 Kudos
Message 3 of 7
(4,021 Views)
Seems to be what I was looking for ,
only I can't find such an option in LabVIEW 6.1 ,
or am I overlooking something ??

René

"BJK" wrote in message
news:50650000000500000087D50100-1079395200000@exchange.ni.com...
> Hi Rene,
>
> Why don't you use the "Ring constant".
> Goto edit items -> switch of "sequential values" -> now you can give
> each item a number you want!
>
> You also have more representation options!
>
> BJK
> Netherlands
0 Kudos
Message 4 of 7
(4,021 Views)
The method of BJK is new in LV 7.0, so it will not work in LV 6.1.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 5 of 7
(4,021 Views)
Sorry Rene,

Waldemar is right!
I didn't realized that the "Ring constant" was changed in LV 7.0

BJK
0 Kudos
Message 6 of 7
(4,021 Views)
Look at the configuration toolkit in www.tradersmicro.com. It tackles exactly this problem, namely making variable values accessible by variable name.
Yours Sincerely
John
0 Kudos
Message 7 of 7
(4,021 Views)