Lecture 2 Complement & Error Detecting Code.pptx
Lecture 2 Complement & Error Detecting Code.pptx
Daniyal Adeeb
Recall : Addition and Subtraction with 2’s Complement
0101 +5 0101 +5
0010 +2 1110 -2
0111 +7 10011 +3
1011 -5 1011 -5
1110 -2 0010 +2
11001 -7 1101 -3
Recall : Addition and Subtraction with 2’s Complement
1011 -5 1101 -5
1110 -2 1010 -2
11001 -7 10111 -7
Recall : Addition and Subtraction with 2’s Complement
0101 +5 0101 +5
1110 -2 1010 -2
10011 +3 1111 +3
1011 -5 1101 -5
0010 +2 0010 +2
1101 -3 1111 -3
Error-Detecting Code
● Error-detecting codes ensure data integrity during communication and processing.
● ASCII characters often use an additional eighth bit, known as a parity bit, for error detection.
● Parity Bit: An extra bit added to a binary message to ensure the total number of 1’s is even or odd.
● Even Parity: Total number of 1’s is even.
● Odd Parity: Total number of 1’s is odd.
Transmitted Data: The character "A" with the parity bit becomes: 010000010 (7 bits for the character + 1
parity bit)
Receiving End:
1. Received Data: The receiver receives the data 010000010.
2. Parity Check:
○ The receiver checks the number of 1's in the received 8-bit string (010000010).
○ There are two 1's in the string, which is an even number.
○ Since the parity is correct (even), no error is detected.
Error-Detecting Code
Example of Error in Transmission:
Now, let's assume an error occurs during transmission and the receiver gets the wrong data:
Received Data: The receiver receives 010000011 (the last bit has been flipped).
1. Received Data: 010000011
2. Parity Check:
○ The receiver checks the number of 1's in the received 8-bit string (010000011).
○ There are three 1's in the string, which is an odd number.
○ Since the parity is incorrect (odd instead of even), the receiver detects an error.
Home Assignment (Ungraded)
1.14,1.15
from Digital design by Morris Mano 5th edition