4 - Error Detection Schemes
4 - Error Detection Schemes
2
OUTCOMES
3
Error detection Techniques
"Data error" has become more common as data transfers over various network
channels have increased. Sensitive data might be lost when the data being
communicated is corrupted or damaged as a result of internal or external
interferences.
Error detection techniques are utilized to address this problem and identify whether
our data has been damaged or not.
Error detection techniques are responsible for checking whether any error has
occurred or not in the data that has been transmitted via network.
4
Error Detection Methods
Parity Checking:
An easy-to-use approach of detecting errors in digital transmission is parity
checking.
It involves adding an additional bit, known as the parity bit, to the right of a
binary message in order to guarantee that the total number of 1s in the
message, including the parity bit, is either even or odd, depending on the
parity type that has been selected (even or odd).
By adding a parity bit, the received message's errors can be detected..
Parity Types
Even Parity:
In even parity, the total number of 1s, including the parity bit, is made even.
If the data already contains an even number of 1s, the parity bit is set to 0.
If the data contains an odd number of 1s, the parity bit is set to 1.
Odd Parity:
In odd parity, the total number of 1s, including the parity bit, is made odd.
If the data already contains an odd number of 1s, the parity bit is set to 0.
If the data contains an even number of 1s, the parity bit is set to 1.
Odd parity
Parity Checking:
Odd Parity:
In odd parity, an extra bit is added to the data so that the total number of bits in
resultant data (original data + parity bit) is an odd number.
If the total count of set bits is already odd in the original data, the added parity
bit is set to 0. If it's even, the added parity bit is set to 1.
The receiver checks the received data and parity bit. If the total count of set
bits (including the received parity bit) is an odd number, no error is detected.
If it's an even number, an error is detected.
Example of Odd Parity
• Let's say we want to transmit the 4-bit binary data 1011 using odd parity.
We add an extra bit to ensure an odd count of set bits. Since the original
data has three 1s (which is odd), we add a parity bit of 0.
• The transmitted message becomes 10110. If an error occurs during
transmission, such as flipping one of the bits to 10100, the receiver can
detect the error because the total number of set bits(1’s) (including the
parity bit) is now even.
9
Even Parity
• Even Parity:
• In even parity, an extra bit is added to the data so that the total number
of set bits in both the data bits and the added parity bit is an even
number.
• If the total count of set bits is already even in the original data, the added
parity bit is set to 0. If it's odd, the added parity bit is set to 1.
• The receiver checks the received data and parity bit. If the total count of
set bits (including the received parity bit) is an even number, no error is
detected. If it's an odd number, an error is detected.
10
Example of Even Parity
• Let's transmit the 4-bit binary data 1100 using even parity. We add an
extra bit to ensure an even count of set bits. Since the original data has
two 1s (which is even), we add a parity bit of 0 to the left of the data and
data becomes as 11000. The message to be transmitted would be 11000.
• If an error occurs during transmission, such as flipping one of the bits to
11001, the receiver can detect the error because the total number of set
bits(1’s) (including the parity bit) is now odd.
11
Cont.…
NOTE: The counting of data bits will include the parity bit also.
The circuit which adds a parity bit to the data at transmitter is called “Parity
generator”.
The parity bits are transmitted and they are checked at the receiver.
If the parity bits sent at the transmitter and the parity bits received at receiver
are not equal then an error is detected.
The circuit which checks the parity at receiver is called “Parity checker”.
Exercise
Exercise 1: Given the data 1101101 and using even parity, calculate the transmitted
message.
Data to be transmitted: 1101101
As the total number of 1s in the data are = 5 (odd)
Since even parity is chosen, add a parity bit of 1 to make it even.
Transmitted message: 11011011
Exercise 2: Given the data 1010011 and using odd parity, calculate the transmitted message.
Data to be transmitted: 1010011
Total number of 1s in the data = 4 (even)
Since odd parity is chosen, add a parity bit of 1 to make it odd.
Transmitted message: 11010011
14
Messages with even parity and odd parity Exercise?
19
Example on CRC
Sender Side (CRC Generator and Division):
i. A fixed divisor is chosen as 1101.
ii. The first step is to add the no. of zeroes to the data to be sent, calculated using
k-1, where k is size of divisor.
iii. Applying the Binary Division and obtaining the remainder from the division.
iv. The last step is to append the remainder(CRC) to the end of the data bits and
share it with the receiver.
• A string of n 0s is added to the data unit. The number n is one smaller than the
number of bits in the fixed divisor (usually 1101).
• The new data unit is divided by a chosen divisor Using XOR based division, the
remainder appearing from the division is CRC.
20
Example on CRC
Receiver Side (Checking for errors in the received data):
To check the error, the received data bits are divided again by chosen
divisor and
If the remainder is 0, the data bit received is correct, without any errors.
If the remainder is not 0, The receiver may then send an
acknowledgement back to the sender for retransmission.
21
Example 1 (No error in transmission):
Data word to be sent = 100100
Key/CRC Selected = 1101
Add k-1 zeros to the original data to be transmitted.
So k=4 , zeros = k-1 = 4-1= 3
Sender Side:
Dividend = 100100000
100100000 ÷ 1101 (Appended Zeros)
22
Sender side will send?
23
Receiver Side will verify as?
Receiver Side: Code word received at the receiver side 100100001
24
Example 2: (Error in transmission)
• Data word to be sent = 100100
• Key/CRC = 1101
• Sender Side:
25
Receiver Side verify as:
Receiver Side: Let there be an error in transmission media Coded data
received at the receiver side = 100000001
26
Example:
At the receiver side, we divide the
received code word with the same
divisor to get the actual code word.
For an error free reception of data, the
reminder is 0.
If the reminder is a non – zero, that
means there is an error in the received
code / data sequence.
3) longitudinal redundancy check (LRC)
longitudinal redundancy check (LRC) or horizontal redundancy check is a
type of redundancy check that is applied independently to each parallel
group of bit streams. The data should be split into transmission blocks
and additional check data should be added to it.
LRC is used to detect burst errors.
29
Example on longitudinal redundancy check (LRC)
Example 1: Suppose you want to transmit three 8-bit data bytes: 00110101,
11001010, and 01011100.
Step 1: Data Division:
Data 1: 00110101
Data 2: 11001010
Data 3: 01011100
30
Example on LRC….
Step 2: Bitwise XOR Operation:
For each bit position (bit 0 to bit 7), perform XOR on the corresponding bits of all
data bytes: Step 3: Appending LRC:
Combine the XOR results to form the LRC:
Bit 0: (0 XOR 1 XOR 0) = 1
LRC = 10100011.
Bit 1: (0 XOR 1 XOR 1) = 0 Step 4: Sending Data:
Bit 2: (1 XOR 0 XOR 0) = 1 Send the original data along with the LRC:
00110101 11001010 01011100 10100011.
Bit 3: (1 XOR 0 XOR 1) = 0
Step 5 and 6: Receiving and Error Detection:
Bit 4: (0 XOR 1 XOR 1) = 0
Upon receiving the data, the receiver performs the same
Bit 5: (1 XOR 0 XOR 1) = 0 XOR operation on the first three bytes (data only), excluding
the received LRC. If the calculated LRC matches the
Bit 6: (0 XOR 1 XOR 0) = 1 received LRC (10100011), no errors are detected. If there's a
mismatch, an error is detected.
Bit 7: (1 XOR 0 XOR 0) = 1
31
Example on LRC…..
0 0 1 1 0 1 0 1 (data1)
1 1 0 0 1 0 1 0 (data2)
XOR of data1 & data2 = 1 1 1 1 1 1 1 1
0 1 0 1 1 1 0 0 (data3)
XOR of above three = 1 0 1 0 0 0 1 1
NOTE: As the LRC code at the receiver end exactly match the LRC code
obtained at the sender side so there is no data corruption occurred.
32
Longitudinal Redundancy Check (LRC):
In longitudinal redundancy method, a
BLOCK of bits are arranged in a table
format (in rows and columns) and we will
calculate the parity bit for each column
separately.
The set of these parity bits are also sent
along with our original data bits.
Longitudinal redundancy check is a bit by bit
XOR computation, as we calculate the XOR
of each column individually.
4) Checksum method of error detection
The checksum method is an error detection technique used to verify the
integrity of transmitted data by adding a special value, known as the
checksum, to the data.
This checksum is computed based on the data's content and is sent along
with the data.
Upon receiving the data, the receiver recalculates the checksum and
compares it with the received checksum. If they match, the data is
assumed to be error-free; otherwise, an error is detected. Here's how the
checksum method works:
34
Checksum method working steps
Step 1: At the Sender Side
Divide the original data into the ‘m’ number of blocks of size K.
The addition result should never exceed size K, if exceeds then you have wrap up
the extra bits on the right to bits on the left of the sum.
Append the checksum value to the original data bit. Checksum value was
the the 1’s complement of the sum of the original data blocks. The
checksum size and the block size should always match.
36
Checksum method working…….
Step 3: At the Receiver Side
Divide the receive data into the ‘m’ number of blocks of size K
Adding all the ‘k’ data blocks along with the checksum value.
If the result of 1’s complement is all zeros then data received have not been
tempered otherwise a request for retransmission is sent by the receiver.
37
Checksum method working…….
Two possible cases after 1’s complement:
The receiver discards the data and requests for retransmission of data.
38
Example on checksum error detection method
Example:
Consider the data unit to be transmitted is:
10011001111000100010010010000100
Consider 8 bit checksum is used.
Step-01: At sender side,
• The given data unit is divided into segments of 8 bits as:
• Now, all the segments are added and the result is obtained as:
• 10011001 + 11100010 + 00100100 + 10000100 = 10 00100011
• Since the result consists of 10 bits, so extra 2 bits on right side of the sum
are wrapped around.
Cont.…
• 00100011 + 10 = 00100101 (8 bits)
• Now, 1’s complement is taken which is 11011010.
• Thus, checksum value = 11011010
Step-02:
The data along with the checksum value is transmitted to the receiver.
i.e.
10011001 11100010 00100100 10000100 11011010
Step-03: At receiver side,
• The received data unit is divided into segments of 8 bits.
• All the segments along with the checksum value are added.
Cont.…
Sum of all segments + Checksum value
=> 00100101 + 11011010 = 11111111.
Complemented value = 00000000
Since the result is 0, receiver assumes no error occurred in the data and
therefore accepts it.
Thank You…!