Alex Rivera | Logout

Binary coded decimal (BCD) to Hexadecimal conversion

Asked 2010-12-20T22:34:58.270
9

can someone explain to me how to convert BCD to Hexadecimal? For example how can i convert 98(BCD) to Hexadecimal. Thanks.

Edit
Report

1 Answer

2

Go between different combinations of Hex, Decimal, and Binary. If you know how binary works then you should easily be able to use BCD:

Hex  Dec  BCD
0    0    0000
1    1    0001
2    2    0010
3    3    0011
4    4    0100
5    5    0101
6    6    0110
7    7    0111
8    8    1000
9    9    1001
A   10    0001 0000 <-- notice that each digit looks like hex except it can only go to 9.
B   11    0001 0001
C   12    0001 0010
D   13    0001 0011
E   14    0001 0100
F   15    0001 0101

Once you got this part of it down, you should be able to use divide by 10 or %10 to find any combination to generate your BCD. Since it only uses 10 combinations instead of all 16 you will lose some information.

answered 2010-12-20T22:49:11.627

Your Answer