Sie sind auf Seite 1von 42

Week 5 Error Detection and

Correction

COSC2174 Data
Communication and Net-Centric

Anna Felipe
Learning Objective
Understand error classification

Types of Error

Understand concept redundancy

10/01/2017 RMIT University Vietnam 2


Error Detection
Transmission channel has impairments

o Finite probability of an error

Reliable communication

o The receiver should be able to detect the presence


of errors in received data

o Error detected a mechanism to recover correct


information needed

10/01/2017 RMIT University Vietnam 3


Error Detection 2
Backward error detection

o Each transmitted byte contains additional


information allowing receiver to check

o Error detected request for re-transmission of data

10/01/2017 RMIT University Vietnam 4


Error Classification
Attenuation

o As signal travels through the medium, its strength


decreases as distance increases.

Noise

o Defined as an unwanted data. When some


electromagnetic signal gets inserted during the
transmission, it is generally called as a Noise.

10/01/2017 RMIT University Vietnam 5


Error Classification 2
Distortion

o When there is an interference of the different


frequencies who travel across the medium with the
different speed, distortion occurs.

10/01/2017 RMIT University Vietnam 6


Types of Error
Single-bit error In a single-bit error, only
one bit in the data unit
0 0 01 0 0 0 0 00000010
Received Sent has changed
Burst errors
A burst error means 2 or
Length of burst
error (5 bits)
Sent
0 1 0 0 0 10 0 0 1 0 0 0 0 1 1 more bits in the data
Bits corrupted by burst error
unit have changed
0101110101000011
Received

10/01/2017 RMIT University Vietnam 7


Redundancy
In order to detect and correct the errors in the data
communication we add some extra bits to the original.
These extra bits are nothing but the redundant bits
which will be removed by the receiver after receiving
the data.

Different techniques used for transmission error


detection and correction

10/01/2017 RMIT University Vietnam 8


Redundancy 2

10/01/2017 RMIT University Vietnam 9


Parity Check
All code words have even # of 1s
Receiver checks to see if # of 1s is even (or odd for
odd-parity)
o All error patterns that change an odd # of bits are
detectable
o All even-numbered patterns are undetectable
Parity bit used in ASCII code

10/01/2017 RMIT University Vietnam 10


Parity Check 2
Sender node

Drop parity
bit and accept data 1100001

Data
Reject Yes
data
Even?
No

Calculate
Count parity bit
bits

Bits 1100001 1

Transmission Medium

10/01/2017 RMIT University Vietnam 11


Example of Single Parity Code
Information (7 bits): (0,1,0,1,1,0,0)

Parity bit: b8= 0 + 1 + 0 + 1 + 1 + 0 + 0 = 1

Codeword (8 bits): (0,1,0,1,1,0,0,1)

If single error in bit 3: (0,1,1,1,1,0,0,1)

o # of 1s = 5, odd

o Error detected

10/01/2017 RMIT University Vietnam 12


Example of
Single Parity Code 2
If errors in bit 3 and bit 5: (0,1,1,1,0,0,0,1)

o # 0f 1s = 4, even

o Error not detected

10/01/2017 RMIT University Vietnam 13


Two Dimensional Parity Check
Many parity bits to improve coverage

Arrange information as columns

Add single parity bit to each column

Add a final parity column

Used in early error control systems

10/01/2017 RMIT University Vietnam 14


Two Dimensional Parity Check 2
1 0 0 1 0 0
0 1 0 0 0 1
Last column
1 0 0 1 0 0 consists of
check bits for
1 1 0 1 1 0 each row
1 0 0 1 1 1
Bottom row consists
of check bit for each
column

10/01/2017 RMIT University Vietnam 15


Error Detecting Capability
If 1, 2 or 3 errors occur 10010 0
10010 0

anywhere in the matrix 00000 1


One
00000 1
Two
10010 0
10010 0 errors errors
during transmission, 11011 0
10011 0

10011 1
then at least one row or 10011 1

10010 0 10010 0

parity check will fail 00010 1 Three


errors
00010 1
Four errors
10010 0 10010 0
(undetectable)

Not all patterns > 4 10011 0 10001 0

10011 1 10011 1
errors can be detected Arrows indicate failed check bits

10/01/2017 RMIT University Vietnam 16


Other Error Detection Code
Many applications require very low error rate

Need codes that detect the vast majority of errors

Single parity check codes do not detect enough errors

Two-dimensional codes require too many check bits

The following error detecting codes used in practice:

o Internet Check Sum

o CRC Polynomial Codes

10/01/2017 RMIT University Vietnam 17


Cyclic Redundancy Check (CRC)
Common and most powerful error detecting code is
CRC

o Given as block of k bits, the transmitter generates n


bit sequence called Frame Check Sequence (FCS)

o Resulting frame k+n bits which is exactly divisible by


some predetermined number

10/01/2017 RMIT University Vietnam 18


Cyclic Redundancy Check
(CRC) 2
Receiver divides frame by that number

o If no remainder, assume no error

Because of features of modulo-2 arithmetic, both


transmitter and receiver use same divisor

10/01/2017 RMIT University Vietnam 19


Example Error

Image:Fix a Cyclic Redundancy Check Error Step 1.jpg


10/01/2017 RMIT University Vietnam 20
CRC Example base 2 method
Example Frame Check Sequence

