Hello All,
I'm hoping you can help me with a problem that I've been having. The background:
Using a microcontroller to to gather data from various sources and sending all the data back to Labview via an FTDI virtual COM port. The different types of data sent back in one chunk has a three byte header that tells me (in an abstract way) how many bytes are following for that type of data. This repeats until all the data sources are exhausted and all the data is received. However, occasionally, there is an extra byte in the buffer, which then pushes the headers out of whack and has me looking for bytes that aren't there. I'm attaching screen shots of the serial port config and of the serial port read vi's. I've tried flushing the buffer before I do a data acquisition and ask for data, but sometimes the extra byte happens inside data stream, so again it pushes the headers out of place.
I have a secondary COM port output on the microcontroller that echoes the data being sent to Labview and is connected to a second PC that is capturing the data. The data is in binary format. I have disabled the termination character requirement from the receive buffer, but enabled it for the transmit (as you should see from the setup). When I review the logs of the captured data on the second PC, the microcontroller is not sending the extra byte. It appears that even though Labview reads the byte from the buffer, it remains there SOMEHOW or I could be way off and it's a bug in my code. I'm hoping that you can help with perhaps seeing something that I'm not seeing.
As for my serial buffer read, I do recognize that I don't have a timeout in the event that the number of bytes to read exceeds the total bytes in the buffer, this has actually been beneficial in helping with capturing the error as it happens. I didn't use the Bytes at the Port property because speed is important and this property is notoriously slow. Also, that really wouldn't solve the extra byte problem.
This the serial read vi
This is the Serial Port Setup