Vous êtes sur la page 1sur 7

EX.

NO: 3a

DESIGN AND PERFORMANCE ANALYSIS OF ERROR

DATE:

CONTROL ENCODER AND DECODER


USING CRC

AIM
To design a CRC code error control encoder and decoder for detecting the transmission
error.
SOFTWARE TOOL REQUIRED

MATLAB Version 7.1

INTRODUCTION TO ERROR CONTROL ENCODER AND DECODER


An encoder is a device or entity that will encode information in a particular way;
compressing, converting or securing it to a different format. Encoding is a popular way of
securing data and information and the encoding process essentially scrambles all the pieces of
the data up and they are then put back together at the other end by the decoder.
A decoder is the device or entity that will remove the information from its previously
encoded state and return it to its original format.
Encoders and decoders are similar to multiplexers and demultiplexers, except that they
are a little bit more complicated. Decoders will have N inputs, and 2N outputs. Encoders work in
exactly the opposite way as decoders, taking 2N inputs, and having N outputs.
ERROR
An error is a deviation from a correct value caused by a malfunction in a system or a
functional unit The error can completely change the meaning of the data sent. Error occurs
because of transmission impairments signal gets attenuated, overwhelmed by noise.

TYPES OF ERROR

Single bit error


Only one bit of a given data unit is changed from 1 to 0 or from 0 to 1.

Multi bit or Burst Error


Two or more bits in the data unit have changed from 1 to 0 or from 0 to
1.Burst error doesnt necessarily mean that the errors occur in consecutive bits.
The length of the burst is measured from the fist corrupted bit to last corrupt bit.
Some its in between may not have been corrupted.

ERROR DETECTION
Error detection is the ability to detect the presence of errors caused by noise or other
impairments during transmission from the transmitter to the receiver.
ERROR CORRECTION
Error correction is the additional ability to reconstruct the original, error free data. Error
correcting codes enable data to be sent through a noisy communication channel without
corruption. To accomplish this, the sender appends redundant information to the message. So that
even if some of the original data is corrupted during transmission, the receiver can still recover
the original message intact.
Various methods
Parity
Repetition
Hamming code

CRC CODES
A cyclic redundancy check (CRC) is an error-detecting code .. Blocks of data entering
these systems get a short check value attached, based on the remainder of a polynomial
division of their contents; on retrieval the calculation is repeated, and corrective action can be
taken against presumed data corruption if the check values do not match.
CRCs are so called because the check (data verification) value is a redundancy (it adds
no information to the message) and the algorithm is based on cyclic codes..The check value has a
fixed length, the function that generates it is occasionally used as a hash function.
CRCs

are

based

on

the

theory

of cyclic error-correcting

codes.

The

uses

of systematic cyclic codes, which encode messages by adding a fixed-length, check value, for the
purpose of error detection in communication networks. Cyclic codes are not only simple to
implement but have the benefit of being particularly well suited for the detection of burst errors,
contiguous sequences of erroneous data symbols in messages. This is important because burst
errors are common transmission errors in many communication channels, including magnetic
and optical storage devices.
Typically an n-bit CRC applied to a data block of arbitrary length will detect any single
error burst not longer than n bits and will detect a fraction 12n of all longer error bursts.
Specification of a CRC code requires definition of a so-called generator polynomial. This
polynomial resembles the divisor in a polynomial long division, which takes the message as
the dividend, and in which the quotient is discarded and the remainder becomes the result, with
the important distinction that the polynomial coefficients are calculated according to the carryless arithmetic of a finite field.
The length of the remainder is always less than the length of the generator polynomial,
which therefore determines how long the result can be.

ADVANTAGES

CRC is simple to implement in binary hardware.

Mathematical analysis of CRC is very simple, & it is good at detecting common errors
caused by noise in transmission

DISADVANTAGE

CRC is not suitable for protecting against intentional alteration of data, and overflow of
data is possible in CRC.

APPLICATIONS

Commonly used in Digital Networks.

PROCEDURE

Set the message.

Set the divisor.

Xor the message with divisor.

Check the remainder.

Display the result in command window.

CODING
clc;
clear all;
close all;
msg=[1 1 0 0]
div=[1 0 1 0]
[r c]=size(msg);
x=[];
for i=1:c
if i==1
x=bitxor(msg,div);
x=[x(2) x(3) x(4) x(1)];
else
x=bitxor(x,div);
end
if x(1)==0
x=[x(2) x(3) x(4) x(1)];
end
end
syn=[x(1) x(2) x(3)]
msg1=[1 1 1 1];
received=[msg1 syn]
div=[1 0 1 0];

[r1 c1]=size(msg1);
x1=[];

for j=1:c1
if j==1
x1=bitxor(msg1,div);
x1=[x1(2) x1(3) x1(4) x(j)];
else
x1=bitxor(x1,div);
x1=[x1(2) x1(3) x1(4) x(j)];
end
if x1(1)==0
x=[x1(2) x1(3) x1(4) x1(1)];
end
end
syn1=[x1(1) x1(2) x1(3)]
if syn1==0
disp('Transmission Success')
else
disp('Transmission Error')
end

RESULT:

Thus a CRC code error control encoder and decoder for detecting the transmission error
was designed successfully.