Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
XOR checksum for BCC (block check character)
Versions des environnements
With a specific piece of hardware I communicate via COM port and that works fine, but I have to append at the end of every sent string so called "BCC" character, so it looks like:
where STX is 0x02 and ETX is 0x03.
BCC string is an XOR checksum (or EXOR, as it is also written in documentation) of all characters in the string, including STX and ETX.
I write a procedure which translate every byte to binary, XOR all bytes and return result, which appends at the end after the .
But I found out that I have a problem with algorithm to calculate the "XORed" bcc checksum.
Since the communication is similar for reading, I tested the string which was returned from COM port and also had a BCC character at the end. I don't know how the checksum was calculated, however - my XOR routine doesn't return the same number.
So - here is the 11 bytes (ascii codes):
2, 87, 110, 107, 32, 48, 49, 49, 48, 48, 3
And the BCC character for them is 23.
Any ideas?
Thank's, Zlatko.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement