Error Correction and Detection
Error Correction and Detection
0 0 0 1 1 0 1 1 1 1 0 0 1 0
Example 1
Determine the UPC label structure for the digit 0.
Solution From Figure 3a, the binary sequence for the digit 0 in the left-hand character field is
0001101, and the binary sequence for the digit 0 in the right-hand character field is 1110010.
The left-hand sequence is comprised of three successive 0s, followed by two 1s, one 0, and one 1.
The three successive 0s are equivalent to a space three bits long. The two 1s are equivalent to a bar
two bits long. The single 0 and single 1 are equivalent to a space and a bar, each one bit long.
The right-hand sequence is comprised of three 1s followed by two 0s, a 1, and a 0. The three
1s are equivalent to a bar three bits long. The two 0s are equivalent to a space two bits long. The sin-
gle 1 and single 0 are equivalent to a bar and a space, each one bit long each. The UPC pattern for the
digit 0 is shown in Figure 4.
4 ERROR CONTROL
A data communications circuit can be as short as a few feet or as long as several thousand
miles, and the transmission medium can be as simple as a pair of wires or as complex as a
microwave, satellite, or optical fiber communications system. Therefore, it is inevitable that
errors will occur, and it is necessary to develop and implement error-control procedures.
Transmission errors are caused by electrical interference from natural sources, such as
lightning, as well as from man-made sources, such as motors, generators, power lines, and
fluorescent lights.
Data communications errors can be generally classified as single bit, multiple bit, or
burst. Single-bit errors are when only one bit within a given data string is in error. Single-bit
errors affect only one character within a message. A multiple-bit error is when two or more
nonconsecutive bits within a given data string are in error. Multiple-bit errors can affect one or
more characters within a message. A burst error is when two or more consecutive bits within a
given data string are in error. Burst errors can affect one or more characters within a message.
160
Fundamental Concepts of Data Communications
Error performance is the rate in which errors occur, which can be described as either
an expected or an empirical value. The theoretical (mathematical) expectation of the rate at
which errors will occur is called probability of error (P[e]), whereas the actual historical
record of a system’s error performance is called bit error rate (BER). For example, if a sys-
tem has a P(e) of 105, this means that mathematically the system can expect to experience
one bit error for every 100,000 bits transported through the system (105 1/105
1/100,000). If a system has a BER of 105, this means that in the past there was one bit er-
ror for every 100,000 bits transported. Typically, a BER is measured and then compared
with the probability of error to evaluate system performance. Error control can be divided
into two general categories: error detection and error correction.
5 ERROR DETECTION
Error detection is the process of monitoring data transmission and determining when errors
have occurred. Error-detection techniques neither correct errors nor identify which bits are
in error—they indicate only when an error has occurred. The purpose of error detection is
not to prevent errors from occurring but to prevent undetected errors from occurring.
The most common error-detection techniques are redundancy checking, which in-
cludes vertical redundancy checking, checksum, longitudinal redundancy checking, and
cyclic redundancy checking.
161
Fundamental Concepts of Data Communications
For odd parity, the parity bit is a 0 because 52 hex contains three logic 1s, which is an odd num-
ber. Therefore, the odd-parity bit sequence for the ASCII character R is 01010010.
For even parity, the parity bit is 1, making the total number of logic 1s in the eight-bit sequence
four, which is an even number. Therefore, the even-parity bit sequence for the ASCII character R is
11010010.
Other forms of parity include marking parity (the parity bit is always a 1), no parity (the par-
ity bit is not sent or checked), and ignored parity (the parity bit is always a 0 bit if it is ignored). Mark-
ing parity is useful only when errors occur in a large number of bits. Ignored parity allows receivers
that are incapable of checking parity to communicate with devices that use parity.
Example 3
Determine the VRCs and LRC for the following ASCII-encoded message: THE CAT. Use odd parity
for the VRCs and even parity for the LRC.
Solution
Character T H E sp C A T LRC
Hex 54 48 45 20 43 41 54 2F
ASCII code b0 0 0 1 0 1 1 0 1
b1 0 0 0 0 1 0 0 1
b2 1 0 1 0 0 0 1 1
b3 0 1 0 0 0 0 0 1
b4 1 0 0 0 0 0 1 0
b5 0 0 0 1 0 0 0 1
b6 1 1 1 0 1 1 1 0
Parity bit b7 0 1 0 0 0 1 0 0
(VRC)
162
Fundamental Concepts of Data Communications
The LRC is 00101111 binary (2F hex), which is the character “/” in ASCII. Therefore, after the LRC
character is appended to the message, it would read “THE CAT/.”
The group of characters that comprise a message (i.e., THE CAT) is often called a block or
frame of data. Therefore, the bit sequence for the LRC is often called a block check sequence (BCS)
or frame check sequence (FCS).
With longitudinal redundancy checking, all messages (regardless of their length) have the same
number of error-detection characters. This characteristic alone makes LRC a better choice for systems
that typically send long messages.
Historically, LRC detects between 95% and 98% of all transmission errors. LRC will not de-
tect transmission errors when an even number of characters has an error in the same bit position. For
example, if b4 in an even number of characters is in error, the LRC is still valid even though multiple
transmission errors have occurred.
5-1-4 Cyclic redundancy checking. Probably the most reliable redundancy check-
ing technique for error detection is a convolutional coding scheme called cyclic redundancy
checking (CRC). With CRC, approximately 99.999% of all transmission errors are de-
tected. In the United States, the most common CRC code is CRC-16. With CRC-16, 16 bits
are used for the block check sequence. With CRC, the entire data stream is treated as a long
continuous binary number. Because the BCS is separate from the message but transported
within the same transmission, CRC is considered a systematic code. Cyclic block codes are
often written as (n, k) cyclic codes where n bit length of transmission and k bit length
of message. Therefore, the length of the BCC in bits is
BCC n k
A CRC-16 block check character is the remainder of a binary division process. A
data message polynominal G(x) is divided by a unique generator polynominal function
P(x), the quotient is discarded, and the remainder is truncated to 16 bits and appended
to the message as a BCS. The generator polynominal must be a prime number (i.e., a
number divisible by only itself and 1). CRC-16 detects all single-bit errors, all double-
bit errors (provided the divisor contains at least three logic 1s), all odd number of bit
errors (provided the division contains a factor 11), all error bursts of 16 bits or less, and
99.9% of error bursts greater than 16 bits long. For randomly distributed errors, it is es-
timated that the likelihood of CRC-16 not detecting an error is 1014, which equates
to one undetected error every two years of continuous data transmission at a rate of
1.544 Mbps.
With CRC generation, the division is not accomplished with standard arithmetic di-
vision. Instead, modulo-2 division is used, where the remainder is derived from an exclu-
sive OR (XOR) operation. In the receiver, the data stream, including the CRC code, is di-
vided by the same generating function P(x). If no transmission errors have occurred, the
remainder will be zero. In the receiver, the message and CRC character pass through a block
check register. After the entire message has passed through the register, its contents should
be zero if the receive message contains no errors.
Mathematically, CRC can be expressed as
G1x2
Q1x2 R1x2 (1)
P1x2
where G(x) message polynominal
P(x) generator polynominal
Q(x) quotient
R(x) remainder
The generator polynomial for CRC-16 is
P(x) x16 x15 x2 x0
163
Fundamental Concepts of Data Communications
X2 X15 X16
15 14 + 13 12 11 10 9 8 7 6 5 4 3 2 1 + 0 +
MSB XOR XOR LSB XOR
Data input
BCC output
The number of bits in the CRC code is equal to the highest exponent of the gener-
ating polynomial. The exponents identify the bit positions in the generating polynomial
that contain a logic 1. Therefore, for CRC-16, b16, b15, b2, and b0 are logic 1s, and all
other bits are logic 0s. The number of bits in a CRC character is always twice the num-
ber of bits in a data character (i.e., eight-bit characters use CRC-16, six-bit characters use
CRC-12, and so on).
Figure 5 shows the block diagram for a circuit that will generate a CRC-16 BCC. A
CRC generating circuit requires one shift register for each bit in the BCC. Note that there
are 16 shift registers in Figure 5. Also note that an XOR gate is placed at the output of the
shift registers for each bit position of the generating polynomial that contains a logic 1, ex-
cept for x0. The BCC is the content of the 16 registers after the entire message has passed
through the CRC generating circuit.
Example 4
Determine the BCS for the following data and CRC generating polynomials:
Data G(x) x7 x5 x4 x2 x1 x0
10110111
CRC P(x) x5 x4 x1 x0
110011
Solution First, G(x) is multiplied by the number of bits in the CRC code, which is 5:
x5(x7 x5 x4 x2 x1 x0) x12 x10 x9 x7 x6 x5 1011011100000
Then the result is divided by P(x):
1 1 0 1 0 1 1 1
1 1 0 0 1 1 | 1 0 1 1 0 1 1 1 0 0 0 0 0
1 1 0 0 1 1
1 1 1 1 0 1
1 1 0 0 1 1
1 1 1 0 1 0
1 1 0 0 1 1
1 0 0 1 0 0
1 1 0 0 1 1
1 0 1 1 1 0
1 1 0 0 1 1
1 1 1 0 1 0
1 1 0 0 1 1
0 1 0 0 1 CRC
164
Fundamental Concepts of Data Communications
The CRC is appended to the data to give the following data stream:
G(x) CRC
兵
兵
1 0 1 1 0 1 1 1 0 1 0 0 1
1 1 0 1 0 1 1 1
1 1 0 0 1 1 | 1 0 1 1 0 1 1 1 0 1 0 0 1
1 1 0 0 1 1
1 1 1 1 0 1
1 1 0 0 1 1
1 1 1 0 1 0
1 1 0 0 1 1
1 0 0 1 1 0
1 1 0 0 1 1
1 0 1 0 1 0
1 1 0 0 1 1
1 1 0 0 1 1
1 1 0 0 1 1
0 0 0 0 0 0 Remainder 0,
which means there
were no transmis-
sion errors
6 ERROR CORRECTION
6-1 Retransmission
Retransmission, as the name implies, is when a receive station requests the transmit station to re-
send a message (or a portion of a message) when the message is received in error. Because the
receive terminal automatically calls for a retransmission of the entire message, retransmission
165
Fundamental Concepts of Data Communications
is often called ARQ, which is an old two-way radio term that means automatic repeat request or
automatic retransmission request.ARQ is probably the most reliable method of error correction,
although it is not necessarily the most efficient. Impairments on transmission media often occur
in bursts. If short messages are used, the likelihood that impairments will occur during a trans-
mission is small. However, short messages require more acknowledgments and line turnarounds
than do long messages. Acknowledgments are when the recipient of data sends a short message
back to the sender acknowledging receipt of the last transmission. The acknowledgment can in-
dicate a successful transmission (positive acknowledgment) or an unsuccessful transmission
(negative acknowledgment). Line turnarounds are when a receive station becomes the transmit
station, such as when acknowledgments are sent or when retransmissions are sent in response
to a negative acknowledgment. Acknowledgments and line turnarounds for error control are
forms of overhead (data other than user information that must be transmitted). With long mes-
sages, less turnaround time is needed, although the likelihood that a transmission error will oc-
cur is higher than for short messages. It can be shown statistically that messages between 256
and 512 characters long are the optimum size for ARQ error correction.
There are two basic types of ARQ: discrete and continuous. Discrete ARQ uses ac-
knowledgments to indicate the successful or unsuccessful reception of data. There are two
basic types of acknowledgments: positive and negative. The destination station responds
with a positive acknowledgment when it receives an error-free message. The destination sta-
tion responds with a negative acknowledgment when it receives a message containing er-
rors to call for a retransmission. If the sending station does not receive an acknowledgment
after a predetermined length of time (called a time-out), it retransmits the message. This is
called retransmission after time-out.
Another type of ARQ, called continuous ARQ, can be used when messages are di-
vided into smaller blocks or frames that are sequentially numbered and transmitted in suc-
cession, without waiting for acknowledgments between blocks. Continuous ARQ allows
the destination station to asynchronously request the retransmission of a specific frame (or
frames) of data and still be able to reconstruct the entire message once all frames have been
successfully transported through the system. This technique is sometimes called selective
repeat, as it can be used to call for a retransmission of an entire message or only a portion
of a message.
166
Fundamental Concepts of Data Communications
d1 d2 d3 d4 d5 d6 dm h1 h2 h3 hn
the Hamming code while working at Bell Telephone Laboratories. The Hamming code is
an error-correcting code used for correcting transmission errors in synchronous data
streams. However, the Hamming code will correct only single-bit errors. It cannot correct
multiple-bit errors or burst errors, and it cannot identify errors that occur in the Hamming
bits themselves. The Hamming code, as with all FEC codes, requires the addition of over-
head to the message, consequently increasing the length of a transmission.
Hamming bits (sometimes called error bits) are inserted into a character at random lo-
cations. The combination of the data bits and the Hamming bits is called the Hamming code.
The only stipulation on the placement of the Hamming bits is that both the sender and the
receiver must agree on where they are placed. To calculate the number of redundant Ham-
ming bits necessary for a given character length, a relationship between the character bits
and the Hamming bits must be established. As shown in Figure 6, a data unit contains m
character bits and n Hamming bits. Therefore, the total number of bits in one data unit is
m n. Since the Hamming bits must be able to identify which bit is in error, n Hamming bits
must be able to indicate at least m n 1 different codes. Of the m n codes, one code in-
dicates that no errors have occurred, and the remaining m n codes indicate the bit position
where an error has occurred. Therefore, m n bit positions must be identified with n bits.
Since n bits can produce 2n different codes, 2n must be equal to or greater than m n 1.
Therefore, the number of Hamming bits is determined by the following expression:
2n ≥ m n 1 (2)
where n number of Hamming bits
m number of bits in each data character
A seven-bit ASCII character requires four Hamming bits (24 > 7 4 1), which
could be placed at the end of the character bits, at the beginning of the character bits, or in-
terspersed throughout the character bits. Therefore, including the Hamming bits with
ASCII-coded data requires transmitting 11 bits per ASCII character, which equates to a
57% increase in the message length.
Example 5
For a 12-bit data string of 101100010010, determine the number of Hamming bits required, arbitrar-
ily place the Hamming bits into the data string, determine the logic condition of each Hamming bit,
assume an arbitrary single-bit transmission error, and prove that the Hamming code will successfully
detect the error.
Solution Substituting m 12 into Equation 2, the number of Hamming bits is
for n 4 24 16 ≥ 12 4 1 17
Because 16 < 17, four Hamming bits are insufficient:
for n 5 25 32 ≥ 12 5 1 18
Because 32 > 18, five Hamming bits are sufficient, and a total of 17 bits make up the data stream (12
data plus five Hamming).
167
Fundamental Concepts of Data Communications
Arbitrarily placing five Hamming bits into bit positions 4, 8, 9, 13, and 17 yields
bit position 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
H 1 0 1 H 1 0 0 H H 0 1 0 H 0 1 0
To determine the logic condition of the Hamming bits, express all bit positions that contain a logic 1
as a five-bit binary number and XOR them together:
Bit position Binary number
2 00010
6 00110
XOR 00100
12 01100
XOR 01000
14 01110
XOR 00110
16 10000
XOR 10110 Hamming bits
b17 1, b13 0, b9 1, b8 1, b4 0
The 17-bit Hamming code is
H H H H H
1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0
Assume that during transmission, an error occurs in bit position 14. The received data stream is
1 1 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0
兵
error
At the receiver, to determine the bit position in error, extract the Hamming bits and XOR them with
the binary code for each data bit position that contains a logic 1:
Bit position Binary number
Hamming bits 10110
2 00010
XOR 10100
6 00110
XOR 10010
12 01100
XOR 11110
16 10000
XOR 01110 14
Therefore, bit position 14 contains an error.
7 CHARACTER SYNCHRONIZATION
168