CRC receiver
// Include headers #include<stdio.h> #include<string.h> // length of the generator polynomial #define N strlen(gen_poly) // data to be transmitted and received char data[28]; // CRC value char check_value[28]; // generator polynomial char gen_poly[10]; // variables int data_length,i,j; // function that performs XOR operation void XOR(){ // if both bits are the same, the output is 0 // if the bits are different the output is 1 for(j = 1;j < N; j++) check_value[j] = (( check_value[j] == gen_poly[j])?'0':'1'); } // Function to check for errors on the receiver side void receiver(){ // get the received data printf("Enter the received data: "); scanf("%s", data); printf("\n-----------------------------\n"); printf("Data received: %s", data); // Cyclic Redundancy Check crc(); // Check if the remainder is zero to find the error ...
Comments
Post a Comment