Example8.3
, a commonly used coding scheme, is much more efficient than the simple repetition scheme. The ASCII (American Standard Code for Information Interchange) coding system uses binary 8-tuples, yielding 28=256 possible 8-tuples. However, only seven bits are needed since there are only 27=128 ASCII characters. What can or should be done with the extra bit? Using the full eight bits, we can detect single transmission errors. For example, the ASCII codes for A, B, and C are
ABCā=6510ā=010000012ā,=6610ā=010000102ā,=6710ā=010000112ā.ā
Notice that the leftmost bit is always set to 0; that is, the 128 ASCII characters have codes
000000002ā011111112āā=010ā,ā®=12710ā.ā
The bit can be used for error checking on the other seven bits. It is set to either 0 or 1 so that the total number of 1 bits in the representation of a character is even. Using even parity, the codes for A, B, and C now become
ABCā=010000012ā,=010000102ā,=110000112ā.ā
Suppose an A is sent and a transmission error in the sixth bit is caused by noise over the communication channel so that (01000101) is received. We know an error has occurred since the received word has an odd number of 1s, and we can now request that the codeword be transmitted again. When used for error checking, the leftmost bit is called a .
By far the most common error-detecting codes used in computers are based on the addition of a parity bit. Typically, a computer stores information in m-tuples called . Common word lengths are 8, 16, and 32 bits. One bit in the word is set aside as the parity check bit, and is not used to store information. This bit is set to either 0 or 1, depending on the number of 1s in the word.
Adding a parity check bit allows the detection of all single errors because changing a single bit either increases or decreases the number of 1s by one, and in either case the parity has been changed from even to odd, so the new word is not a codeword. (We could also construct an error detection scheme based on ; that is, we could set the parity check bit so that a codeword always has an odd number of 1s.)