Search HoldMyTwist

Browse all posts

Episode 8

The Light That Flipped

One more test shows how adding just one check bit can detect some kinds of damage but miss modified data.

Episodes

Computing Basics

    Duck sends data 1011 from inside the monitor. Three of the four DATA lamps glow; a separate CHECK lamp at far right has not been set. Robot waits.
    Robot counts three lit DATA lamps in1011. The separate CHECK lamp remains unset. Three is odd.
    Robot switches on the separate CHECK lamp after the four DATA lamps 1011. The complete signal 1011|1 now has four ones.
    Robot counts across DATA 1011 and the separate CHECK 1, including the extra lamp. There are four ones, an even total.
    A fictional interference flash turns the first DATA lamp off. The received signal becomes 0011|1; Duck gasps.
    Robot counts the two lit DATA lamps and the lit CHECK lamp. The received 0011|1 has three ones, an odd total.
    Duck asks whether the received signal satisfies the even rule. Robot waits over a blank result card;0011|1 is unchanged.
    Robot raises a card marked FAIL beside 0011|1. Its three ones fail the agreed even-parity rule.
    Duck spreads its wings, uncertain which lamp should be fixed. The damaged 0011|1 signal remains unchanged.
    Robot spreads both pincers. The parity failure does not identify a particular position; the damaged 0011|1 is left untouched.
    Duck offers to send again from inside the monitor, showing an original 1011 card and its send control. Robot nods; the receiver still shows 0011|1.
    After an agreed fresh transmission, the receiver shows 1011|1 again. Duck asks what happens if two lights flip.
    Silent setup: Robot pauses with both pincers ready. The original 1011|1 remains displayed before either of the first two DATA lights changes.
    The first DATA light changes 1to 0 and the second 0to 1. The received signal is 0111|1, with four ones in total; CHECK stays 1.
    Duck holds the original 1011|1 card while Robot compares it with received 0111|1. The data differs although both complete signals have four ones.
    Robot marks a check on a card. Received 0111|1 passes the even check, yet its data differs from original 1011. Duck points at the changed data.
    Duck explains that passing does not prove unchanged data. A comparison shows original 1011|1, single-flip 0011|1 failing, and two-flip 0111|1 passing.
    Robot points separately to the four DATA lamps and the single CHECK lamp. Received0111|1 still passes, showing the limit of this check.
    Duck presses its own send control after agreement. Robot checks the new 1011|1 message before using it; all five positions are shown.
    Wordless ending: Robot inspects its own crooked mustard scarf while Duck, without a scarf, laughs inside the monitor. The fresh 1011|1 signal remains correct.

    Episode transcript

    A check bit joins the signal

    The data is 1011.

    DATA: 1011

    Robot sees the 3 '1's in data 1011.

    DATA ONES: 3 (ODD)

    Robot: Three '1's.

    DATA 1011 | CHECK 1 → TOTAL ONES 4 (EVEN)

    The signal is still 1011|1.

    COUNT DATA + CHECK

    Robot: There are four ones.

    One light changes

    The separate check bit is still 1.

    FIRST DATA BIT: 1 → 0. CHECK STAYS 1

    Duck: A light changed!

    RECEIVED 0011 | 1 → TOTAL ONES 3 (ODD)

    Robot: Three ones now

    The rule that's settled upon is that the total should be even. But the total of the signal that we get is odd.

    Robot detects the received 0011|1 signal as failing parity.

    ODD TOTAL → FAIL

    Robot: It fails. Something changed.

    A failed check cannot locate damage

    Duck points at all five places that have signals. He doesn't know which one it was.

    Duck: Which one should we fix?

    Robot lists multiple possibilities for individual bits that could be flipped to change the parity. There's no specific location identified by the parity result.

    PARITY DOES NOT IDENTIFY THE CHANGED POSITION

    Robot: This check won't tell us which one.

    RESEND REQUIRES A SEPARATE AGREEMENT

    Duck: I can send it again if we're cool with that

    They agree to get a new message.

    Two flips can pass

    FRESH TEST: 1011 | 1. FLIP DATA POSITIONS 1 AND 2

    0111 | 1 → TOTAL ONES 4 (EVEN)

    Robot: There are four ones.

    New data is 0111. It's different from the original 1011.

    ORIGINAL DATA 1011 ≠ RECEIVED DATA 0111

    EVEN TOTAL → PASS. DATA CHANGED

    Robot: The data changed

    What the check can tell us

    PASS ≠ PROOF OF UNCHANGED DATA

    Duck: It doesn't mean it got here unscathed, just because it passed.

    Robot: one check bit has limits.

    Robot checks it first.

    Duck: Check first. Use our agreed plan

    Even parity

    EVEN PARITY: COUNT ALL ONES IN DATA + CHECK

    The rule that's settled upon is that the total should be even.

    So if you flipped an odd number of bits it will be a failing check. If you flipped an even number of bits then you still have an even total number of 1's in the data and check bits and the check will pass. But a passing check doesn't mean that the message wasn't altered. This doesn't tell you where the bad bit is, nor does it fix the bad bit. If you want a retransmit you'd have to have some established way to ask for that.

    Try a changed check bit

    START: DATA 1100 | CHECK 0. FLIP ONLY CHECK → 1100 | 1

    Answer

    1100 | 1 → 3 ONES → ODD → FAIL

    Duck knows because it was a test he set up. Robot gets 1100 + check bit 1. It sees 3 1s across the 5 positions. 3 is odd, so it fails the even parity check. Robot can't tell what bit is different (and fix it) just from this check.

    Sources

    Microchip, Application Note AN774: Asynchronous Communications with the PICmicro USART (opens in a new tab)