The simplest form of error detection is the parity check. A parity check is accomplished by adding all of the '1's in a string of bits. For Even Parity, if the number is even, then the parity bit is set, otherwise it is not. For Odd Parity, if the number is odd, then
the parity bit is set.
Example 1:
In this example, we will calculate the parity of a byte that is to be transmitted using Even Parity. During transmission, one of the bits gets reversed. The
receiver catches this through the parity check at the reception end.
Transmitter:
10101010
There is an even number of '1's, so the parity bit is set and the byte is transmitted as follows:
101010101 <<<here you have a 5th bit which contradicts the concept of even counting
Receiver:
001010101
The last bit is not used in the parity calculation since it is the parity bit from the transmitter. Calculating parity on the received byte yields an odd number of
'1's and the parity is '0'. Since the receiver's parity calculation does not match the transmitter's calculation, the byte is determined to be errant and is thrown out.