I am writing up a drivers for a residual gas analyzer that communicates with a host computer with binary strings via RS232-C. The communication is based on the SEMI E4 communications protocol. In short there are many tasks that are accomplished by transmitting (after handshaking) blocks of data comprising multiple data types (U8, I8, U16, U32, SGL) that have been flattened into binary strings. There is not a standard format for any of these blocks and I am trying to come up with a universal way of turning these variables into a correctly formatted binary string.
I have found that making each of the blocks of data into a custom cluster control and saving them as type defs is the easiest way to go. However the flatten to string VI is not appropriately formatting the command string. The device requires little endian formatting and I have used the appropriate constant to make this happen. The communications work well if the blocks passed are all U8 variable; however once there are FLOATS, I32s etc in the mix the flatten string VI appears not to correctly format the data. I can correctly format the data If I flatten the variables that are other than U8 seperately, and then concatenate them strings into a command string. However, this solution requires a lot of code that is unique to each block of data.
So I am attempting to use variants to deal with this task as they carry with them the data type attribute which would allow me to programmatically flatten the cluster data based on data type. After I turn the cluster data into a variant, the resulting variant contains both the correct data type and values. Then I use vi.llb/getclusterinfo.vi to turn the variant into an 1-D array of variants containing the data type and value for each of the cluster elements. Unfortunately all the values in the 1-D array are 0, not the actual value of the connected constant. The data types are accurate. Is this a bug?
The solution could work quite nicely if I can get around the problem of losing the values in the get cluser info process.
Thanks.
Jeremy
PS Attached is the code.