|
Re: Distinguish Serial Data?
If the other device is known, like a keyboard, you could pick a starting flag byte that wont be used by the other device.
or the number of bytes you use for the flag (start characters) will determine the probability that stream will happen by random chance.
If you use an 8 bit start flag, the probability is 2^8 = 256:1
two bytes: 65,536:1
four bytes: 4.29 billion to one
your SW would then have to keep track - once you see the start flag you take the rest of the data as data. This implies you know how long the data packet will be.
|