数字逻辑2-3
- 格式:pdf
- 大小:192.87 KB
- 文档页数:14
2.3 Codes in binary system
BCD codes: for decimal digit;
Gray code: for numbers in binary system; ASCII code: for characters;
Codes in binary system
Key point :
Use n bits, we can make 2n different words;
To make n code-words, you must use
bits.
⎡⎤n 2log
BCD codes
Binary codes for decimal digits ( Table 2-9 )
BCD codes
Express 10 digit ( 0——9) : use 4 or more bits, Express 10 digit ( 0
many different way for coding
8421 code
ural code , just lake 4-bit
Nat
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
Each digit is weighted;
Self-complementing;
Use MSB to express
higher/lower part;
It has 10 valid codes and
6 invalid codes.
2421 codes
BCD codes
Excess-3 code
Its digit is not weighted;
lf-complementing ;
Se Self-complementing ;
8421 code +
0011”” .
8421 code + ““0011
BCD codes Examples:
use BCD code for decimal numbers A = 19.46 8421 code : A = 0001 1001. 0100 0110
2421 code : A = 0001 1111. 0100 1100 Excess-3 code: A = 0100 1100. 0111 1001
Key point
Each decimal digit is coded by a 4-bits string!
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 other things
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
⎡⎤n 2log
Codes 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;。