Error Detection Methods
1. The Parity Bit (Single Byte)
Before transmission, the sender checks the number of 1s in a byte. In Even Parity, the parity bit is set to ensure the total count of 1s is an even number.
| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Parity (P) |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
In the example above, there are four 1s. Since 4 is already even, the Parity Bit is 0.
2. The Parity Block (Horizontal & Vertical)
When a block of data is sent, a Parity Byte is added at the end. This byte enforces parity for every column, while the standard parity bit enforces it for every row.
| B7 | B6 | B5 | B4 | B3 | B2 | B1 | P (Row) | |
|---|---|---|---|---|---|---|---|---|
| Byte 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| Byte 2 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| Byte 3 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 |
| Parity Byte | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 |
How the error is found:
The receiver recalculates the row and column parities. In the table above, Row 2 fails the parity check (it has 4 ones, but the parity bit says it should be odd). Column B4 also fails. The intersection (the red cell) must be the incorrect bit. It is flipped from 0 back to 1.
3. Checksum: The Calculation
Checksums are used for blocks of data (packets). A common simple algorithm involves summing the bytes and using the remainder (Modulo).
Suppose we send three bytes: 15, 20, 10.
1 Sum the values: $15 + 20 + 10 = 45$
2 Perform Modulo 256: $45 \div 256 = 0 \text{ remainder } 45$
3 The Checksum is 45. This value is sent with the packet.
Application: TCP/IP Packets, File Downloads (.iso, .exe)
4. Check Digit: The Calculation
Check digits are the final digit in a code, calculated using an algorithm like Modulo-11 or ISBN-10.
Number to check: 0-306-40615-?
1 Assign Weights: Multiply each digit by its position (10 down to 2).
$(0\times10) + (3\times9) + (0\times8) + (6\times7) + (4\times6) + (0\times5) + (6\times4) + (1\times3) + (5\times2)$
$0 + 27 + 0 + 42 + 24 + 0 + 24 + 3 + 10 = 130$
2 Find Remainder: $130 \div 11 = 11 \text{ remainder } 9$
3 Subtract from 11: $11 - 9 = 2$
The Check Digit is 2. The full number is 0-306-40615-2.
Application: Barcodes (EAN/UPC), ISBNs, Vehicle Identification Numbers (VIN)
- Parity Block: Detects and corrects single-bit errors.
- Checksum: Used by computers for data transmitted over networks.
- Check Digit: Used to catch human entry errors (swapping digits).