1、Chapter 2 Number systems and codes u Decimal and Binary u Unsigned and Signed u Code for Numbers and CharactersCodes in binary systemWord:a digital string to represent an object;Use n bits,we can make 2n different words;To make n different words,you must use bits.n2logBinary codes for decimal digits
2、:use 4 or more bits express 10 digit(09)8421 code2421 codes Excess-3 codeBiquinary code 1-out-of-10 codeBCD codesBCD codesBinary codes for decimal digits (Table 2-9)8421 codeNatural code,just lake 4-bit binary numbers;Each digit is weighted;It has 10 valid code words and 6 invalid code words.BCD cod
3、esEach digit is weighted;Self-complementing;Use MSB to express higher/lower part;It has 10 valid codes and 6 invalid codes.2421 codesBCD codesBCD codesExcess-3 codeIts digit is not weighted;Self-complementing;8421 code+“0011”.Examples:use BCD code for decimal numbers A=19468421 code :A=0001 1001 010
4、0 01102421 code :A=0001 1111 0100 1100Excess-3 code:A=0100 1100 0111 1001 BCD codes1-out-of-10 codeOne hot code:It is very useful in control systems.BCD codesBCD codesBiquinary code 7-bits;two hot code;First 2 bits is one hot code for higher/lower range;Last 5 bits is one hot code in the range.Error
5、-detecting property!Gray codesTarget:code for continues changed numbers(in binary system)to prevent wrong code happened in transition time;Property:In each pair of successive code words,only one bit changes.Gray codesFrom binary number to Gray code The width is same,the MSB is same;From left to righ
6、t,if a bit in binary number is same as its left bit,the gray code is 0,if it is different,the gray code is 1.Examples:binary number:1001 0010 0110 0011 Gray codes:1101 1011 0101 0010Codes for charactersCharacter codes:ASCII,7-bits string,128 code words;(p.54 Table 2-11)Example:How are you!1001000 11
7、01111 1110111 0100000 1100001 1110010 1100101 0100000 1111001 1101111 1110101 0100001 Codes for other thingsCodes for actions,conditions or states:Use n bits,we can make 2n different words;To make n different words,we must use bits.p.55 Table 2-12n2logCodes transmit way in digital circuitParallel codes use n-line to transmit an n-bits code words;transmit an n-bits code words in one time period;Serial codes use one line to transmit an n-bits code words;transmit an n-bits code words in n time period;