You are on page 1of 13

Page:

Date:

pogra eafoy
dee chm
Coxttehen Jor 713 bis AsCI Codep Uang
lamnminq Gdes o CRc Denonstade the packel
Captured tracesOsh Wireshade lacke Araly
bol for pees Mode

Daka Linke lo Roes fotb rols CEternet)


C/Ct vammi ntax
3 wied.ak ttsl

Leatning Obechves
Studenh
unduutand Dak Liok
La 6S Mede.
2. Studenk w i be able to ndestand hamming
Cde o d CK

hep
Conmpuli Nehooda aro Dkhon and Cerrechon
CondihaM nen Teceivey s dos hoT
i
Matdh Sendus ip. D rig hensmisiDoigitu
3ignas
the oinauy travelima gedrho
Yecei ve Tha MLANJ
chaunge
ViCe vrA ,
Me popuua LOr-cdektch m econiqvAA aR
lwdiMensíonal Cwt
Simple asihy
Page
Date

Che eeavm
Cuclic redwnolounC che ch
Ha

FamMina_ Codes
Hamui de se erfev cofrehon
Locdes the be Used to deteck
-cofectbt evrors na Can ouUY-
daka MOVed chyred le ofhin eTo Ca recha
cecdt, aMming cocle ales ue 3 He concep
pau ty nd pauit bit wtuicn
ddedt dak Hha thevalSdih doa
clheched whe its read O
has bren Yeceve okaka ransaisci.
OSína ore hau ne pauly- bit eTo-Ly echo
Lede ns ma iden
the dath Ont_ buuk ib locahion in he da
Unit

Codcukabhnq th Kammi Cod


DeHarinin the posihms yedondancy ss
We t h a to deect_eyYov in a 1biE coode
4 reunda bi ave e i d
Now fhe nexe o dueumine he posih
a k whih theve eandanaq i be placed
La1thin the daka
hee rdundanc bib are plaped t e Pos hions wich
C6rnepd to he power 2
Ih (aye- 1 bi ata 4 edund anay
r ed S a kina 0

he redwndanay bib paccd n-


2 h_ d
Page
/Date:

6
d d dr d
Ted wnola bits
Sn Hamminy Code each ht e VRC or
combinahby bis he VAC bit
is
Uornbinohon dala bis Tad n.
cach daka bie y e hludrd n Mbve hg
VRC (allah
Lal elated using
all b posi hovs whese
bivary prawah nLude 1 in e iahhaet poshg
heo fhe voariovs bis a r e parity bib
b Lnmbina ha
Dbit 3,5 7,1,
T2 bib 2, 6, 7, 10,
bi ,5,6,1
bitsL,1, 1D,

Kedundancy bts aluahon

T ake ae ze bib

3
deldddd T4aes car ns

O10 Olo O 160

dd TS ueA Ca

tott OTO10D 0eo


Page
Date:

Suppose binary daa To0Oic tobe ransmites


mplervent Hommin Cocle t , st ps ved are

(alaulakag the no rdondancbis uired


Sincc no data bis are 1, y aludatrd o

2 14 A+
nO cunsdant bik are A
Deeamin fue
redundan bits he bis ave placed
powus ie 2 1,8

Loo
A

eleaminiq ekemrig he
i s AC r bjts 3,5, 1 1,1
hddi nq allolel 1

Y VRC or bit 2 d6 1o

Mdy Y
isVRC biA,5,6,1

Addiag Yh 4 3 2

s VR o hit 81 1O,
Page:
Date:

AAdirg 8
10 1 543

1h, data o 0I ooIol wil betransmited

tyro Dekechm rcechon


Dala senk 0o IL 00 1oL
Daka ecend 1D0 1016DlOL (1 bit dhangrd)
he neczive talkes he branSm issien Ye coleudal
Ar neL VRC stg e ae
USed hy sende
se bik
pls e eleyantaity (r) bt
shawn in_
1hen E asembles the ew pau Voue iho aa
bivag no in orde

w zampe s ve e binasy
nomb LOTYespands doúmal
hewep bt no _Comlaind n errD oLoet
error bit yeyud rom O to 1

Cycic Kedundaney Che ck CcRC)


CKC w based O binay division.
CRC Seqyence eundant biscalled
Tedon danty cdheck bik aptndsed t the
end 6 daka sD t the TEALhing daka unit
bece Me a davisible by_a e cond predeke.mine
Page
Date
oA the desina hon he intumina doka
dividedy he sane no. ak ep, taMe
Ma inda, the daka unit aaUMed
LOY rect and thessere accepked
reMainde indiaes the e dala
oer darmagd in ran sit and uwtre Mush
eeced

SEN DER RE CENER

Dexta 00.- Daa CRC


Cn+Dbis (ntis
Diviso Divise
nbits
CRC
Reonainde

Rerece-lerekc
Da CRc

Crigina Menage _ 0 O O oO

Genead PALunarial
O) ** (O) + I ( )
CRC Geneato
H-57E

means X-oR)

CRC qenetoY So bits then aphed


n - ) zerosin the nd the rinol

MEAS
Page
Date

Sener Re cei e

oO otO0o o'O Oo

O10IOO
OO
Do LLOLL
O oI

Oo1
Mesya toe tra nsmtHed
Zee mea
dalaacceptes

