6.2.2 Detecting Errors During Data Transfer
Data can change while it travels between devices. Electrical interference, weak signals, faulty equipment, or other transmission problems may cause one or more bits to flip. Transfer checks add extra information so that the receiver can test whether the received bit pattern is consistent with the data sent.
This section covers the three methods required by the syllabus: byte parity, block parity, and checksums.
By the end of this section, you should be able to:
- Explain why extra checking information is transmitted with data.
- Calculate and test even and odd parity for a byte.
- Explain what simple parity can detect and what it may miss.
- Describe how a checksum is generated and checked.
- Construct and analyse a block-parity arrangement.
- Explain what happens after a transfer error is detected.
Protecting Integrity While Data Travels
A transfer-checking method normally follows the same general process:
- The sender calculates checking information from the original data.
- The data and checking information are transmitted.
- The receiver repeats the relevant calculation or test.
- The receiver compares its result with the received checking information.
- If the results disagree, an error is reported and retransmission may be requested.
Byte Parity
A parity bit is an extra bit added to a group of data bits. Its value is chosen so that the complete group contains either an even or an odd number of 1s.
| Parity system | Required total number of 1s | Receiver's test |
|---|---|---|
| Even parity | Even | An odd count indicates an error. |
| Odd parity | Odd | An even count indicates an error. |
Worked example: preparing a byte
A remote weather station needs to send the seven-bit payload 1010110. It contains four 1s.
| System | Parity bit placed at the left | Transmitted byte | Total 1s |
|---|---|---|---|
| Even parity | 0 | 01010110 | 4 |
| Odd parity | 1 | 11010110 | 5 |
Checking a received byte
Suppose the receiver expects even parity and receives 01100111. This byte contains five 1s. Because five is odd, the parity rule fails and the receiver detects that the byte has changed.
What Simple Parity Can and Cannot Do
A single parity bit detects any odd number of bit flips in the checked byte because the odd/even status changes. However, an even number of bit flips can preserve the same parity.
Two-bit error that passes even parity
| Stage | Byte | Number of 1s | Parity result |
|---|---|---|---|
| Sent | 01010110 | 4 | Even |
| Received after two flips | 01110010 | 4 | Still even |
The received value is different, but the count of 1s remains even. The parity check therefore does not detect this particular corruption.
Simple parity also tells the receiver that a problem exists, but it does not identify which bit is wrong. The usual response is to reject the affected data and request retransmission.
Checksum
A checksum is a value calculated from a block of data. The sender transmits the block together with the checksum. The receiver performs the same calculation on the received block and compares the result with the transmitted checksum.
Original worked example
In this simplified training scheme, three bytes are treated as unsigned denary values and added. Only the lowest eight bits of the total are used, equivalent to calculating the total modulo 256.
| Byte | Binary value | Denary value |
|---|---|---|
| 1 | 00110110 | 54 |
| 2 | 01001001 | 73 |
| 3 | 00011100 | 28 |
The sender calculates:
54 + 73 + 28 = 155, so the training checksum is 10011011.
If the second byte changes from 73 to 77, the receiver calculates 54 + 77 + 28 = 159, or 10011111. This does not match the transmitted checksum, so an error is detected.
Block Parity
Block parity arranges several bytes as rows in a grid. A parity bit is added to each row, and an additional parity row checks the columns. This is sometimes described as parity in two directions.
Creating an even-parity block
The following original example contains four data rows. The right-hand column contains each row's parity bit, and the bottom row provides column parity.
| Row | b1 | b2 | b3 | b4 | b5 | b6 | b7 | Row parity |
|---|---|---|---|---|---|---|---|---|
| Data 1 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| Data 2 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 |
| Data 3 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
| Data 4 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 |
| Column parity | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 |
Locating one corrupted bit
During transmission, suppose bit b6 in Data 2 changes from 1 to 0. The parity check for Data 2 fails, and the parity check for column b6 also fails. Their intersection identifies the changed bit.
Comparing the Three Methods
| Method | Checking information | Main strength | Important limitation |
|---|---|---|---|
| Byte parity | One extra bit per byte | Simple detection of odd numbers of bit flips in a byte | Even numbers of flips may be missed; the bit position is not identified |
| Checksum | Calculated value for a block | Checks the block as a whole | A mismatch does not identify the exact changed bit; some different blocks may produce the same checksum |
| Block parity | Row parity plus column parity | Can locate one corrupted bit using a row-column intersection | Some multiple-error patterns may be ambiguous or undetected |
Worked Scenario: Sensor Data from a Mountain Station
Scenario
A mountain monitoring station sends small sensor readings to a control centre. Each reading is placed in a byte and several bytes are grouped into a transmission block.
| Requirement | Suitable method | Reason |
|---|---|---|
| Quickly test each individual byte | Byte parity | An additional parity bit allows the receiver to test the 1-count for each byte. |
| Test whether an entire group of readings changed | Checksum | The sender and receiver calculate and compare a value for the whole block. |
| Locate one changed bit within a small grid of bytes | Block parity | A failing row and column identify the intersection. |
If a check reports an error but the receiver cannot reliably correct it, the safest response is to discard the affected unit and request that the sender transmit it again.
Interactive: Transfer Error Lab
Use the existing widget to generate parity, test received bytes, calculate a checksum, and trace a single error through a block-parity grid.
Common Mistakes and Misconceptions
- Counting only the data bits and forgetting the parity bit at the receiving end.
- Assuming that passing a parity check proves the byte is correct.
- Claiming simple parity identifies the exact corrupted bit.
- Describing a checksum without saying that the receiver repeats the calculation.
- Confusing a checksum with the check digit used for entered identifiers.
- Claiming block parity can unambiguously correct every multiple-bit error.
- Using “detect”, “locate”, and “correct” as interchangeable terms.
Practice
Try these original questions
- Using even parity, add a parity bit to the seven-bit payload 1100101.
- Using odd parity, add a parity bit to 0011100.
- A receiver using even parity obtains 10110101. State whether an error is detected and explain why.
- Explain why two flipped bits in one byte may pass a simple parity check.
- Describe the sender and receiver stages of a checksum method.
- A simplified checksum uses the sum modulo 256. Calculate the checksum for denary byte values 42, 91, and 36.
- Explain why a checksum mismatch normally leads to retransmission rather than direct correction.
- Describe how row and column parity can locate one corrupted bit in a block.
- Explain one limitation of block parity when several bits change.
- Compare byte parity and checksum, giving one strength and one limitation of each.
Review
| Concept | Strong recall statement |
|---|---|
| Even parity | The complete transmitted group contains an even number of 1s. |
| Odd parity | The complete transmitted group contains an odd number of 1s. |
| Simple parity limitation | An even number of bit flips may leave the parity unchanged. |
| Checksum | The receiver recalculates a value from the received block and compares it with the transmitted value. |
| Block parity | Row and column parity can locate a single changed bit at their intersection. |
| Detected error | The affected data may be rejected and retransmission requested. |