Given data o Pattern 1 bits

o 1101 1100 1110 o 4 1 = 3 bits

Pattern

o 1101

10/01/2017 RMIT University Vietnam 21


CRC Example base 2 method 2
Sender side
1101 1101 1100 1110 000
1101
1100
1101
1 111
1 101
100 0
110 1
10 10
1101
1110
1101
011

10/01/2017 RMIT University Vietnam 22


CRC Example base 2 receiver side
Append the remainder to the given data

Use the same pattern for division

If no remainder then the transmission is error free

10/01/2017 RMIT University Vietnam 23


CRC Example base 2 receiver side
2
1101 1101 1100 1110 011
1101
1100
1101
1 111
1 101 Receiver side
100 0
110 1
10 11
11 01
1 101
1 101
0 000

10/01/2017 RMIT University Vietnam 24


Example
Given

o Message D = 1010001101 (10 bits)

o Pattern P = 110101 (6 bits)

o FCS R = to be calculated (5 bits)

n = 15, k = 10 and (n-k) = 5

10/01/2017 RMIT University Vietnam 25


Example 2
The message is multiplied by 25

o 101000110100000

This product is divided by P


Cyclic Redundancy Check Polynomials Tutorial

10/01/2017 RMIT University Vietnam 26


CRC Shifted poly method
Essentially same like base 2 method

Convert your given data and pattern to polynomial


format. Example given below:

Apply polynomial
division and follow
procedures that you
learn in base 2 method

10/01/2017 RMIT University Vietnam 27


Checksum Method
The sender follow these steps:

o The unit is divided into k sections, each of n bits.

o All sections are added using ones complement to


get the sum.

o The sum is complemented and becomes the


checksum

o The checksum is sent with the data

10/01/2017 RMIT University Vietnam 28


Checksum Method 2
The receiver follow these steps:

o The unit is divided into k sections, each of n bits.

o All sections are added using ones complement to


get the sum.

o The sum is complemented

o If the result is zero, the data are accepted:


otherwise, rejected

10/01/2017 RMIT University Vietnam 29


Checksum Example sender side
Suppose the following block of 16 bits is to be sent
using a checksum of 8 bits.

10101001 00111001

10/01/2017 RMIT University Vietnam 30


Checksum Example sender side
2
Using ones complement
10101001
00111001
Sum 11100010
Checksum 00011101
The pattern sent is 10101001 00111001 00011101

10/01/2017 RMIT University Vietnam 31


Checksum Example receiver
side
Now suppose the receiver receives the pattern sent
and there is no error.

10101001 00111001 00011101

10/01/2017 RMIT University Vietnam 32


Checksum Example receiver
side 2
When the receiver adds the three sections, it will get all
1s, which, after complementing, is all 0s and shows that
there is no error.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the pattern is OK

10/01/2017 RMIT University Vietnam 33


Example
How can we represent the number 6 in ones
complement arithmetic using only four bits?

10/01/2017 RMIT University Vietnam 34


Example 2
Solution
In ones complement arithmetic, the negative or
complement of a number is found by inverting all bits.
Positive 6 is 0110; negative 6 is 1001. If we consider only
unsigned numbers, this is 9. In other words, the
complement of 6 is 9. Another way to find the complement
of a number in ones complement arithmetic is to subtract
the number from 2n 1 (16 1 in this case).

10/01/2017 RMIT University Vietnam 35


Example 3
Suppose our data is a list of five 4-bit numbers that we
want to send to a destination. In addition to sending these
numbers, we send the sum of the numbers. For example,
if the set of numbers is (7, 11, 12, 0, 6), we send (7, 11,
12, 0, 6, 36), where 36 is the sum of the original numbers.
The receiver adds the five numbers and compares the
result with the sum.

10/01/2017 RMIT University Vietnam 36


Example 4
If the two are the same, the receiver assumes no error,
accepts the five numbers, and discards the sum.
Otherwise, there is an error somewhere and the data are
not accepted. The sender initializes the checksum to 0
and adds all data items and the checksum (the checksum
is considered as one data item and is shown in color).

10/01/2017 RMIT University Vietnam 37


Example 5
The result is 36. However, 36 cannot be expressed in 4
bits. The extra two bits are wrapped and added with the
sum to create the wrapped sum value 6. In the figure, we
have shown the details in binary. The sum is then
complemented, resulting in the checksum value 9 (15 6
= 9). The sender now sends six data items to the receiver
including the checksum 9.

10/01/2017 RMIT University Vietnam 38


Example 6

10/01/2017 RMIT University Vietnam 39


Example 7
Let us calculate the checksum for a text of 6 characters
(Felipe). The text needs to be divided into 2-byte (16-bit)
words. We use ASCII to change each byte to a 2-digit
hexadecimal number.

10/01/2017 RMIT University Vietnam 40


Summary
In this lecture, we have:

o Understood Error detection

o Parity Check, Checksum, CRC

o Examples error detection methods

10/01/2017 RMIT University Vietnam 41


Reference
Behrouz, Forouzan, Data Communication &
Networking, McGraw Hill, 2013

Stalling, William, Data and Computer Communications


9th ed, Pearson, 2011

10/01/2017 RMIT University Vietnam 42

Das könnte Ihnen auch gefallen