> Sure, I assume you refer to the case when you check the data length as > well? I meant that the <Checksum><cr><lf><@><@> byte string could also > potentially exist in the data itself, but only in very rare cases > (from there the 95% thumb suck).
The checksum byte can have any value. You can't use it to help you get in sync since you don't know (and can't compute) what it is unless you have the rest of the packet and then you are already in sync. Once you get in sync, you don't look for any patterns inside the packet. You read a few byes to figure out how long the packet is, read the rest of the packet, then do some sanity checks. Since the RS-232 level stuff should be error free, the sanity checks will almost never fail. If they do, it means somebody tripped over a cable or a lightning bolt hit. (Or you have a bug in your software.) Flag an error, somehow, so you know you have a problem. I'm thinking of something like a LED with a software or pushbutton reset. Then go back to the beginning and try to get in sync again. -- These are my opinions, not necessarily my employer's. I hate spam. _______________________________________________ time-nuts mailing list -- [email protected] To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.
