Error Detection Correction and Control

Embed Size (px)

Citation preview

  • 7/28/2019 Error Detection Correction and Control

    1/13

    Error Detection, Correction and Control

    During transmission, signals suffer from noise, distortions, interferences and attenuation, which can

    corrupt the data. Consequently, errors might be present at the receiver. Thus, it is necessary that there

    should be means of detecting error at the receiver to ensure that the received data is accurate at all

    times possible; and for some implementations, error correction may also be done. The key concept in

    error detection and correction is the by using additional bits to the raw data prior to transmission. This

    method is known as Redundancy. Redundancy bits are derived from the raw or original message to be

    transmitted. Upon reception, these added bits are either recomputed, from the received data, or

    compared with the received data. If disparity between the added bits and the data is found, then there

    could be an error to the received data. One should take note that redundancy bits do not add weight

    to the information content of the data to be transmitted. In effect, redundancy bits may reduce the

    coding efficiency of a transmission system.

    Types of Errors1. Single bit erroroccurs when only one bit in the data unit or data string has changed or is in error.2. Multiple bit erroroccurs when two or more non-consecutive bits in the data unit or data string

    have changed or are in error.

    3. Burst erroroccurs when there are two or more consecutive bits in the data unit or data stringhave changed or are in error.

    Recall that the Probability of Error or Bit Error Rate (BER) is used to measure the error performance of a

    transmission system.

    Sources of Errors

    The following describes sources of errors in data and ways to prevent errors in a transmissions system

    this includes users, machines and transmission schemes.

    The operator

    The operator may be considered as one of the sources of error based on the garbage-in-garbage-out

    concept. Remember that machines processes information fed to it. A misspelled word that was

    transmitted is a misspelled word that will be received later on.

    The machine

    There are some machines that can check on input data from a user, however, this does not prevent an

    operator, or a user to make mistake while using it. For example, an Automated Teller Machine (ATM)

    may prevent you from entering incorrect PIN, but it cannot prevent you from typing a wrong amount

    when withdrawing money from it.

  • 7/28/2019 Error Detection Correction and Control

    2/13

    The facilities

    One should take caution when comparing performances of two or more data links or transmission

    system. Take note that while the factor causing errors may be common in different communication

    links, being good is a relative term. That is, a few errors may have no adverse effect on a telegraph

    link, but in terms of a telephone link, the same amount of error may be unacceptable.

    The method of slower transmission

    Based on Information Capacity Theorem, channel capacity may be reduced when the SNR of a link

    degrades, resulting in slower transmission rate. This provide a margin in order to prevent occurrence of

    errors when the interference or noise increases while transmitting.

    The method of parallel transmission

    Parallel transmission basically has slower transmission rate than serial transmission, making it less

    susceptible to error than the latter.

    As illustrated in the figure, in parallel transmission, all 8 bits are received after one sec and each of the 8links has 1bps transmission rate. On the other hand, for serial transmission, all the 8 bits can be

    received after one sec, only if the link has 8bps transmission rate.

    Coding

    Redundancy bits are added to the message by the use of coding. There are two types of coding, block

    coding and convolution coding. Block coding divides the message into blocks, or data words, having k

    number of bits, redundancy bits r is then added to each block creating a codeword having n=k+r number

    of bits. Convolution coding uses a linear finite-state shift register. The information sequence is not

    divided into blocks, but is passed through the shift register to generate the convolution code.

    The Hamming DistanceAnother concept of error detection and correction is the hamming distance. Hamming distance refers to

    the number of bits a by which a character differs from another character. In its sense, the terms

    minimum hamming distance, refers to the smallest number of bits a character differs from another in a

    given set. Take the following examples

    8 bps

    Serial transmission

  • 7/28/2019 Error Detection Correction and Control

    3/13

    0110 and 0111, by XORing these two characters, the result is 0001, thus the hamming distanceis 1

    1110 and 1011, after XORing these two characters the result is 0101, thus the hamming distanceis 2

    11100111 and 10010000, after XORing, the result is 01111111, the hamming distance is 7It can be seen from these examples that the hamming distance also shows the number of errors that a

    character or message have.

    To understand its application in Error detection and control, geometric figures such as, circle, sphere

    and cube is used to represent the hamming distance. In the following discussions, a cube is used.

    In the first figure a minimum hamming distance of 1 is given for every character for example in moving

    from point A to point B. Moving from point A to point D would require two hamming distance or a

    difference of two bit. Lastly, moving from point A to point G requires three hamming distance or adifference of three bits. From this illustration, one can observe that if for example there has been error

    in the transmitted message, the first cube will not be able to detect the error. It is because all points are

    valid characters; an error in the received character would just be interpreted as another character.

    In the second cube, valid characters are separated by two hamming distance and there are four invalid

    characters. This cube shows how error detection in coding works. If there has been a single bit error in

    the message, for example, the received character is 010 instead of 000, then it will be interpreted as an

    invalid character (since there is no character assigned to 010), thus an error is detected. But if there are

    two or more bits in error, then the cube cannot guarantee to detect the error. Take note that the

    minimum number of bits to encode the four letters is two; that is 00, 01, 10 and 11. The addition of 1

    bit made room for the 4 unused characters or the invalid codes. The general rule in coding is that

    additional number of bits should be added in order to make it possible to detect errors. These

    additional bits are commonly referred to as the redundancy bits. The number of bits in error is related

    to the hamming distance:

  • 7/28/2019 Error Detection Correction and Control

    4/13

    The third cube shows how error correction works. if there has been an error in the received character,

    for example, 010 instead of 000, firs an error is detected (since 010 is an invalid code) then it is

    corrected by using the closest possible valid character (from 010) which is 000 or A. If on the other hand

    110 is received instead of 111, then it can be simply interpreted as 111 or G since point G is the closest

    point from the invalid character 110. The following formula may be used to guarantee that a coding

    scheme can detect up to N number of bits in error,

    Error Detection

    Error detection is the process of determining errors in the received message. It uses redundancy bits to

    detect errors. These redundancy bits were added prior to transmission and do not intensify the

    information in the message. There are four basic types of redundancy checking methods, vertical

    redundancy checking (VRC), checksums, longitudinal redundancy checking (LRC)and cyclic redundancy

    checking (CRC).

    Vertical Redundancy Checking (Simple Parity)

    VRC is generally known as character parity or simple parity. It is used to detect errors in every character

    transmitted. A single parity is added to each block of character having n number of bits to force the

    total number of logic 1s, including the parity bit, to be either an odd number or even number. The

    following are examples shows the computation of parity for the code 1100001.

    For odd parity

    Since the code, 1100001, has odd number of ones, the parity bit is 0, so that the total number

    of 1s in the character is odd. Resulting in 01100001 where the MSB is the parity bit.

    For even parity

    Since the code, 1100001, has even number of ones, the parity bit is 1, so that the total number

    of 1s in the character is even. Resulting in 11100001, where the MSB is the parity bit.

    In the receiver side, the parity bit is again computed from the character and checked against the

    received parity bit. If the computed is not the same as with the received parity bit, then an error has

    occurred and thus, a retransmission is requested. This method can only detect single bit error and, at

    some extent, odd number of bits in error. It cannot detect even number of bits in error.

    It should be noted that ASCII code 1977 version or ASCII- 77, is a seven bit code in which an odd parity is

    usually added as its MSB resulting in an 8 bit code. ASCII-77 is the universally accepted standard among

    the three ASCII versions, namely 1965, 1967 and 1977 versions. ASCII-77 is part of the

    recommendations of the International Telecommunications Union and of the International Standards

    Organization as the International Alphabet No. 5 and ISO-14962, respectively.

  • 7/28/2019 Error Detection Correction and Control

    5/13

    Longitudinal Redundancy Checking (LRC)

    LRC is also called message parity, because it can be used to detect errors in a given message. The

    following illustrates LRC

    For the message Error Bit in ASCII with odd parity in its MSB

    In this example, the LRC column is computed by XORing each bits in the same bit position or simply the

    even parity for each bits in the same bit position. The LRC also includes the MSB which is also the VRC

    for the ASCII code. The LRC is appended after the message Error Bit and its ASCII equivalent code is &

    (00100110). The transmitted message, including the LRC is Error Bit&

    E r r o r (space) B i t LRC

    b0 1 0 0 1 0 0 0 1 0 0

    b1 0 1 1 1 1 0 1 0 0 1

    b2 1 0 0 1 0 0 0 0 1 1b3 0 0 0 1 0 0 0 1 0 0

    b4 0 1 1 0 1 0 0 0 1 0

    b5 0 1 1 1 1 1 0 1 1 1

    b6 1 1 1 1 1 0 1 1 1 0

    b7(VRC) 1 1 1 1 1 0 1 1 1 0

    Checksum

    The main idea for checksum is to get the sum of the numerical value of the characters in to be

    transmitted and append it to the end of the message.

    For example in the message error the numerical value of the characters are

    b7 b6 b5 b4 b3 b2 b1 b0 HEX

    E 1 1 0 0 0 1 0 1 45

    r 1 1 1 1 0 0 1 0 72

    r 1 1 1 1 0 0 1 0 72

    o 1 1 1 0 1 1 1 1 6F

    r 1 1 1 1 0 0 1 0 72

    It should be noted that in ASCII, bit 7 or the MSB is the odd parity of each character, so it is not included

    in the numerical value of a character.

    The sum of all the characters in hexadecimal system is

  • 7/28/2019 Error Detection Correction and Control

    6/13

    In the transmitter side, the checksum is initialized to zero, then added to the partial sum, which in the

    example is 20A.

    Since 20A is a three character word, and thus there is not ASCII code for it, 20A is reduced to a two

    character code by getting its wrapped sum. The wrapped sum of 20A is obtained by adding the left most

    number to the right most number. So we have 0A+2 = 0C

    Then, the (r-1)s Complement of the wrapped sum is computed to get the checksum. The easiest way to

    compute for the (r-1)s complement of a number of a given base is by subtracting the number N to its

    modulus or its next higher multiple, this process is known as modulus-N (modulus-minus-N). In the

    example, the 1s C of0C is 10-0C= 04. Where 10 is the modulus of 0C, if for example, the wrapped sum

    is 25 in decimal, then the modulus of 25 is 100 in decimal, and its (r-1) s C is 100-25 = 75. In ASCII, 04 is a

    special character EOT which means end of transmission. It is appended after the message; therefore the

    message to be transmitted, including the checksum, is ErrorEOT. Take note that the modulus and the

    number N is on the same number system, thus care should be in carrying out the subtraction. Example,

    if N is 25 in hex, its modulus is 100 in hex, its (r-1)s complement is DB in hex, while if 25 is in decimal the

    (r-1)s C is 75.

    As a review, (r-1)s Complement is a general term, where r is the base of any number system. Ifr

    is 2 for binary number system, then it becomes (2-1)s complement or the more common term,

    1s complement. If r is 16 for hexadecimal system then it may be referred to as 15s

    complement; and 9s complement for decimal number system.

    In the receiver side, the numerical values of the received message, including the checksum, is added to

    compute for the checksum. If there is no error in the message the computed checksum is 0; otherwise

    there has been error in the received message, then a retransmission is requested.

    Checksum is a commonly used error detection scheme for the Internet. In this application, the

    characters are divided into 16 bit word before the checksum is computed

    Cyclic Redundancy Checking (CRC)

    Cyclic redundancy checking or CRC is part of a linear block code called cyclic code. In Cyclic

    Codes, if a code word is shifted or rotated, the result is another code word, that is

    A polynomial may be used to represent a cyclic code. The degree of the polynomial is equal to

    total number of bits in the code minus one, that is

    a7 a0a1a2a3a4a5a6

    b7 b0b1b2b3b4b5b6

  • 7/28/2019 Error Detection Correction and Control

    7/13

    The coefficient of the polynomial is chosen between 0 and 1 to represent the bit pattern of the

    code. For example, 11010001 may be written as

    Similarly, mathematical operations such as addition, subtraction, multiplication and division may

    be done to these equations.

    Cyclic redundancy checking is done by dividing a polynomial representing a dataword, with

    appended codewords set to all zeros, called augmented codeword to a predetermined divisorpolynomial. in the transmitter, the resulting remainder is appended to the original dataword to

    complete the codeword to be transmitted. At the receiver, the received codeword is divided

    with the same predetermined divisor. If there is no error, the remainder is zero; otherwise an

    error is detected and a retransmission is requested.

    There are set of standards for the predetermined divisors used in CRC, the most common is the

    CRC-16. The following shows the different CRCs and its corresponding divisors.

    A good polynomial generator must have the following characteristics

    1. It should have at least two terms2. The coefficient for X0 is 13. It should not dividext+1, where t is between 2 and n-14. It should have the factor x+1.

    The following illustrate how to derive the CRC for the data code 10110111 with a CRC code of

    110011.

    a7 a0a1a2a3a4a5a6

    x7

    x0

    x1

    x2

    x3

    x4

    x5

    x6

  • 7/28/2019 Error Detection Correction and Control

    8/13

    1. The datacode and the CRC code are first written in its equivalent polynomial form2. The datacode is multiplied by the first term of the CRC code, forming the augmented

    dataword

    3. The augmented dataword is divided by the CRC code. In this division, XOR is used.4. The remainder is appended to the end of the original dataword to be transmitted.5. if the leftmost part of the dividend is zero, then the divisors are set to all 0s.

    Analysis for the CRC

    1. Errors that are divisible by the generator polynomial or the CRC code may not be detected2. If the generator polynomial has at least two terms and X0 is 1, all single bit errors can be

    detected

    3. If a generator cannot divide xt+1, where t is between 0 and n-1, all isolated double errors can bedetected

    4. A generator that contains a factor of x+1 can detect all odd-numbered error bits

  • 7/28/2019 Error Detection Correction and Control

    9/13

    Error CorrectionThere are two ways to correct errors in the received message, Forward Error Correction (FEC) and

    retransmission. In FEC, the receiver tries to recover the correct bit or bits by using the redundancy bits,

    while in retransmission; the message is transmitted repeatedly until an error-free message is received.

    RetransmissionRetransmission is the most commonly used method in error correction because of its simplicity. It is

    based on the Automatic Repeat Request protocol or ARQ. If and error is detected, a retransmission is

    requested and the message is transmitted again. Retransmitting the message may be repeated until

    such time that a positive acknowledgement (ACK) is received from the recipient, which tells the sender

    that the correct or error free message has been received.

    Forward Error Correction Methods

    Forward Error Correction is used normally in a simplex type of communication or in cases where ARQ

    may not be possible. In this method, the receiver first detects the error, and tries to correct it using the

    received redundancy bits. Ash shown in the hamming distance discussion, error correction methods

    require more redundancy bits than in error detection methods resulting in a lower coding efficiency.

    This is one of the reasons why retransmission is a more preferred choice of correcting the error, the

    others are more complex receiver design and cost.

    Hamming Code

    Hamming code is the most popular error correcting code. It is named after Richard W. Hamming, who is

    considered as a pioneer in the development of error detection and correction procedures. R W

    Hamming developed the hamming code while he was working at the Bell Telephone Laboratories. The

    hamming code is designed to correct single bit error.

    To generate the code, it is first necessary to establish the number of bits that makes up the code; these

    bits are called the hamming bits. Hamming bits is commonly mistaken name for the hamming code;

    remember that the hamming bits are members of the hamming code. To determine the number of

    hamming bits n, this condition is used

    Where m is the number of bits in the data word and n is the number of hamming bits to be used.

    Once determined, the hamming bits may be inserted to the data word in a random locations or bit

    positions, as long as there is understanding between the sender and receiver where the codes are

    located.

    Information bits or data word: 100011100011, which is a 12 bit code. The number of hamming bits may

    be computed using trial and error, (starting from a reasonable value for n)

  • 7/28/2019 Error Detection Correction and Control

    10/13

    Since 23

    is equal to 8, then 12+3+1 which is equal to 16, so n=3 cannot satisfy the condition

    ;

    Since 24

    is equal to 16, then 12+4+1 which is equal to 17, so n=4 cannot satisfy the condition

    Since 25 is equal to 32, then 12+5+1 which is equal to 18, so n=5 satisfy the condition

    The five hamming bits are arbitrarily assigned as H1, H2, H3, H4 and H5, and are inserted to the

    information bits (may be in a random or predetermined order).

    The bit positions are numbered based on the ordinal sequence of the bits from the LSB to the MSB. Thebinary equivalent of the bit positions containing 1 are XORed to get the value of the hamming bits.

    1 0 0 0 0 1

    2 0 0 0 1 0

    0 0 0 1 1

    9 0 1 0 0 1

    0 1 0 1 0

    11 0 1 0 1 1

    0 0 0 0 1

    12 0 1 1 0 0

    0 1 1 0 1

    17 1 0 0 0 1

    1 1 1 0 0

    H1 H2 H3 H4 H5

    Therefore, the hamming code is 11100. The code word is

    At the receiver, the binary equivalent of the bit positions containing 1, not including the hamming bits,

    are also XORed with the hamming code for the purpose of detecting error, if the result are all zeros,

    then the received message is error free; otherwise the bit in error is determined and corrected.

  • 7/28/2019 Error Detection Correction and Control

    11/13

    HC 1 1 1 0 0

    1 0 0 0 0 1

    1 1 1 0 1

    2 0 0 0 1 0

    1 1 1 1 1

    9 0 1 0 0 1

    1 0 1 1 0

    11 0 1 0 1 1

    1 1 1 0 1

    12 0 1 1 0 0

    1 0 0 0 1

    17 1 0 0 0 1

    0 0 0 0 0no error

    detected

    If for example, bit 9 is in error,

    HC 1 1 1 0 0

    1 0 0 0 0 1

    1 1 1 0 1

    2 0 0 0 1 0

    1 1 1 1 1

    11 0 1 0 1 1

    1 0 1 0 0

    12 0 1 1 0 0

    1 1 0 0 0

    17 1 0 0 0 1

    0 1 0 0 1

    If there has been error in the received message, then the result of the XOR operation is not zero, instead

    the result may be interpreted as the bit position where error has occurred. From the above example, it

    can be seen that 01001 is 9 when converted to decimal, thus bit number 9 has an error. This error iscorrected by simply inverting the bit. Therefore, bit number 9 should be 1 instead of 0.

    Although hamming code can detect up to two bits in error, it cannot be used to detect burst or multiple

    errors. Also, if the hamming bits themselves were in error, then it will not be possible to detect the

    error at the receiver.

  • 7/28/2019 Error Detection Correction and Control

    12/13

    HC 1 1 0 0 0

    1 0 0 0 0 1

    1 1 0 0 1

    2 0 0 0 1 0

    1 1 0 1 1

    9 0 1 0 0 1

    1 0 0 1 0

    11 0 1 0 1 1

    1 1 1 0 1

    12 0 1 1 0 0

    1 0 0 0 1

    17 1 0 0 0 1

    0 0 0 0 0no error

    detected

  • 7/28/2019 Error Detection Correction and Control

    13/13

    References

    1. Wayne Tomasi, Electronics Communications Systems, Fundamentals to Advance, 5th ed.,Pearson Education Inc. 2004, Philippines.

    2. Behrouz Forouzan, Data Communications and Networking, 4th ed., Mc Graw Hill, 2007.3. John Proakis, Digital Communications, 4th ed., McGraw Hill, 2004. NY, USA.