I'm using Labview 6i to collect data from a device over RS232. The device manual says that it delivers data digitally by sending 10 bytes every 100ms. I'm using VISA Write to send an initialization string, and then I step in to a loop containing VISA Read set to read data synchronously, set to read 10 bytes of data. I have tried a number of things to get this to work:
Adding a wait to the loop and varying the wait time
Increasing the bytes read from 10 to 15 and filtering out the specific 10-byte set I want to read
Taking out the wait completely and letting the loop run untimed, limited by the VISA Read node
The problem I encounter is that often the VISA Read node returns a set of data that is "shifted". In hex, my 10-byte set should look like this:
FFFE 0106 04 FF FF FF 45 D4
Where the FFFE 0106 04 acts as a header. Often the 10 byte set I retrieve contains some bytes from one set, and some bytes from the next set; so, the header might lie in the center or at the end of the 10-byte set rather than at the beginning (in which case there is some data lost at the leading and trailing ends)
One thing I have tried is throwing out "bad" sets, but then I am losing data and not getting the full 10 data points per second that the device is capable of.
When reading data like this, where a set of bytes is sent periodically, how can you ensure that every set is properly read?