11-25-2014 02:06 PM
Hello all,
I am stuck on something that seems as if it should be very straight forward. I have a VI that I am using to generate a blob of ones and zeros being passed to a shift register on a prototype board. I am doing this with 72 boolean switches, which I have placed in a cluster and defined as a typedef.
I want to be able to save the state of the cluster of booleans, so I can read it back in to the VI when it starts, to put the board in the last known state before shutdown.
Is there a way to save the value and label of every switch in the cluster to a file, then write it back on launch of the VI. I have been thwarted many times by data type issues etc, using the standard ini file VIs included with Labview 2013.
11-25-2014 02:10 PM
11-25-2014 02:14 PM
Hi bump,
before I try to answer: havind a cluster containing 72 booleans is a mess. You should rethink your data management/data structure design!
Is there a way to save the value and label of every switch in the cluster to a file, then write it back on launch of the VI.
- You could use LabVIEWs XML functions to save the cluster content to file and load it from file…
- You could get the references of all booleans in the cluster and read the label and the value using property nodes. Save the results to a file. When loading the file you need to program a routine setting the values based on the labels of the buttons…
11-25-2014 02:19 PM - edited 11-25-2014 02:20 PM
I need to be able to do it from inside an executable, and it needs to write the most recent state before the VI is closed. I thought there used to be an option to right click, hit create, select invoke node, then choose make current values default. I can see it on the individual switches, but it isnt available as an option on the cluster of controls.
I dont mind setting it up as an .ini file, since eventually I will want to be able to choose from several different configurations at startup. I am just having real trouble getting those 72 boolean values out in a format that the .ini write VI likes.
Sorry in advance for my newbishness.
11-25-2014 02:29 PM - edited 11-25-2014 02:29 PM
Hi Speedbump,
but it isnt available as an option on the cluster of controls.
IT IS! Right click the cluster border…
I dont mind setting it up as an .ini file
- My first option isn't using the INI file functions…
- The second option could be used to drive the ini file functions as you now have key value pairs (control label and its value)…
11-25-2014 02:54 PM
I have experimented a bit with the XML functions, and I can use the "value" property node to write an XML file with the switch values and names. I have attached that file. All I did was use the Write XML file VI, and ran the "value" property node of the cluster into the flatten to XML VI, then to the write XML VI. When I try to unflatten the data from the attached file and feed it back into the cluster I get errors...I feel like we are getting close.
11-26-2014 01:53 AM
11-26-2014 07:42 AM
Here is what I ended up with, (at least as far as testing goes). Thanks for your answers, they helped me get where I needed to go.
11-26-2014 08:17 AM
The MGI toolkit (available in VI package manager) contains VIs for saving/loading front panel control/indicator state to an INI file.