Error Detection
Error Detection
Error detection protocols are used to find transmission errors. If an error is found the
protocol you are using will decide how to fix it.
Parity Check
Parity is a character error detection method. The parity check adds an extra bit to every
character or byte transmitted. Seven bits are used for each ASCII character and the eighth
bit in the byte is used to check the accuracy of the transmission. The eighth bit is the
parity bit. Both sending and receiving devices must agree on which parity checking
method will be used. The two most common methods are called odd and even parity.
If the agreed method is even parity, then the sending device counts the number of 1’s in a
character and adds a parity bit of 1 or 0 to make the total an even number of 1’s. The
receiving device does the same calculation, including counting the parity bit, and if it also
gets an even number of 1’s then the data sent is assumed to be correct.
Parity is unreliable because it only detects about half the errors that can occur when a
byte is transmitted. A common transmission error is bit swapping. If one of the 1’s in the
data byte shown above is swapped with one of the 0’s, then the parity would not change
and the error would not be detected. For this reason, parity is rarely used for error
detection in modern communication links.
Despite this, the word ‘parity’ is still widely used in communication systems. A common
abbreviation used to describe a data byte prepared for transmission is ‘8N1’ – which
means 8 data bits, no parity and 1 stop bit.
Checksum
Checksum is the first and simplest of the block error detection methods. Block methods
rely on dividing a message up into blocks or ‘packets’ of bytes and testing the accuracy
of each block, rather than each individual byte. This speeds up the data flow.
Checksum is a more reliable error detection method than the parity check.
In the above figure, the transmitting computer sends its calculated checks um as the last
byte of the data block. The receiving computer performs exactly the same calculation on
all bytes it receives and compares its block checksum with the one sent by the other
computer. If the two values are different then an error has been detected.
While the checksum method will detect over 90% of transmission errors, it does not
reveal which byte or bytes in the block are faulty. This means that the entire block will
have to be retransmitted to fix the error.
Checksum is not a reliable error detection method for long message blocks, so it is not
longer used in modern communication protocols.
CRC, like checksum, is a block error detection method. CRC cannot reveal which byte or
bytes in a block are faulty.
The transmitted data is treated as one large binary or hexadecimal sum rather than as
separate sums for each packet. The sum is then divided by a constant and the remainder
after this division is sent to the receiver. The receiver than works out the sum of the
transmitted data, divides it by the same constant and compares the remainder with the
data transmitted. Any mismatch signals an error.
The transmitting computer performs the CRC calculation and places the result, as either a
16-bit or 32-bit value, at the end of each block. The receiving computer performs the
same calculation and compares the answer with the one it receives.
CRC has a far greater reliability than checksum. The 16-bit CRC method will detect
99.998% of all possible errors. The 32-bit CRC method is even more reliable. It will
detect 99.99999977% of all possible errors. CRC is the preferred error detection method
in many communication protocols.