Binary Codes:
BCD (Binary Coded Decimal)
BCD is a numeric code in which each digit of a decimal number is represented a separate group of 4-bits. The most common BCD code is 8-4-2-1 BCD.
The weights is associated with 4 bits are 8-4-2-1 from left to right.
In multidigit coding, each decimal digit is individually coded with 8-4-2-1 BCD code.
Decimal |
BCD code |
|||
Digit |
8 |
4 |
2 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
2 |
0 |
0 |
1 |
0 |
3 |
0 |
0 |
1 |
1 |
4 |
0 |
1 |
0 |
0 |
5 |
0 |
1 |
0 |
1 |
6 |
0 |
1 |
1 |
0 |
7 |
0 |
1 |
1 |
1 |
8 |
1 |
0 |
0 |
0 |
9 |
1 |
0 |
0 |
1 |
Advantage:
Easy to convert between it and decimal.
Disadvantage:
Arithmetic operation are more complex.
It required more binary digit to represent multi digit.
Excess-3 code
The excess-3 code can be derived from the natural BCD code by adding 3 to each coded number.
It is sequential code because we get any code by adding binary 1 to any previous code .
Decimal digit |
Excess-3 code |
|||
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
0 |
2 |
0 |
1 |
0 |
1 |
3 |
0 |
1 |
1 |
0 |
4 |
0 |
1 |
1 |
1 |
5 |
1 |
0 |
0 |
0 |
6 |
1 |
0 |
0 |
1 |
7 |
1 |
0 |
1 |
0 |
8 |
1 |
0 |
1 |
1 |
9 |
1 |
1 |
0 |
0 |
Gray Code:
Gray code is a non-weighted code and is a special case of unit distance code.
Decimal Code |
Gray Code |
|||
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
1 |
2 |
0 |
0 |
1 |
1 |
3 |
0 |
0 |
1 |
0 |
4 |
0 |
1 |
1 |
0 |
5 |
0 |
1 |
1 |
1 |
6 |
0 |
1 |
0 |
1 |
7 |
0 |
1 |
0 |
0 |
8 |
1 |
1 |
0 |
0 |
9 |
1 |
1 |
0 |
1 |
10 |
1 |
1 |
1 |
1 |
11 |
1 |
1 |
1 |
0 |
12 |
1 |
0 |
1 |
0 |
13 |
1 |
0 |
1 |
1 |
14 |
1 |
0 |
0 |
1 |
15 |
1 |
0 |
0 |
0 |
ASCII:
ASCII code is a seven bit in which the decimal digit are represented by the BCD code preceded by 011.
Capital A to Z alphabets are represented by 41 to 5A.
Small a to z alphabet are represented by 61 to 6A.
Numbers 0 to 9 are represented by 30 to 39.
No comments:
Post a Comment