Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XOR checksum for BCC (block check character)
Message
De
04/12/2004 12:35:15
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
XOR checksum for BCC (block check character)
Versions des environnements
Visual FoxPro:
VFP 6 SP3
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00966910
Message ID:
00966910
Vues:
1016
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
Fil
Voir

Click here to load this message in the networking platform