Error Detection
Error Detection
Error detection
Errors in data communications occur when the value of a bit is altered from 1 to 0 or vice
versa. This chapter looks at how errors are produced and the types of error detection,
control, and correction available.
Objectives
When you have completed studying this chapter you will be able to:
• Describe the origin of errors
• List and explain the factors affecting the propagation of signals
• List and explain the methods of feedback error control
• Explain forward error correction
Attenuation
Signal attenuation is the decrease in signal amplitude, which occurs as a signal is
propagated through a transmission medium.
A limit needs to be set on the maximum length of cable allowable before one or more
amplifiers, or repeaters, must be inserted to restore the signal to its original level. The at-
tenuation of a signal increases for higher frequency components. Devices such as
equalizers can be employed to equalize the amount of attenuation across a defined band
of frequencies.
Limited bandwidth
Essentially, the larger the bandwidth of the medium the closer the received signal will be
to the transmitted one.
The Hartley Law is used to determine the maximum data transfer rate of a transmission
line, in the absence of noise:
For example:
A modem using Phase QAM, four levels per signaling element and a bandwidth on the
public telephone network of 3000 Hz, has a maximum data transfer rate calculated by:
Delay distortion
When transmitting a digital signal, the different frequency components arrive at the
receiver with varying delays between them. The received signal is affected by delay
distortion. Intersymbol interference occurs when delays become sufficiently large that
frequency components from different discrete bits interfere with each other. As the bit
rate increases, delay distortion can lead to an increasingly incorrect interpretation of the
received signal.
104 Practical Data Communications for Instrumentation and Control
Noise
An important parameter associated with the transmission medium is the concept of signal
to noise ratio (S/N ratio). The signal and noise levels will often differ by many orders of
magnitude, so it is common to express the S/N ratio in decibels where:
Error detection 105
S/N ratio = 10 Log10 S/N dB
where:
S is the signal power in watts
N is the noise power in watts
For example:
an S/N ratio of 1 000 000, is referred to as 60 dB
To calculate the maximum theoretical data rate of a transmission medium we use the
Shannon-Hartley Law, which states:
Max data Rate = B log2 (1 + S/N) bps
where:
B is the bandwidth in Hz
For example:
with an S/N ratio of 100, and a bandwidth of 3000 Hz, the maximum theoretical data rate
that can be obtained is given by:
Maximum information rate =3000 log 2 (1 + 100)
=19 963 bits per second
Although parity has significant weaknesses it is still used where the application is not
critical, such as transmitting data to a printer, or communicating between adjacent
components in a common electrical system where the noise level is low. Parity is
appropriate where the noise burst length is expected to not exceed one bit, i.e. only single
bit errors can be expected. This means it is only effective for slow systems. Parity error
detection is not used much today for communication between different computer and
control systems. Sophisticated algorithms, such as block redundancy, longitudinal parity
check, and cyclic redundancy check (CRC), are preferred where the application is more
critical.
Arithmetic checksum
An extension of the VLRC is the arithmetic checksum, which is a simple sum of
characters in the block. The arithmetic checksum provides better error checking
capabilities than VLRC. The arithmetic checksum can be 1 byte (for messages up to 25
characters) or 2 bytes (for messages up to 50 characters in length).
Table 4.2
Block redundancy: arithmetic checksum
Cyclic redundancy check (CRC)
For longer messages, an alternative approach has to be used. For example, an Ethernet
frame has up to 1500 bytes or 12 000 bits in the message. A popular and very effective
error checking mechanism is cyclic redundancy checking. The CRC is based upon a
branch of mathematics called algebra theory, and is relatively simple to implement. Using
a 16 bit check value, CRC promises detection of errors as shown in Table 4.3. (1)
Table 4.3
CRC error reduction (1)
The CRC error detection mechanism is obviously very effective at detecting errors,
particularly difficult to handle ‘burst errors’, where an external noise source temporarily
swamps the signal, corrupting an entire string of bits. The CRC is effective for messages
of any length.
Polynomial notation
Before discussing the CRC error checking mechanisms, a few words need to be said
about expressing the CRC in polynomial form. The binary divisor, which is the key to the
successful implementation of the CRC, is:
10001000000100001
CRC-16
CRC-16 is another widely used polynomial, especially in industrial protocols:
X16 +X15 + X2 + 1
CRC-16 is not quite as efficient at catching errors as CRC-CCITT, but is popular due to
its long history in IBM’s binary synchronous communications protocol (BISYNC)
method of data transfer.
The CRC-16 method of error detection uses modulo-2 arithmetic, where addition and
subtraction give the same result. The output is equivalent to the exclusive OR (XOR)
logic function, as given in Table 4.4.
Table 4.4
Truth table for exclusive OR (XOR) or Modulo-2 addition and subtraction
(2)
CRC-CCITT is specified in recommendation V.41, ‘Code-Independent Error Control
System’, in the CCITT Red Book
216 – in multiplying, effectively adds 16 zeros to the right side of the message.
Divisor – is a number which is divided into the (message × 216) number and is the
generating polynomial.
Quotient – is the result of the division.
Remainder – is the value left over from the result of the division and is the CRC
checksum.
Equation 4.1 then becomes:
Equation 4.2:
[(Message × 216) + Remainder] / Divisor = Quotient
This information is implemented in the transmitter, using Equation 4.1, as follows:
• Take the message which consists of a stream of bits
[01001000] [11000101] [11001100] [0101000]
• Add 16 zeros to the right side of the message to get
[01001000] [11000101] [11001100] [0101000] [00000000] [00000000]
• Divide modulo-2 by a second number, the divisor (or generating polynomial)
e.g. 11000000000000101 (CRC-16) the resulting remainder is called the CRC
checksum
• Add on the remainder as a 16 bit number to the original message stream (i.e.
replace the 16 zeros with the 16 bit remainder) and transmit it to a receiver
At the receiver the following sequence of steps is followed, using Equation 4.1:
• Take the total message plus the CRC checksum bits and divide by the same
divisor as used in the transmitter
• If no errors are present, the resulting remainder is all zeros (as per
Equation 4.2)
• If errors are present then the remainder is non zero
The CRC mechanism is not perfect at detecting errors. Intuitively, the CRC checksum
(consisting of 16 bits) can only take on one of 216 (65 536) unique values. The CRC
checksum, being a ‘fingerprint’ of the message data, has only 1 of 65 536 types. Logi-
cally it should be possible to have several different bit patterns in the message data, which
is greater than 16 bits that can produce the same fingerprint. The likelihood that the
original data and the corrupted data will both produce the same fingerprint is however
negligible.
The error detection schemes examined only allow the receiver to detect when data has
been corrupted. They do not provide a means for correcting the erroneous character or
frame. This correction is normally accomplished by the receiver informing the transmitter
that an error has been detected and requesting another copy of the message to be sent.
This combined error detection/correction cycle is known as error control.
110 Practical Data Communications for Instrumentation and Control
This code has a Hamming distance of 2, as two bits at least have to be in error before
the receiver reads an erroneous character.
It can be demonstrated that a Hamming distance of three requires three additional bits,
if there are four information bits. This is referred to as a Hamming (7,4) code. For a 4-bit
information code, a 7-bit code word is constructed in the following sequence:
CCICIII
112 Practical Data Communications for Instrumentation and Control
1 2 3 4 5 6 7
where:
I 3I 5I 6I 7 are the information, or useful bits
C1C2C4 are the redundant bits calculated as follows:
- C1 = I3 XOR I 5 XOR I7
- C2 = I3 XOR I6 XOR I7
- C4 = I5 XOR I6 XOR I7
For example:
If the information bits are 1101
(I3 = 1; I5 = 1; I6 = 0; I7 = 1), the Hamming (7,4) codeword is:
- C = 1 XOR 1 XOR 1 = 1
1
- C2 = 1 XOR 0 XOR 1 = 0
- C4 = 1 XOR 0 XOR 1 = 0
The codeword (C 1C 2I 3C4I5I6I7) is then represented as 1010101.
If one bit is in error and the codeword 1010111 was received, the redundant bits would
be calculated as:
- C1 = 1 XOR 1 XOR 1 = 1
(and matches the 1 from the received codeword)
- C2 = 1 XOR 1 XOR 1 = 1
(but does not match the 0 from the received codeword)
- C4 = 1 XOR 1 XOR 1 = 1
(but does not match the 0 from the received codeword)
C2 and C4 indicate one bit out of place, which would be either I6 or I7 (as this is
common to both). However C1 matches the check calculation, therefore I6 must be in
error.
Hence, the code word should be: 1010101.