Representing characters
Representing characters Characters include 0, 1, 2, a, b, c, &, :, ) etc. Encode each character by an integer code number Numeric character code values specified by ASCII American Standard Code for Information Interchange
ASCII Character Code Table Table from Tim's Amstrad NC Users' Site: http://www.ncus.org.uk/dschars.htm
Error Correction & Parity Bits Play “magic trick” using a 6 x 6 grid of cards Student lays out 5 x 5 grid with each card face up or down Add sixth row and column to make the trick “harder” Ask student to flip one card while back is turned Use even parity to identify the erroneous bit From “Computer Science Unplugged” © Bell, Witten, and Fellows, 1998 Page 33
Error Detection & Parity Bits Computers routinely transmit data (in binary form) Transmission errors may occur causing bit(s) to be changed Add an extra bit the so-called parity bit to a bit string Choose the parity bit so that the number of 1’s is even Transmit the data If the number of 1’s in the received bit string is odd, then an error occurred and we must re-transmit that chunk of data
Error Detection & Parity Bits: Example Transmit 8-data bits: 10010010 Apply even parity bit before transmission: 100100101 If we receive: 100000101 We detect an error by noting that the number of 1’s is odd Note: You could also implement an odd parity method in which the parity bit is set so the number of 1’s is odd
Experimenting with Parity Bits Transmit 8-data bits: 10010010 Apply even parity bit before transmission: 100100101 What happens if two bits are inverted due to a transmission error? Answer: The parity would be even so no error would be detected
Experimenting with Parity Bits Reconsider the 6 x 6 grid of cards Suppose we have an error with two cards being flipped? Answer: Parity bits could only tell there was an error Suppose we have an error with three cards being flipped? Suppose we have an error with four cards being flipped? Answer: Parity bits would not reveal an error
Other Error Detection & Recovery Methods Computers can add a row and column of parity bits as in the card trick ECC RAM modules designed for server computers have built-in parity bits For example 1 parity bit for every 8-bits of actual data Adding more than one parity bit can help detect and correct multiple bit errors Other techniques include CRC (Cyclic Redundancy Checking) and Hamming Codes