Digital Electronics Page: Difference between revisions
Jump to navigation
Jump to search
Line 48: | Line 48: | ||
<tr><td>9</td><td>1001</td><td>1100</td></td> | <tr><td>9</td><td>1001</td><td>1100</td></td> | ||
</table> | </table> | ||
For example the excess-3 Code for 25.35 would be | |||
25.35 | |||
33 33 | |||
----- | |||
58 68 | |||
Which is | |||
5 0100 | |||
8 1000 | |||
6 0110 | |||
8 1000 | |||
Therefore | |||
01001000.01101000 |
Revision as of 23:16, 14 January 2023
Gray Codes
This is a technique where we convert number from binary to grays. We do this because Gray reduces the bits we need to change to get to the next number. e.g. changing from 2 to 3 decimal requires a 1 bit change.
Decimal | BCD | Gray Code |
0 | 0000 | 0000 |
1 | 0001 | 0001 |
2 | 0010 | 0011 |
3 | 0011 | 0010 |
4 | 0100 | 0110 |
5 | 0101 | 0111 |
6 | 0110 | 0101 |
7 | 0111 | 0100 |
8 | 1000 | 1100 |
9 | 1001 | 1101 |
10 | 1010 | 1111 |
Excess-3 Codes
To get an excess-3 code of a decimal number simply add 3 to each decimal digit. And then we write the 4-bit binary number for each digit of the decimal number. We can find the excess-3 code of the given binary number by using the following steps:
- We find the decimal number of the given binary number.
- Then we add 3 in each digit of the decimal number.
- Now, we find the binary code of each digit of the newly generated decimal number.
We can also add 0011 in each 4-bit BCD code of the decimal number for getting excess-3 code.
Decimal | BCD | Excess-3 |
0 | 0000 | 0011 |
1 | 0001 | 0100 |
2 | 0010 | 0101 |
3 | 0011 | 0110 |
4 | 0100 | 0111 |
5 | 0101 | 1000 |
6 | 0110 | 1001 |
7 | 0111 | 1010 |
8 | 1000 | 1011 |
9 | 1001 | 1100 |
For example the excess-3 Code for 25.35 would be
25.35 33 33 ----- 58 68
Which is
5 0100 8 1000 6 0110 8 1000
Therefore
01001000.01101000