LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing and reading a machine configuration file

I need to have motion control constants loaded once during a start-up so that I could keep them during the entire operation of my LabVIEW driven control system. However, I do not want it reloading again when I stop the VI and run it again. How do you make LabVIEW remember that the constants has been loaded at start-up and does not to be reloaded again when ever I re-run the same program?
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 1 of 7
(2,962 Views)
Use two UNINITIALIZED shift registers in your main loop.
#1 is a BOOLEAN.
#2 is a cluster with whatever file data you want to have.

If #1 is FALSE:
READ file
STORE data into #2 Shift Reg.
Set #1 Shift Reg. to TRUE
else
Pass #1 thru unchanged.
Pass #2 thru unchanged.
end if
....
Use constants from #2 Shift Reg...


The uninitialized Shift reg will default to FALSE the first time up, so you read the file.

But the next time you run it, it will still be TRUE, so you won't.

If you do major program changes (forcing a re-compile of the main loop) you will re-load the file, but for minor changes, you won't.

Another way would be to store them in a global. Give item "A" of your cluster an oddball default value ("-Inf", for exam
ple) that should never be in a legitimate configuration.


If item "A" of you cluster is equal to your oddball value, then read the file into the cluster.
If it isn't, don't.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 2 of 7
(2,962 Views)
Hello, this was a fast reply! Thanks.I however,have a hard time visualizing the pseudocode above can you send a suggestive VI implementation of the idea above? I would appreciate it very much and thanks again.
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 3 of 7
(2,962 Views)
The idea is to use the DEFAULT value of something as a signal that you haven't read the file yet.

Suppose you want to read values for constants A,B, and C.

Set the DEFAULT value for the place you store 'A' to be something you won't encounter in legitimate configurations, like "-Inf", for example.

When you start your program look at the value of 'A'. If it's equal to -Inf, you need to read the file, and store new values for A,B, and C.

If A is NOT equal to -Inf, then DON'T read the file. A,B, and C are leftover from the previous run.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 7
(2,962 Views)
Attached is a simple sub vi on how to perform what you want. The first time the sub vi is called, the shift register defaults to false and the false case is executed. Here is where you want to load your constants. Also the shift register is forced to true. The next time it is called, the shift register remembers that it was true after the last time it was run and the true case is executed, meaning nothing happens. Call this sub vi in your main vi. Your constants will be loaded the first time you run your main, but never again until you either quit Labview or close your main, and start again.
- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 7
(2,962 Views)
Amazing works like magic! Thanks. It will be good remember what is the state of uninitialized register is at start-up!
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 6 of 7
(2,962 Views)
Got this thanks to TBOB.
Bernardino Jerez Buenaobra
Senior Test and Systems Development Engineer
Test and Systems Development Group
Integrated Microelectronics Inc.- Philippines
Telephone:+632772-4941-43
Fax/Data: +632772-4944
URL: http://www.imiphil.com/our_location.html
email: Bernardino.Buenaobra@ph.global-imi.com
0 Kudos
Message 7 of 7
(2,962 Views)