You are on page 1of 8

Laboratory Report Cover Sheet

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY


Faculty of Engineering and Technology
Department of Electronics and Communication Engineering

18ECC103J Digital Electronic Principles


III Semester, 2021-2022 (ODD Semester)

Title of Mini Project : HAMMING CODE ERROR DETECTION AND CORRECTION

Date of Submission : 07.02.2022

Particulars Max. Marks Marks Obtained

Name:
Name:
VISHAKHA Name
ANISHA DAS
DIXIT

Register No. Register No. Register No.


RA2011004010138 RA2011004010145

Design 20

Demo verification &viva 15

Project Report 05

Total 40

REPORT VERIFICATION

Staff Name : Ms. R BHAKKIYALAKSHMI


Signature :
OBJECTIVE
The aim of this experiment is to design a 7-bit Hamming code error detection and correction
circuit. Hamming code is capable of detecting up to two simultaneous bit errors and correcting
single-bit errors.

SOFTWARE USED
Logism

An educational tool for designing and simulating digital logic circuits

ABSTRACT
Hamming code was developed by R.W. Hamming for error correction. In this coding method,
the source encodes the message by inserting redundant bits within the message. Redundancy
means “The difference between number of bits of the actual data sequence and the
transmitted bits”. These redundant bits are extra bits that are generated and inserted at
specific positions in the message itself to enable error detection and correction. The distance
between the two redundancy bits is called “Hamming distance. When the destination receives
this message, it performs recalculations to detect errors and find the bit position that has error.
In digital communication system error will be transferred from one communication system into
another. If these errors are not detected and corrected, then the data will be lost. For effective
communication, system data should transfer with high accuracy. This will be done by first
identifying the errors and them correcting them. Error detection is a method of detecting the
errors which are present in the data transmitted from a transmitter to receiver in a data
communication system. Error correcting codes ascertain the exact number of bits that has been
corrupted and the location of the corrupted bits, within the limitations in algorithm.

Keywords:

Hamming code

Error detection

Error correction Encoding

Decoding

Bits
Bit error

Redundant

Communication system

Position

INTRODUCTION

1.1 Hamming code

In digital systems, the analog signals will change into digital sequence (in the form of bits). The
change in position of single bit also leads to major error in data output. Almost in all electronic
devices, we find errors and we use error detection and correction techniques to get the exact
or approximate output.

Hamming code is a liner code that is useful for error detection up to two immediate bit errors.
Hamming code method is effective on networks where the bit sequences are given for the
single-bit errors. Hamming code not only provides the detection of a bit error but also helps
you to indent bit containing error so that it can be corrected. The ease of use of hamming codes
makes it best them suitable for use in computer memory and single-error correction. The
biggest drawback of the hamming code method is that it can solve only single bits issues. We
can perform the process of encrypting and decoding the message with the help of hamming
code.

1.2 Applications of using Hemming code:

Satellites

Computer Memory

Modems

Plasma CAM

Open connectors

Shielding wire
Embedded Processor

DISCUSSION:
The Hamming Code is simply the use of extra parity bits to allow the identification of an error.

2.1 Process of Encoding a message using Hamming Code


1) Calculation of the total number of redundant bits.

Let us assume that the message contains:

n- number of data bits, p - number of redundant bits which are added to it so that np can
indicate at least (n + p + 1) different states.

Here, (n + p) depicts the location of an error in each of (n + p) bit positions and one extra state
indicates no error. As p bits can indicate 2p states, 2p has to at least equal to (n + p + 1).

2) Placing the redundant bits in their correct position.

The p redundant bits should be placed at bit positions of powers of 2. For example 1, 2, 4, 8,
16, etc. They are referred to as p1 (at position 1), p2 (at position 2), p3 (at position 4), etc.

3) Calculation of the values of the redundant bit.

The redundant bits should be parity bits make the number of 1s either even or odd.

