Number systems and codes Chapter 2 Number systems and codes Decimal and Binary Unsigned and Signed Code for Numbers and Characters
Codes in binary system Word: 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.
BCD codes Binary codes for decimal digits : use 4 or more bits express 10 digit ( 0—9) 8421 code 2421 codes Excess-3 code Biquinary code 1-out-of-10 code
BCD codes Binary codes for decimal digits ( Table 2-9 )
BCD codes 8421 code Natural code , just lake 4-bit binary numbers; Each digit is weighted; It has 10 valid code words and 6 invalid code words.
BCD codes 2421 codes Each digit is weighted; Self-complementing; Use MSB to express higher/lower part; It has 10 valid codes and 6 invalid codes.
BCD codes Excess-3 code Its digit is not weighted; Self-complementing ; 8421 code + “0011” .
BCD codes Examples: use BCD code for decimal numbers A = 1946 8421 code : A = 0001 1001 0100 0110 2421 code : A = 0001 1111 0100 1100 Excess-3 code: A = 0100 1100 0111 1001
BCD codes 1-out-of-10 code One hot code: It is very useful in control systems.
BCD codes Biquinary 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-detecting property !
Gray codes Target: 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 codes From binary number to Gray code The width is same, the MSB is same; From left to right, 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 0010
Codes for characters Character codes : ASCII , 7-bits string, 128 code words; ( p.54 Table 2-11) Example: How are you! 1001000 1101111 1110111 0100000 1100001 1110010 1100101 0100000 1111001 1101111 1110101 0100001
Codes for other things Codes 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-12
Codes transmit way in digital circuit Parallel 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;