Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views3 pages

CRC Ccitt

Uploaded by

Rakshith
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)
3 views3 pages

CRC Ccitt

Uploaded by

Rakshith
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/ 3

//crc can detect all single bit error, double bit, odd bits of error and burst error

#include<stdio.h>

#include<string.h>

#define N strlen(g)

char t[28],cs[28],g[]="10001000000100001";

int a,i,j;

void xor()

for(j = 1;j < N; j++)

cs[j] = (( cs[j] == g[j])?'0':'1');

void crc()

for(i=0;i<N;i++)

cs[i]=t[i];

do

if(cs[0]=='1')

xor();

for(j=0;j<N-1;j++)

cs[j]=cs[j+1];

cs[j]=t[i++];
}while(i<=a+N-1);

int main()

printf("\nEnter data : ");

scanf("%s",t);

printf("\n - ");

printf("\nGenerating polynomial : s",g);

a=strlen(t);

for(i=a;i<a+N-1;i++)

t[i]='0';

printf("\n - ");

printf("\nModified data is : %s",t);

printf("\n____________________- ");

crc();

printf("\nChecksum is : %s",cs);

for(i=a;i<a+N-1;i++)

t[i]=cs[i-a];

printf("\n___________________- ");

printf("\nFinal codeword is : %s",t);

printf("\n___________________- ");

printf("\nEnter received message ");

scanf("%s",t);

crc();

for(i=0;(i<N-1) && (cs[i]!='1');i++);


if(i<N-1)

printf("\nError detected\n\n");

else

printf("\nNo error detected\n\n");

printf("\n

return 0;

You might also like