# Embedded Systems/Parity

In many instances, especially in transmission, it is important to include some amount of error-checking information, so that incorrect information can be determined and discarded. One of the most simple methods of error-checking is called parity. Parity can be broken up into Even Parity, and Odd Parity schemes. A parity check consists of a single bit that is set, depending on a certain condition.

## Even Parity

In an even parity scheme, the parity bit is set if an odd number of bits in the data are set to 1 (to make the total number of 1 bits even). For instance, 01001100 would generate an even parity bit, while 11001100 would not generate one.

## Odd Parity

The opposite of Even parity, odd parity generates a parity bit if there are an even number of high-bits in the data (to create an odd number of 1's).

## Limitations of Parity

Simple 1-bit parity is only able to detect a single bit error, or an error in an odd number of bits. If an even number of bits (2, 4, 6, 8) are transmitted in error, the parity check will not catch the mistake

However, chances of getting 2 errors in 1 transmission is much much smaller than getting only 1 error in 1 transmission. so parity checks serve as a cheap and easy way to check for errors.

ECC codes are often used for the same reasons as parity bits. These codes use more bits, however they allow multi bit error detection, and also correction of single bit errors.

CRC checks are usually used at the end of data blocks. These are carefully designed to give a very high probability of detecting corruption of the data block, no matter how many bit errors are in the block.