Question

In: Computer Science

5. Implement 2-D error detection mechanism using even parity check. Given a data bit to be...

5. Implement 2-D error detection mechanism using even parity check. Given a data bit to be send, perform the even parity check for the data to be send. Append the parity bit at the end of that data. At the receiver end, the receiver has to check for errors in transmission

Please code in C language.

Solutions

Expert Solution

//Dear Student, I have spent a lot of time on it, so if you got something from it, then give an upvote. Thank you

#include <stdio.h>
int main()
{
    int parity(int a[],int b);
    int n,i;
    printf("Enter the length of the message 4-bit/8-bit/16-bit:");
    scanf("%d",&n);
    int send[n],rec[n],s,r;
    printf("Enter the senders message:");
    for(i=0;i<n;i++)
        scanf("%d",&send[i]);
    s=parity(send,n);
    printf("Enter the receivers message:");
    for(i=0;i<n;i++)
        scanf("%d",&rec[i]);
        r=parity(rec,n);
    printf("Parity bit for sender:%d\n",s);
    printf("Parity bit for receiver:%d\n",r);
    if(s==r){
        printf("No error");
    }
    else{
        printf("Error");
        }return 0;
}
        int parity(int p[],int n)
        {
            int i=n/2;
        int a[i],b[i],c[i];
        int j,k=0;
        for(j=0;j<n/2;j++)
        {
        a[j]=p[j];
        }

        for(j=i;j<n;j++)
        {
            b[k]=p[j];k++;
        }
        for(i=0;i<n/2;i++)
        {
            if(a[i]==b[i])
            {
                c[i]=0;
            }
            else
            {
                c[i]=1;
                
            }
        }
        int count=0;
        for(i=0;i<n/2;i++)
        {
            if(c[i]==1)count++;
        }
        if(count%2==0)
        {
        return 0;
        }
        else
        {
        return 1;
        }
}

The output of above code will display as:


Related Solutions

2-D bit parity is generated by placing the data bits in a matrix form as shown...
2-D bit parity is generated by placing the data bits in a matrix form as shown below. Then, a parity bit is computed for every row and every column: These parity bits are shown in grey. Assume that even parity is used (as shown below). Assume throughout that the receiver is guaranteed that no more than 2 errors are possible. 1 0 1 0 1 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0...
Given the 21-bit even-parity Hamming code: 0 1010 0111 0011 0000 0101 and assuming there is...
Given the 21-bit even-parity Hamming code: 0 1010 0111 0011 0000 0101 and assuming there is one incorrect bit. a. Which bit is incorrect? My educated guess for what the incorrect bit maybe has me thinking it is the '1' bit at the end of the '0111' byte, but I have no full proof as to why it is that specific bit. Am I in the right area to think that? b. After the error is corrected, what decimal number...
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned...
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned inputs (A and B), a 4-bit unsigned product outputs (P). you must use some full adders and gates (AND, OR, NOT, XOR).
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned...
Implement a 2 by 2 multiplier using structure VHDL. The circuit will have two 2-bit unsigned inputs (A and B), a 4-bit unsigned product outputs (P). Please use some full adders and gates (AND, OR, NOT, XOR).
Try designing a 4 bit Multiplexer using two 2-bit multiplexer design given below and verify the...
Try designing a 4 bit Multiplexer using two 2-bit multiplexer design given below and verify the design by simulating it. module Mux2x1(In0,In1,sel,out); input In0,In1,sel; output out; assign out = (sel)?In1:In0; endmodule Pls include the verilog design module,testbench, waveform
5. Below is a table showing composition data for clove oil, obtained using two different detection...
5. Below is a table showing composition data for clove oil, obtained using two different detection methods (with the same sample), FID and mass spectrometry. Explain why the composition (based on relative peak areas of the GC trace) is different for these data sets. Are either of these the “real” composition of the clove oil? Hint: Response factor FID MS detector Area Area% Area Area% Eugenol 86.78 87.73 137.95 75.84 Caryophyllene 2.03 2.05 10.26 5.64 Eugenol Acetate 10.11 10.22 33.68...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions: a.6thbit position. b.11thbit position.Assume an odd-parity scheme for this problem.
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions: a. 6th bit position. b. 11th bit position. Assume an odd-parity scheme for this problem.
Determine whether the given conditions justify using the margin of error E = z/2 / when...
Determine whether the given conditions justify using the margin of error E = z/2 / when finding a confidence interval estimate of the population mean . The sample size is n = 8,  = 12.1, and the original population is normally distributed. Group of answer choices Yes No
Given the data set A = {5, 4, 6, 14, 2, 2, 11, 4, 5, 8,...
Given the data set A = {5, 4, 6, 14, 2, 2, 11, 4, 5, 8, 3, 1, 12, 15, 13}, which is the data of a sample taken from a larger population. Calculate the arithmetic mean Find the median Find the mode Calculate the range Calculate the interquartile range Calculate the mean deviation Calculate the variance Calculate the standard deviation
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT