# Error Checking and Detection

## Parity Checking

An extra bit can be add to a binary code to act a an error checker when the data is transmitted, the extra 0 or 1 is used to make the number of 1′s in the binary code either odd or even, when the data is received if the number of 1′s is odd and it should be even or vice verse then the receiver will know that there has been an error is the transmission of the code.

Example:

A 7 bit number sent using even parity - 10110010

the number of 1's is odd so we know that there's been an error - 10110000

## Majority Vote

Majority vote is use to ensure that the data transmitted is accurate and free of any errors, it uses three bits for each digit of the data to be transmitted. For example, 0 would be 000 and 1 would be 111 meaning that even if there was interference in the transmission then the signal could still be received with few, if any faults. Unfortunately this does mean that the amount of data that is transmitted and receive is three times the normal amount and therefore takes longer and can cost more.

Example:

00110100 would become

000 000 111 111 000 111 000 000

## Gray Code

Prevents data errors that can be created when using pure binary numbers.

Converting Binary to Gray code:

Locate the most significant bit and keep a copy of it

Then compare each pair of bits with an XOR gate

Place the MSB back on to the number

Example:

0110 – Remember the 0

0110 – 0 XOR 1 = 1

0110 – 1 XOR 1 = 0

0110 - 1 XOR 0 = 1

0101

Converting Gray Code to Binary

Locate the most significant bit and keep a copy of it

Then compare each pair of bits with an XOR gate

Place the MSB back on to the number

Example:

0101 – Remember the 0

0101 – 0 XOR 1 = 1

0101 – 1 XOR 0 = 1

0101 - 1 XOR 1 = 0

0110