written 2.9 years ago by |
a] BCD and Ex-3 codes: In this code decimal digits 0 through 9 are represented (coded) by their natural binary equivalents using four bits and each decimal digit of decimal number is represented by this four bit individually.
Example $(23)_{10}$ is represented as 0010 0011 using BCD code, rather usual $(10111)_2$
Hence BCD representates requires more number of bits to code a decimal number using BCD code than using straight binary code.
This code is also known as 8 – 4 – 2 – 1 code and hence also called as weighted code.
Ex-3 code: It is a very useful code in which a decimal number in binary form in such a way that each gray-code number differs from the preceding and the succeeding number by single bit.
- Example: gray code for $(5)_{10} \rightarrow (0111)$
and gray code for $(6)_{10} \rightarrow (0101)$
The above two codes differs by only one bit.
- Gray code is a reflected code and can be constructed using following properties.
1] A 1-bit gray code has two codes 0 and 1 representing decimal nos 0 and 1 respectively.
2] An n-bit ($n \geq$ 2 ) gray code will have first $2^n-1$ gray codes of (n-1) bits written in order with a leading o appended.
3] The last $2^n . 1$ gray codes will be to gray code words of an (n – 1) bit gray code, written in reverse order.
Example.
1] Bit Gray code
Decimal No. | Gray code |
---|---|
0 | 0 |
1 | 1 |
2] Bit Gray code
Decimal No. | Gray code |
---|---|
0 | 00 |
1 | 01 |
2 | 11 |
3 | 10 |