LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

grouping constants

Solved!
Go to solution

Hi all,

 

I would like to save a bunch of registers addresses (constants) into global variable, so that the addresses will be associated with a name, and I can call them later on.  My question is would I be able to organize a variable like below?

 

Product.function.function2.parameters1?

 

Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 5
(3,069 Views)

Why don't you use a .ini file instead?

 

Ben

0 Kudos
Message 2 of 5
(3,063 Views)

If I use a .ini file, don't I have to read from the file all the time?  I don't want to read a file to access variable.

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 5
(3,056 Views)
Solution
Accepted by topic author jyang72211

I would have two suggestions off the top of my head.  Clusters inside clusters will give you the '.' notation you are after.  You can hide full names to save some space.  What I would do is use a type-def enum constant to index an array of addresses.  Then you use the pull-down menu to select the name.  Either way, overuse of long names is a quick way to get bloated block diagrams.  I like a balance between descriptive names and having my LV code look like C++.

 

Regardless of your naming/storage technique cluster, enum, variant, other, I would suggest a 'functional global' aka state machine or action engine instead of the global variable to store the values.  If you want, you can retrieve the values from an INI or XML file the first time, after that, you just retrieve the values from the FG as usual.

 

ClusterExample1.png  

Message 4 of 5
(3,028 Views)
Hello jyang, does the above suggestion help you out?
National Instruments
0 Kudos
Message 5 of 5
(2,986 Views)