10-08-2008 08:57 AM
hey,
I have a VI that loads header files. There are two kinds of header files.
1) it's build up like a INI
2) it's flattened to string and therefore not human readable
I need to create a human readable header file of the second header file, but I have little experience with LabVIEW and I don't understand whats going on this VI.
I'm only concernded about the part that uses ReadConfigFIFOComplex.vi
It would be great if someone could explain shortly what's going on especially in ViewFIFOSet and ReadConfigFIFOComplex.
If someone has an idea how I can create a human readable file out of this read in data. Please tell me. I don't know where to start...
10-08-2008 09:31 AM
dwoerner wrote:I need to create a human readable header file of the second header file, but I have little experience with LabVIEW and I don't understand whats going on this VI.
I don't blame you. The VIs are poorly written and not a good example of how to write good code. It seems that the "LoadHeader" VI simply opens the INI file and then calls the ViewFIFOSet VI with "action" set to "set". This subVI makes an attempt at reading the flattened string and converting it using the "ReadConfigClusterComplex" VI first. If this fails, then it resorts to using the "ReadConfigCuster" VI. Perhaps the cluster changed format over time? The read information is displayed on the front panel array of "FIFO Settings". The "ViewFIFOSet" VI seems to have been written with the intent of performing other operations, though it's not clear if these operation were finished, as some of the code looks like a dead end. It's not also not clear to me what the difference is between each of the 4 controls that are all called "FIFO Settings". There's an additional hidden indicator called "FIFO Settings (Array)". Of course, the visible array of "FIFO Settings" is also an array, so they must have had a "special" definition of array controls.
Like I said, probably unfinished code.
The easiest way to create a human-readable version of a complex cluster like the "FIFO Settings" cluster is to use the Flatten to XML function. This is in the String -> XML palette. This will provide a human-readable XML file that uses the LabVIEW schema. A small sample of converting a single "FIFO Settings" cluster to a string looks like this:
<Cluster>
<Name>FIFO Settings</Name>
<NumElts>5</NumElts>
<Cluster>
<Name>Measurement</Name>
<NumElts>7</NumElts>
<SGL>
<Name>Binning (ms)</Name>
<Val>0.00000</Val>
</SGL>
<U16>
<Name>External Trigger Condition</Name>
<Val>0</Val>
</U16>
<U16>
<Name>Stop Condition:</Name>
As you can see, this is quite readable.
10-09-2008 04:57 AM
Thanks
yeah, I think XML is a good choice. I still don't understand many parts of the VIs but I'm going forward in extracting the parts I need.