Chapter X: Binary Encoding Scheme
Section X.3 Error Detecting Codes
Binary Encoding
Although the binary number system has many practical advantages and is widely used in digital computers, in many cases it is convenient to work with the decimal number system, especially when the communication between man and the machine is extensive since most numerical data generated by man are in terms of decimal numbers. To simplify the communication problem between man and machine, a number of codes have been devised so that the decimal digits are represented by sequences of binary digits.Classification of binary codes
-
X.1 Weighted Codes
- *Binary to Decimal
- *BCD Code
- *Self-Complementing Code
- *Two's complement
-
X.2 Non-Weighted Codes
- *Excess-3 Code
- *Gray Code
-
Alphanumeric Codes
- *American Standard Code for Information Interchange (ASCII)
- *Extended Binary Coded Decimal Interchange Code (EBCDIC)
-
X.3 Error Detecting Codes
- *Parity Bit
-
X.4 Error Correcting Codes
- *7-Bit Hamming Code
Error Detecting Code
What Is a Parity Bit?
A parity bit is a simple error-detecting code used in digital communications and memory storage. It is a single bit added to a group of data bits to ensure that the total number of 1's in the group is either even (even parity) or odd (odd parity).
Goal
- To detect single-bit error in data transmission or storage.
- Parity bits do not correct the error, only detect it.
Types of Parity
- Even parity: The parity bit is chosen so that the total number of 1's in the group (including the parity bit) is even.
- Odd parity: The parity bit is chosen so that the total number of 1's in the group (including the parity bit) is odd.
Example: Even Parity
Suppose we want to transmit the 4-bit data
1011
.
It has three 1's (which is odd), so we need to add a parity bit of
1
to make the total number of 1's even.
Transmitted 5-bit sequence:
10111
Parity Check Table (Even Parity)
| Data | Number of 1's | Parity Bit | Transmitted Data |
|---|---|---|---|
| 0000 | 0 | 0 | 00000 |
| 0001 | 1 | 1 | 00011 |
| 0011 | 2 | 0 | 00110 |
| 0111 | 3 | 1 | 01111 |
| 1111 | 4 | 0 | 11110 |
Example: Odd Parity
Using the same 4-bit data
1011
, we want the total number of 1's to be odd.
Since there are already three 1's, we add a parity bit of
0
.
Transmitted 5-bit sequence:
10110
Parity Check Table (Odd Parity)
| Data | Number of 1's | Parity Bit | Transmitted Data |
|---|---|---|---|
| 0000 | 0 | 1 | 00001 |
| 0001 | 1 | 0 | 00010 |
| 0011 | 2 | 1 | 00111 |
| 0111 | 3 | 0 | 01110 |
| 1111 | 4 | 1 | 11111 |
Limitations
- Parity bits can only detect single-bit error .
- They cannot detect or correct multiple-bit errors.