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

Green University of Bangladesh

The document is a lab report on cyclic redundancy check (CRC) submitted by Mahmuda Akter to Mohammad Ehsan Shahmi Chowdhury. [1] The report includes the theory of CRC, which uses an algorithm to generate parity bits that are added to data bits before transmission to detect accidental changes. [2] The source code provided implements CRC by performing binary division of the message by a generator polynomial and using the remainder as the checksum. [3] The program demonstrates CRC by transmitting a message with an appended checksum and detecting any errors at the receiver.

Uploaded by

Abu Talha
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)
31 views4 pages

Green University of Bangladesh

The document is a lab report on cyclic redundancy check (CRC) submitted by Mahmuda Akter to Mohammad Ehsan Shahmi Chowdhury. [1] The report includes the theory of CRC, which uses an algorithm to generate parity bits that are added to data bits before transmission to detect accidental changes. [2] The source code provided implements CRC by performing binary division of the message by a generator polynomial and using the remainder as the checksum. [3] The program demonstrates CRC by transmitting a message with an appended checksum and detecting any errors at the receiver.

Uploaded by

Abu Talha
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/ 4

GREEN UNIVERSITY OF BANGLADESH

LAB Report No.: 07


LAB Report Name: Cyclic Redundancy check
COURSE TITEL: Data Communication LAB
COURSE CODE: CSE 308

Date of Performance : 23 – 04 – 2020


Date of Submission : 03 – 06 – 2020

Submitted To
Mohammad Ehsan Shahmi Chowdhury
Lecturer
Department of CSE

Submitted By
Name: Mahmuda Akter
ID: 181002013
Section: 181_DD
Dept.: CSE
Report Name: Cyclic Redundancy check

Theory:
Cyclic Redundancy check: -
A cyclic redundancy check (CRC) is an error -detecting code
commonly used in digital communication and storage devices to
detect accidental changes to raw data. Most often used method for
error detection is to add parity bits to existing data bi ts before
transmitting. Every error detection method uses certain algorithm to
generate parity bits based on existing data bits and CRC is one of
them.

SOURCE CODE:

#include<iostream>
using namespace std;
void division(int temp[],int gen[],int n,int r)
{
for(int i=0; i<n; i++)
{
if (gen[0]==temp[i])
{
for(int j=0,k=i; j<r+1; j++,k++)
if(!(temp[k]^gen[j]))
temp[k]=0;
else
temp[k]=1;
}
}
}
int main()
{
int n,r,message[50],gen[50],temp[50];
cout<<"At Sender's End "<<endl;
cout<<"Enter the number of message bits : ";
cin>>n;
cout<<"Enter the number of generator bits : ";
cin>>r;
cout<<"Enter the message : ";
for(int i=0; i<n; i++)
cin>>message[i];
cout<<"Enter the generator : ";
for(int i=0; i<r; i++)
cin>>gen[i];
r--;
for(int i=0; i<r; i++)
message[n+i] = 0;
for(int i=0; i<n+r; i++)
temp[i] = message[i];
division(temp,gen,n,r);
cout<<"CRC : ";
for(int i=0; i<r; i++)
{
cout<<temp[n+i]<<" ";
message[n+i] = temp[n+i];
}
cout<<endl<<"Transmitted Message : ";
for(int i=0; i<n+r; i++)
cout<<message[i]<<" ";
cout<<endl<<endl<<"At Receiver's End "<<endl;
cout<<"Enter the received message : ";
for(int i=0; i<n+r; i++)
cin>>message[i];
for(int i=0; i<n+r; i++)
temp[i] = message[i];
division(temp,gen,n,r);
for(int i=0; i<r; i++)
{
if(temp[n+i])
{
cout<<"Error detected in received
message.";
return 0;
}
}
cout<<"No error in received Message.\nReceived
Message : ";
for(int i=0; i<n; i++)
cout<<message[i]<<" ";
return 0;
}

INPUT/ OUTPUT:

Discussion:
In this Lab, I learn about Error detection and correction technique which is
Cyclic Redundancy check error detection.

You might also like