Posts

Showing posts from February, 2019

8 bit binary checksums

Image
Today I needed to calculate an 8bit XOR checksum. I was reading an equipment manual to understand the serial data communication protocol for "Bayern-Hessen". The manual explained the message protocol. The "send" message was explained as the following: Binary Message Format. To ensure the integrity of messages transmitted over the network, all messages sent to or received from the instrument are formed into data packets consisting of a header character, a terminator character, and a block check code, as shown below.  <STX><message><ETX><BCC>  In the message above, and throughout this document, is the ASCII start-of-text character (ASCII code 2); is the ASCII end-of-text character (ASCII code 3); and  is the block check code, which is a one-byte value, represented by two hexadecimal characters. For example, a block check code of 0x43 would appear in a message as the characters “43.” (For non-programmers, 0x43 is the C language conve