08-13-2009 10:13 AM
08-13-2009 10:20 AM
When monitoring a device that is continually transmitting data, we have to expect that we will not be lucky enough to start listening inbetween packets. If we start listening half way through we should expect to find a previous message fragment waiting in the input buffer. When there are larege dealys inbetween and we now the lenght of the packet, we can use the approach above. Another way of framing your data into complete packets is to read all of the bytes at the port and then examine them for a valid frame format.
Ben
08-13-2009 10:38 AM
abdel2 wrote:
Raven, you method worked great! I used the exact same logic except I had to use 13 (0xd) as a termination character becase the 31-byte string I read always had 0xd at the beginning and 0xA at the end (unlike what the manual says).
Good to hear! Yes, you are correct it should be 13 (0xD). I forgot to look back at the manual or example string when I was working up the example.