0% found this document useful (0 votes)
47 views2 pages

Calculating The Hamming Code

The Hamming Code allows for the detection of single bit errors by using additional parity bits. It works by assigning certain bit positions as parity bits based on powers of two. Each parity bit calculates parity for a sequence of data bits, with the sequence determined by its position. A parity bit is set to 1 if the total number of ones in the checked bits is odd, and 0 if it is even. To find the location of an error, the parity of each check bit is recalculated and positions of incorrect parity bits are summed.

Uploaded by

Piyush Chand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views2 pages

Calculating The Hamming Code

The Hamming Code allows for the detection of single bit errors by using additional parity bits. It works by assigning certain bit positions as parity bits based on powers of two. Each parity bit calculates parity for a sequence of data bits, with the sequence determined by its position. A parity bit is set to 1 if the total number of ones in the checked bits is odd, and 0 if it is even. To find the location of an error, the parity of each check bit is recalculated and positions of incorrect parity bits are summed.

Uploaded by

Piyush Chand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CalculatingtheHammingCode

ThekeytotheHammingCodeistheuseofextraparitybitstoallowtheidentificationofasingle
error.Createthecodewordasfollows:
1. Markallbitpositionsthatarepowersoftwoasparitybits.(positions1,2,4,8,16,32,64,etc.)
2. Allotherbitpositionsareforthedatatobeencoded.(positions3,5,6,7,9,10,11,12,13,14,
15,17,etc.)
3. Eachparitybitcalculatestheparityforsomeofthebitsinthecodeword.Thepositionofthe
paritybitdeterminesthesequenceofbitsthatitalternatelychecksandskips.
Position1:check1bit,skip1bit,check1bit,skip1bit,etc.(1,3,5,7,9,11,13,15,...)
Position2:check2bits,skip2bits,check2bits,skip2bits,etc.(2,3,6,7,10,11,14,15,...)
Position4:check4bits,skip4bits,check4bits,skip4bits,etc.
(4,5,6,7,12,13,14,15,20,21,22,23,...)
Position8:check8bits,skip8bits,check8bits,skip8bits,etc.(815,2431,4047,...)
Position16:check16bits,skip16bits,check16bits,skip16bits,etc.(1631,4863,8095,...)
Position32:check32bits,skip32bits,check32bits,skip32bits,etc.(3263,96127,160
191,...)
etc.
4. Setaparitybitto1ifthetotalnumberofonesinthepositionsitchecksisodd.Setaparitybit
to0ifthetotalnumberofonesinthepositionsitchecksiseven.
Hereisanexample:
Abyteofdata:10011010
Createthedataword,leavingspacesfortheparitybits:__1_001_1010
Calculatetheparityforeachparitybit(a?representsthebitpositionbeingset):
Position1checksbits1,3,5,7,9,11:
?_1_001_1010.Evenparitysosetposition1toa0:0_1_001_1010
Position2checksbits2,3,6,7,10,11:
0?1_001_1010.Oddparitysosetposition2toa1:011_001_1010
Position4checksbits4,5,6,7,12:
011?001_1010.Oddparitysosetposition4toa1:0111001_1010
Position8checksbits8,9,10,11,12:
0111001?1010.Evenparitysosetposition8toa0:011100101010
Codeword:011100101010.

Findingandfixingabadbit
Theaboveexamplecreatedacodewordof011100101010.Supposethewordthatwasreceivedwas
011100101110instead.Thenthereceivercouldcalculatewhichbitwaswrongandcorrectit.The
methodistoverifyeachcheckbit.Writedownalltheincorrectparitybits.Doingso,youwill
discoverthatparitybits2and8areincorrect.Itisnotanaccidentthat2+8=10,andthatbitposition
10isthelocationofthebadbit.Ingeneral,checkeachparitybit,andaddthepositionsthatarewrong,
thiswillgiveyouthelocationofthebadbit.

Tryoneyourself
Testifthesecodewordsarecorrect,assumingtheywerecreatedusinganevenparityHamming
Code.Ifoneisincorrect,indicatewhatthecorrectcodewordshouldhavebeen.Also,indicatewhat

theoriginaldatawas.
010101100011
111110001100
000010001010

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy