##### Introduction to Hamming Code and Parity Bits

•  To detect bit error we need bits.
• To Correct bit error, we need bits.

Hamming code:

A Hamming code detects and corrects only one-bit error.

Parity bits: Along with message bits sender sends some extra bits which are helpful in error detection and correction. Those extra added bits are called Parity bits

There are two types of parity bits in Hamming code:

1. Even parity: If the total number of 1's including parity bits in a message is even, then that is called even parity.

Example: let a sender sends a packet (message bits + parity bits) = 1010101000, Number of 1's is 4, So it is even parity.

2. Odd parity: If the total number of 1's including parity bits in a message is odd, then that is called odd parity.

Example: let a sender sends a packet (message bits + parity bits) = 110010001001, Number of 1's is 5, So it is odd parity.

Deciding Parity Bits:-

let me ask you some questions:

1. How many pairs bits are added if the total number of bits in a message is ?
2. How the Receiver will know whether the error has happened or not?

Calculating Number of  parity bits:

let the number of message bits = and

number of the parity bits            = then should be satisfying g this easy condition: Example :

1. let the number of message bits = 4

Then

1. The number of parity bits :   Now the minimum value of satisfying this equation is 3 So the total number of parity bits = 2. Total number of bits in Message(to be send)  =   parity bits + original message bits

= 2. let's take  another example:

number of message bits = 7

So parity bit ( ) = ???  if  Yes, the equation is satisfied.

So the number of parity bit ( ) = Total number of bits in Message(to be send)  =   parity bits + original message bits

= Each parity bits have some special functionality depending on their location and parity bits are added only  at location :  where n= 0,1,2,3..........n

It means we can have parity bits at location 1, 2, 4, 8, 16.......

depending on the location of parity bits  we can write them like this = parity bit at location 1 = parity bit at location 2 = parity bit at location 4 .....

Remember doesn't mean that it is number 4 So, it means it is used at location  number 4.

For example : let's say our message bit is like there are 4 bits so we need 3 parity bits and they are: So a total of 7 bits are needed to be sent:

Location:      1       2      3       4      5      6       7

Bits:       Each parity bit is going to take care of another bit depending on the location of the parity bit. Example:   and so on.

How to remember this:

let's talk about  has a subtext 4 that's why it starts with 4 and read four continuous value then it makes a gap for four number(8,9,10,11). Now it will read the next four value and again a gap of four continuous numbers( ) and so on...

Now we are done with basics. Let's move forward to implement all this stuffs.

##### Error Control

Error Control:
 The error made in bits during transmission from source to destination machines must be detected and corrected.
 Many error detecting and error correcting codes are available.
 Both sending and receiving ends must agree to use any one code.