Error Control Lab

Data Communication, Lecture 11. Frame data with byte and bit stuffing, then protect it with parity, Hamming codes, CRC and checksums. Flip bits and watch what each code catches. Works offline.

Byte stuffing (character-oriented)

frame sent (ESC added before every FLAG or ESC in the data):

Bit stuffing (bit-oriented, flag 01111110)

data from upper layer:

frame sent (a 0 after every five consecutive 1s, shown in orange):

Stop the data looking like a flag

Bytes addedBits added

Forouzan Figure 11.4 uses the default bits: 22 data bits become 24.

Simple parity C(5,4): click received bits to flip them

Two-dimensional parity: click any bit to flip it

Count the 1s

Codeword sentBits flipped

Simple parity catches any odd number of flipped bits. The grid catches more, but four flips at the corners of a rectangle slip through.

Codeword a3 a2 a1 a0 r2 r1 r0 (sent) and received: click a received bit to flip it

sent

received

Find and fix one error

Check bits r2 r1 r0Syndrome s2 s1 s0Points toCorrected dataword

r0 = a2+a1+a0, r1 = a3+a2+a1, r2 = a1+a0+a3 (mod 2), as in the course slides. Flip two bits and watch it "correct" the wrong bit.

Modulo-2 long division

Received codeword: click to flip bits

Divide, keep the remainder

Remainder (check bits)CodewordReceiver syndrome

Defaults are Forouzan Figure 10.6: 1001 with divisor 1011 gives remainder 110 and codeword 1001110. Try 1101011011 with 10011.

One's-complement checksum

Add, wrap, complement

16-bit example: the text “Forouzan” is 466F 726F 757A 616E → checksum 7038.