5/2/2023 0 Comments Serial protocol stx etx![]() is actually the length of the message, probably as a raw binary WORD. and are the non-printable start and end of text bytes. You will need the first value in the message to be the length. No need for a length on each value as we can count the digits being received between delimiters. Use a delimiter between values, for example a semi-colon. Now if you are using ASCII, use STX and ETC as you describe. It's better to have no data than wrong data. This might be unlikely but unlikely things happen all the time. ![]() That is, you don't actually know what that value represents as you have lost it's position in the scheme of things. You no longer know if that next "valid" value is part of the message you were reading or part of a following message or what position in the message it should have had. Yes, the next value and it's CRC may be correct BUT now you don't know if there was some interruption in data flow such that the end of one message was missed along with the beginning of the next message. If a CRC on one of your data values is wrong you are now screwed for all of that message. I have never seen anyone use multiple CRCs within a message. ![]() Having been around a bit I've seen dozens of different serial line protocols. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |