DC02
DC02
MATLAB CODE
Input = [0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0, ...
0,1,1,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0, ...
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; % Input values.
M1=Input; G1 = [1,0,0,0,0,0,1,1,1];
mL = length(M1);
gL = length(G1);
count = 0;
while((mL-count) >= gL)
msg9 = M1(1:gL);
rem = mod((msg9 + G1),2)
M1(1:gL) = rem;
j=1;
shft = 0;
while(j<=gL)
if(rem(j)~=0)
break;
else shft = j;
j = j + 1;
end
end
count = count + shft;
M1(1:shft) = [];
end
j = 0;
value = 0;
chksuml = length(M1);
for j = 1:chksuml % convert binary to decimal
if(M1(j) == 1)
value = value + (2^(chksuml-j));
end
end
dec2hex(value)
% decimal to hex CRC8 output
4. VIVA-VOCE QUESTIONS
1. What is a cyclic code.
2. State the advantages of using CRC.
3. In CRC, show the relationship between the following entities (size means the number of
bits):
a. The size of the dataword and the size of the codeword
b. The size of the divisor and the remainder
4. Can CRC correct error. Justify your answer.
5. Why Checksum is used.
5. REFERENCES
1. Tanenbaum: Computer Networks, Pearson Education.
2. Bertsekas and Gallager: Data Networks, PHI Learning.
3. Black: Computer Networks, PHI Learning.
4. Forouzan: Computer Networks, TMH.
5. Stallings: Computer Networking and Internet Protocol, Pearson Education.
6. Keiser: Local Area Network, TMH.
7. Forouzan: Data Communication and Networking, TMH.
8. Gupta: Data Communications and Computer Networks, PHI Learning.