DCN Microproject
DCN Microproject
In the Subject of
“DATA COMMUNICATION & COMPUTER NETWORK”
AFFILIATED TO
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION ,
MUMBAI
GROUP MEMBERS
GUIDED BY
Ms. Arati Gaikar
ACADEMIC YEAR
2024-2025
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI
CERTIFICATE
CERTIFICATE
Place:-Shelu EnrollmentNo.:-23112230391
CERTIFICATE
Place:-Shelu EnrollmentNo.:-23112230413
CERTIFICATE
Place:-Shelu EnrollmentNo.:-23112230422
CERTIFICATE
Place:-Shelu EnrollmentNo.:-24112230424
I under signed hereby declare that the micro project report entitled
"Implementation of Hamming Code Using C". I further declare that
contents of this report are properly citied and well acknowledge. This
present report is not submitted to any other examination of this or any
other institute for the award of any diploma.
Place : Shelu
Date:
Signature of Student
1.
2.
3.
4.
ACKNOWLEDGEMENT
We extend our special thanks to all teaching and non-teaching staff. Success is
nourished under the combination of perfect guidance, care and blessing.
Acknowledgement is the best way to convey Last few years spend in estimated
institution has moulded us into confident and aspiring engineers. We express our
sense of gratitude towards our project guide Ms. Arati Gaikar. It is because of her
valuable guidance, analytical approach encouragement that we could learn, work and
complete the project. We will always cherish great experience work under the
enthusiastic guidance.
We are also grateful to our principal and our vice principal who not only supported us
in our project but also encouraged for every creative activity. We also sincerely give
thanks to our head of department Mrs.Madhura Mahindrakar of computer and its
sector, friends and well-wishers to directly or indirectly contribute for the success of
our maiden mission.
INDEX
1. INTRODUCTION 1
2. METHODOLOGY 2
3. CODE 3
4. OUTPUT 6
5. CONCLUSION 7
6. FUTURE SCOPE 8
7. REFERENCES 10
INTRODUCTION
The implementation of Hamming Code involves adding redundant bits (parity bits) to
the original data to ensure error detection and correction. These parity bits are
strategically placed at specific positions in the data to enable the identification and
correction of errors.
The number of parity bits (p) is calculated based on the length of the data bits (d)
using the formula:
2p >=d+p+1
These parity bits help identify error locations in case of single-bit errors.
The parity bits are placed at positions that are powers of 2 (1st, 2nd, 4th, 8th, etc.).
The remaining positions hold the actual data bits.
Each parity bit covers specific bits in the data sequence and is calculated using
even or odd parity.
Even parity ensures that the number of 1s in the covered set is even, while odd
parity ensures it is odd.
The encoded Hamming Code is transmitted with both data and parity bits.
1
METHODOLOGY
Hamming Code adds redundant parity bits to the original data bits to enable error
detection and correction. The position of these parity bits is carefully chosen to ensure
each bit's contribution to error detection.
The number of parity bits ppp required for ddd data bits is determined using the
formula:
2p >=d+p+1
where:
The parity bits are inserted at positions that are powers of 2 (1, 2, 4, 8, ...). The
remaining positions are used for data bits.
Each parity bit covers a specific set of data and parity bits based on their binary
position representation. The parity bits are calculated using even or odd parity:
Even Parity: The number of 1s in the covered positions (including the parity bit)
should be even.
Odd Parity: The number of 1s in the covered positions should be odd.
When the receiver gets the transmitted bits, it recalculates the parity bits and
checks for discrepancies.
If any parity bit does not match, an error syndrome is generated, which helps
identify the erroneous bit position.
2
CODE
#include <stdio.h>
#include <conio.h>
#include <math.h>
int calculateParityBits(int m) {
int r = 0;
while ((1 << r) < (m + r + 1)) {
r++;
}
return r;
}
r = calculateParityBits(m);
n = m + r;
j = 0;
3
printf("\n");
}
r = calculateParityBits(n - calculateParityBits(n));
errorPos = 0;
if (errorPos) {
printf("Error detected at position: %d\n", errorPos);
hammingCode[errorPos - 1] ^= 1;
printf("Corrected Hamming code: ");
for (i = 0; i < n; i++) {
printf("%d ", hammingCode[i]);
}
printf("\n");
} else {
printf("No error detected.\n");
}
}
void main() {
int m, n, data[20], received[20], i;
clrscr();
printf("Enter the number of data bits: ");
scanf("%d", &m);
4
scanf("%d", &data[i]);
}
generateHammingCode(data, m);
n = m + calculateParityBits(m);
printf("Enter received Hamming code: ");
for (i = 0; i < n; i++) {
scanf("%d", &received[i]);
}
detectError(received, n);
getch();
}
5
OUTPUT
6
CONCLUSION
The implementation of Hamming Code is an effective method for error detection and
correction in digital communication and data storage systems. By adding redundant
parity bits to the data, Hamming Code can detect and correct single-bit errors while
detecting (but not correcting) two-bit errors.
However, Hamming Code has limitations, such as increased redundancy and the
inability to correct multiple-bit errors. For higher reliability, advanced error correction
techniques like Hamming (SEC-DED), Reed-Solomon, or BCH codes may be
required.
In conclusion, Hamming Code remains a valuable tool for error correction, balancing
efficiency and simplicity in systems where single-bit error correction is sufficient.
7
FUTURE SCOPE
Hamming Code is a widely used error detection and correction technique, especially
in digital communication and memory systems. While it has been around since the
1950s, its future applications continue to evolve with advancements in technology.
Here are some key areas where Hamming Code is likely to play a significant role in
the future:
With quantum computing on the rise, error correction remains a critical challenge due
to quantum decoherence.
Modified versions of Hamming Codes could be adapted for quantum error correction
to improve qubit stability.
As wireless networks become more advanced, the need for efficient error correction
grows.
Spacecraft and satellites experience high levels of radiation, leading to frequent data
corruption.
Hamming Codes are used in error correction for satellite communication and deep-
space probes, ensuring reliable data transmission over long distances.
Hamming Codes can provide lightweight error correction mechanisms for IoT sensors
and edge devices.
Hamming Codes could help detect and correct errors in DNA sequences, making
biological data storage more reliable.
8
Error correction using Hamming Codes could help in improving the reliability of AI-
driven data analytics and cloud computing.
9
REFERENCES
https://www.geeksforgeeks.org/
https://en.wikipedia.org/wiki/Hamming_code
10