Electrical interference can flip a bit, lose one or add one while data travels. The receiver cannot see the original, so the sender adds extra checking data. Learn three ways of spotting that something has gone wrong.
Interference during transmission can cause data loss, data gain or data change, so data must be checked when it arrives. A parity check adds a parity bit so that each byte has an even (even parity) or odd (odd parity) number of 1s; a parity block adds a parity byte too, so the exact bit in error can be found. A checksum is a value calculated from the data and sent with it, then recalculated by the receiver. In an echo check the receiver sends the data back and the sender compares it with the original.
Fig. 1: setting the parity bit for even parity
Section 01
Parity bits.
Sender and receiver first agree on even or odd parity. In the lab, type a 7-bit value, choose a parity, and then flip a bit to see the receiver spot it.
Why check: interference can change bits (0 becomes 1), lose bits or add extra bits.
Even parity: the parity bit makes the total number of 1s in the byte even.
Odd parity: the parity bit makes the total number of 1s in the byte odd.
At the receiver: count the 1s in each byte. If the count does not match the agreed parity, an error has occurred and the data is resent.
Worked example Even parity
Add an even parity bit (as the leftmost bit) to the 7-bit data 1011001.
Count the 1s: 1, 0, 1, 1, 0, 0, 1 gives four 1s.
Four is already even, so the parity bit is 0.
Answer: 01011001
Worked example Checking a byte
A system uses even parity. The byte 11010011 is received. Has an error occurred?
Count the 1s: 1 + 1 + 0 + 1 + 0 + 0 + 1 + 1 = 5.
5 is odd, but even parity was agreed.
Answer: Yes, an error has occurred
Your turn
Using odd parity, what is the parity bit for the 7-bit data 1110000?
There are three 1s, which is already odd, so the parity bit is 0: 01110000.
Examiner trap
A parity check cannot detect an error where two bits change (for example 01011001 becoming 01011111): the number of 1s stays even, so the error is missed.
Section 02
The parity block.
Send several bytes, each with its own parity bit, then add a parity byte that checks each column. A bad row and a bad column cross at the bit in error.
Bit
1 (parity)
2
3
4
5
6
7
8
Byte 1
0
1
0
1
1
0
0
1
Byte 2
1
1
1
1
0
0
0
0
Byte 3
0
0
1
0
0
0
1
1
Byte 4
0
1
0
0
1
1
0
1
Parity byte
1
1
0
0
1
1
1
1
Worked example Find the error
The block above was sent using even parity. One bit was changed during transmission. Find it.
Count the 1s in each byte: 4, 4, 3, 4. Byte 3 has an odd number, so the error is in byte 3.
Count the 1s in each column: 2, 4, 2, 2, 3, 2, 2, 4. Column 5 has an odd number.
The error is where byte 3 and column 5 meet. That bit is 0, so it should be 1.
Answer: Byte 3, bit 5: corrected byte is 00101011
Examiner trap
A single parity bit only shows that a byte is wrong. Only a parity block (parity bits plus a parity byte) shows exactly which bit is wrong, so it can be corrected.
Stage 1 · Learn
Check what the sim just showed you
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
Which is NOT a way that interference can affect transmitted data?
Quick check+10 XP
Using even parity, what is the parity bit for the 7-bit data 0110110?
Quick check+10 XP
In the lab's parity block, how is the exact bit in error found?
Quick check+10 XP
In an echo check, who compares the data?
Section 03
Checksums and echoes.
Try the checksum and echo check modes in the lab. Corrupt one byte and see each method catch it.
Checksum, 1: before sending, a value (the checksum) is calculated from the block of data using an agreed algorithm.
Checksum, 2: the checksum is sent with the data.
Checksum, 3: the receiver recalculates the checksum from the data it received, using the same algorithm.
Checksum, 4: if the two checksums are different, an error has occurred and the data is requested again.
Echo check: the receiver sends a copy of the data back to the sender, which compares it with the original. If they differ, an error has occurred and the data is resent.
Worked example A simple checksum
An algorithm adds the bytes and keeps the remainder after dividing by 256. Calculate the checksum for 120, 45, 200, 90.
Add the bytes: 120 + 45 + 200 + 90 = 455.
455 is bigger than 255, so subtract 256: 455 − 256 = 199.
Answer: Checksum = 199
Examiner trap
An echo check cannot tell where the error happened: the data may have been correct on arrival and changed on the way back. Either way, it has to be sent again.
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to IGCSE Paper 1 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
A system uses odd parity. Which received byte contains an error?
Exam style+20 XP
Why can a parity check fail to detect an error?
Exam style+20 XP
What does the receiver do with a checksum?
Exam style+20 XP
A checksum is the sum of the bytes, with 256 subtracted while the total is over 255. What is the checksum of 64, 130, 255, 17?
Skill unlocked
Parity, checksums and echo checks, mastered.
This skill is now recorded on your profile. Keep the chain going.