Here, all the redundant bit, p1, is must calculated as the parity. It should cover all the bit
positions whose binary representation should include a 1 in the 1st position excluding the
position of p1.

P1 is the parity bit for every data bits in positions whose binary representation includes a 1 in
the less important position not including 1 Like (3, 5, 7, 9, …. )

P2 is the parity bit for every data bits in positions whose binary representation include 1 in the
position 2 from right, not including 2 Like (3, 6, 7, 10, 11,…)

P3 is the parity bit for every bit in positions whose binary representation includes a 1 in the
position 3 from right not include 4 Like (5-7, 12-15,… )

2.2 Process of Decrypting a Message in Hamming code


Receiver gets incoming messages which require to perform recalculations to find and correct
errors.

The recalculation process done in the following steps:

Counting the number of redundant bits.

Correctly positioning of all the redundant bits.

Parity check

1) Counting the number of redundant bits

You can use the same formula for encoding, the number of redundant bits

2p ≥ n + p + 1

Here, the number of data bits and p is the number of redundant bits.

2) Correctly positing all the redundant bits

Here, p is a redundant bit which is located at bit positions of powers of 2, For example, 1, 2, 4,
8, etc.

3) Parity check

Parity bits need to calculated based on data bits and the redundant bits.

p1 = parity (1, 3, 5, 7, 9, 11…)

p2 = parity (2, 3, 6, 7, 10, 11… )

RESULTS
LOGIC DIAGRAM
CONCLUSION
In this project, a detailed look at “Hamming Code” with code comparison was conducted.
Hamming code is useful for both detection and correction of error present in the received data.
This code uses multiple parity bits and we have to place these parity bits in the positions of
powers of 2. Decoding can be accomplished in the following manner: If S(r)=0, then we
assume that no error occurred. If S(r) ≠0 and it contains odd number of 1's, we assume that a
single error occurred. The error pattern of a single error that corresponds to s is added to the
received word for error correction. If S(r) ≠ 0 and it contains even number of 1's, an un-
correctable error pattern has been detected. Hamming code corrects only the error patterns
of single error and is capable of detecting all 2 or fewer errors hence finding a way to correct
more than one error and detect more than two errors would be effective. All error detection,
correction controlling mechanisms has been studied. Hamming code is most efficient error
correction mechanism in long distance communication. Interesting area of future research is
the study of how the presence of caches would affect the correlation in the data input to the
ECC memory, and whether there is any systematic pattern there that can be exploited by the
optimization algorithms.

REFERENCES

1. M. Morris Mano, Michael D. Ciletti, Digital Design, Pearson Education, 2013.

2. https://www.geeksforgeeks.org/hamming-code-in-computer-network/

3. https://en.wikipedia.org/wiki/Hamming_code#:~:text=In%201950%2C%20Hammi

APPENDIX
REDUNDANT BITS AND PARITY BITS
Redundant bits

Redundant bits are extra binary bits that are generated and added to the informationcarrying
bits of data transfer to ensure that no bits were lost during the data transfer. The number of
redundant bits can be calculated using the following formula: 2r >= m+r+1 Where, r= redundant
bit and m=data bit

Parity Bits
A parity bit is a bit appended to a data of binary bits to ensure that the total number of 1’s in
the data is even or odd. Parity bits are used for error detection. There are two types of parity
bits:

1. Even parity bit: In the case of even parity, for a given set of bits, the number of 1’s are
counted. If that count is odd, the parity bit value is set to 1, making the total count of
occurrences of 1’s an even number. If the total number of 1’s in a given set of bits is already
even, the parity bit’s value is 0.

2. Odd Parity bit: In the case of odd parity, for a given set of bits, the number of 1’s are
counted. If that count is even, the parity bit value is set to 1, making the total count of
occurrences of 1’s an odd number. If the total number of 1’s in a given set of bits is already odd,
the parity bit’s value is 0.

You might also like