0% found this document useful (0 votes)
50 views4 pages

DC02

1. This document describes a MATLAB program to generate a CRC code for error checking in data transmission. CRC involves appending check bits to a message and checking for errors by comparing the check bits at the receiver. 2. The program takes a binary input, performs modulo-2 division using a generator polynomial to produce a remainder as the CRC code. It then converts the CRC code to hexadecimal format. 3. The document provides theory on CRC, diagrams of CRC generation, the MATLAB code, and sample viva voce questions related to CRC concepts.

Uploaded by

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

DC02

1. This document describes a MATLAB program to generate a CRC code for error checking in data transmission. CRC involves appending check bits to a message and checking for errors by comparing the check bits at the receiver. 2. The program takes a binary input, performs modulo-2 division using a generator polynomial to produce a remainder as the CRC code. It then converts the CRC code to hexadecimal format. 3. The document provides theory on CRC, diagrams of CRC generation, the MATLAB code, and sample viva voce questions related to CRC concepts.

Uploaded by

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

Shri Vaishnav Institute of Technology & Science, Baroli, Indore

Number of experiment Pg No.1/4


Department of Electrical & Electronics Engineering
Code: DC No.: 02 Roll No

Sub. Code: BTEC515 Sub. Name: Data Communication Experiment No.: 02


Student’s Name: Batch: No. of Pages: Date:
Details of submissions & performance
Performing First Submission Second submission
Extra turn Regular turn

Remarks and Grade by tutor:

Cross Grade Exc VG G Fr M F Signature

EXPERIMENT NO. -02


AIM: Write a program to generate CRC code for checking error.
1. OBJECTIVES:
2.1 To understand the concept of CRC.
2.2 To simulate CRC code for checking error.
3. THEORY
Cyclic Redundancy Check:
The cyclic redundancy check or CRC is a technique for detecting error in digital data but not for
making correction when errors are detected, it is used primarily in data transmissions. In the
CRC method a certain number of check bits, often called a checksum, are appended to the
message being transmitted. The receiver can determine whether or not the check bits agree with
the data, to ascertain with a certain degree of probability whether or not an error occurred in
transmission. If an error occurred, the receiver sends a “negative acknowledgment” (NAK) back
to the sender, requesting that message is to be retransmitted.

Study Group. Data Communication Code of exp. DC-02


Created by:Dr. Swapnil Jain Modified by: Dr. Swapnil Jain On 24/7/19
Date of creation: 28/12/2017 Approved by: HOD
Shri Vaishnav Institute of Technology & Science, Baroli, Indore
Number of experiment Pg No.2/4
Department of Electrical & Electronics Engineering
Code: DC No.: 02 Roll No

Fig. 1 CRC generator at sender site

Fig. 2 CRC generator at receiver site

Study Group. Data Communication Code of exp. DC-02


Created by:Dr. Swapnil Jain Modified by: Dr. Swapnil Jain On 24/7/19
Date of creation: 28/12/2017 Approved by: HOD
Shri Vaishnav Institute of Technology & Science, Baroli, Indore
Number of experiment Pg No.3/4
Department of Electrical & Electronics Engineering
Code: DC No.: 02 Roll No

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

Attach screenshot of MATLAB program output

Study Group. Data Communication Code of exp. DC-02


Created by:Dr. Swapnil Jain Modified by: Dr. Swapnil Jain On 24/7/19
Date of creation: 28/12/2017 Approved by: HOD
Shri Vaishnav Institute of Technology & Science, Baroli, Indore
Number of experiment Pg No.4/4
Department of Electrical & Electronics Engineering
Code: DC No.: 02 Roll No

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.

Study Group. Data Communication Code of exp. DC-02


Created by:Dr. Swapnil Jain Modified by: Dr. Swapnil Jain On 24/7/19
Date of creation: 28/12/2017 Approved by: HOD

You might also like