I'm trying to read an asynchronus binary (not ASCII) serial message at 38400 baud, transmitted at 100 hz. I don't need to read all messages, just 10 or 20hz.
Each message length is 18 bytes, with a test word AA55 (hex) followed by a status/count word and data words. The status word is normally 0XXX, where XXX is the message sequential count from 0 to 800 decimal. With "good" status, the status word will increment from 0800 hex to 0B20 (800 messages). Checksum and checksum-not are at the end.
The vi I'v written uses the visa read, set to read 72 bytes (to make sure I get at least one complete message). My problem is that the LV visa read will read the full 72 bytes when the message begins with AA55 08xx, AA55 09xx or AA55 0Bxx but not AA55 0Axx. The read output always stops at AA55 0A, usually only 19 bytes containing the end of the previous message and the first 6 characters of the next. When the messages get to count AA55 0B the visa read will get the full 72 bytes again.
It looks like the port read is halting when it sees the 0A (0000 1010 bin) but not 08, 09 or 0B. I have used the "number of bytes at port" function in a while-loop to make sure there are 72 bytes available before reading, with a loop exit at 100 iterations. The while loop exits after executing 100 iterations before seeing 72 bytes in the port.
I can't understand why the failures always occur at the 0A messages. Could there be something unique about the pattern AA55 0A that effects the port reading? Other programs can read the data continuously so it is not a transmitter issue.
Thanks,
Rikard