LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve the saved parameters simply?

Hi all,

I'm programming for my machine with LabView. The machine has motorized stages. Each stage has quite a few positions (parameters), which needs to be saved in hard-disk. It's like non-volatile registers. When my program is running, from time to time, these parameters needs to be loaded or overwritten. Is there a quick and simple way to implement this?

Originally I was thinking the Global variables can solve this, but it turns out once I shut down the program, the value stored in the global variable gets reset. So global variable can't do this job.

Of course I can store all these values in a spreadsheet and write a sub-routine to parse the data inside this spreadsheet. But this will be pain of the neck since there are quite a few parameters. I'm wondering whether there is simpler solution.
0 Kudos
Message 1 of 10
(3,594 Views)
By the way, every time the parameters are loaded, I was planning to load them into various controls.
0 Kudos
Message 2 of 10
(3,585 Views)
You can develop you idea of using a global variable : save all the controls in a single operation.
How to do that ? Get the references to all controls on the global FP, then read and save all the corresponding values. This is a comfortable solution since you don't have to bother on the number/type of controls.
Of course, the reverse operations restore the saved values.
See the attached example.

CC
Chilly Charly    (aka CC)
Message 3 of 10
(3,585 Views)
The configuration toolkit was developed for exactly this purpose. It's under "Downloads" on my website.
Yours Sincerely
John www.tradersmicro.com
0 Kudos
Message 4 of 10
(3,574 Views)
I'd take a cluster for all your parameters and write it to disk and read it back using the XML functions. Use a (strict) typedef for this cluster and you'll use the same types anywhere anytime. You may just get an error reading an old parameter file after changing something in the typedef, but that's rather good. (Actually I like using the XML functions for saving arbitrary data types. You just have to make sure to load a file into the same type of data from which you saved it, but you can read and write anything you want...)

Carsten
Message 5 of 10
(3,563 Views)
CC,

I'm using LabView7.0, so when I tried to open your code, I got an error message. Can you save your code in 7.0 format or below and repost it again? Thanks!
0 Kudos
Message 6 of 10
(3,554 Views)
Hi Terp!

As always, great answer by CC! I have down-converted the VI from LabVIEW 7.1 to LabVIEW 7.0. As CC explained, the VI grabs a reference to the global variable and then an array of references to controls in the global variable. Using a for loop and File I/O you can save or restore values to these controls fairly painlessly. This also is a nice way to group all of your data values that you want to manage.

Hope this helps!

Travis H.
National Instruments
Travis H.
LabVIEW R&D
National Instruments
Message 7 of 10
(3,552 Views)
Thanks, guys!!
These (CC's solution and TH's conversion) are exactly what I want!!!
0 Kudos
Message 8 of 10
(3,547 Views)
BTW, in OpenG some VI's to do that are included (Write Panel to INI, Read Panel from INI).

Carsten
0 Kudos
Message 9 of 10
(3,530 Views)
Thanks for doing the job ! I missed Terp post-back. It will take some time for some oldtimers to get used of the new user interface.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 10 of 10
(3,528 Views)