Condusio
tene We haye shodied UOr dekechon Correchbn
Usina
Assignment No. 3

Program:
Hamming Code

#include <IOstream
#includesmath.h>
using namespace std;

Int main01
int data1 1J.ree[11].parity[4
cout < "Hamming Code" << endl;
cout<nSender's Side: \n";
cout"Enter 7 Bit data to send separated by space:";
for(int i-10;i-0;i-)

ifi-O|-1|i3-7)
continue;
cin>>data|i}
IParity Bit Calculation
data[O]-data[2]'data[4]data[6]'data[8] data[10]:
data[1]=data[2/'data[51 data|6] data[9]'data[ 10};
data[3]-data[4]'data|S/data|6];
data[7]=data8]'data|9/'data[10}:
cout"nlnput Data";
for(int i-10,i>-0;i-)

ifi Ol1||i3|-7)
continue;
coutcdata[i};
cout<<"nEncoded Data: ";
for(int i10;i>-0;i--)
coutdata[i};
cout<"nnFor Error CheckinginReceiver's Side:";
cout"inEnter received data bit by bit: ";
forint i10;i>-0;i--)

cin>recli

parity[0]-rec[0/ree[2/°rec[4) rec[6)'rec[8]°rel[10];
parity[1]-rec[1 ree[2/'rece[5]'rec[6)'°rec[9]°ree[10];
parity[2]rec[3)°rec[4)rec[5]°rec[6]:
parity[3]-ree[7°rec[8]°rec[9/'ree[10];
ifparity[0]-0&&parity[ |]-0&&parity[2]-0&&parity[3]-0)
cout<"Data is Correct. No error."

else
cout<"nError in the code.InError Position(Binary): ";
for(int i-3;=0;i-)
coutcparity[i|;
int pos- 0;
for(int i-0;ic4;it+)

pos post(parity[i]"pow(2.i)); I/Binary TO Decimal COnversion

cout<"nError Position(Decimal): "<pos;

return 0

Output

Code
kammi
ender's Side:
inter7 Bit data to send separated space:1 0 01 101
nput Data1001101
ncoded Data: 10011100101

or Error Checking
eceiver s S1de
inter received data bit by bit: 1 0 010100101
rror in the code.
irror Position (Binary): 0111
rror Position (Decimal) : 7

rocess exited after 56.05 seconds with return value 0


ress any key to continue
Program
CRC

#include <iostream>
using namespace std;

int main 0

int ij.k,l;

/Get Frame
int f
cout" n Enter Frame size: ":
cin>>fs;

int f120]:

cout<"n Enter Frame:";


for(i-0;i<fs;it+)
cin>>i);

I/Get Generator
int g
coutcenI ter Generator size: "
cin>>gs;

int g[20];

cout<<"n Enter Generator:"


for(i-0;isgs;it+)
cingli);

cout<"n Sender Side:";


coutcen Frame: ";
for(i-0;isfs;it+)

cout[i);
cout " n Generator:";
for(i-0;igs;i++)
coutg;

WAppend 0's
int rsgs-l;
coute"n Number of O's to be appended: "<<es;
for (i-fs;icfstrs;it+)

int temp[20]:
for(i-O;i<20;i++)

temp[i)-i:

coute"n Message after appending 0's";


for(i-0; i<tstrs;i++)

cout stemp[i):

/Division
for(i-0;ifsit+)

j-0;
k-i;
l/check whether it is divisible or not
if(temp[k}> sü))
forg-0,k=ijgsjt+;k++)
temp[k]-temp[k] sb}/XOR operation

I/CRC
int cre[15]:

for(i-0j-fs;iss;it++j++)
cre[i)-templ
"

couts"n CRC bits:


for(i-O;isrs;it+)
coutscre[i:

cout"in Transmitted Frame: ":


int tf[15}:
for(i-0;i<fs;it+)
for(i-fsj-0;isfstrsit+j++)
-crelk
fori-0;icfstrs;it+)
cout<t[

cout< in Receiver side: "


cout"n Received Frame: ";
for(i-0;i<fstrs;it+)

cout<<tii

fori-0;i<fs+rsit+)
temp[il-i]

Division
for(i=0;isfstrs;it+)

j0;
k-i;
if (temp[ksU))

forg-0.k-ijgsjt+k++)
temp[k]=temp[k]' gli]; //XOR OPERATION

couteein Remainder: ";


int rrem[15);
for (i-fsj-0,;i<fs+rs;ittj++)

remj= temp[ik
for(i-0:irsi+)
coutcerrem|ij;

int flag-0;
for(i-0;isrs;it+)
ifrem[il-0)
flag-l;

if( flag-0)
coute"in Since Remainder Is 0 Hence Message Transmitted From Sender To Receriver
Is Correct":
clse

cout"n Since Remainder Is Not 0 Hence Message Transmitted From Sender To


Receriver Contains Error";

return

Output

inter Frame size: 0

nter Frame:1 00
10
nter benerator s1zes 4

Enter Generator:1 1 0 1

Sender Side

enerator :1101

umber o Stoe
Os 100100000
CRC bits E
ransaitted Frame: 100100091

ever S1de
ecelved rame: 1e10
enalnoer
iince Renainder Is Hence Nessage Transaitted From Sender To Receriver 1s Correct

seconds with return value


Process exited after 20.18
ress any key to continue

You might also like