
Just like the octal number system, the hexadecimal (or base-sixteen) number system provides a convenient way to express binary numbers. Table 2-6 shows the weighting for the hexadecimal number system up to 3 decimal places before and 2 places after the hexadecimal point. Based on the trend in previous number systems, the methods used to convert hexadecimal to decimal and vice versa should be intuitive
Weights |
162 |
161 |
160 |
. |
16-1 |
16-2 |
Table 2-6 Hexadecimal Weights
Table 2-7 lists the equivalent decimal, binary and hexadecimal representations for the decimal numbers ranging from 0 to 15.
Decimal |
Binary |
Hexadecimal |
0 |
0000 |
0 |
1 |
0001 |
1 |
2 |
0010 |
2 |
3 |
0011 |
3 |
4 |
0100 |
4 |
5 |
0101 |
5 |
6 |
0110 |
6 |
7 |
0111 |
7 |
8 |
1000 |
8 |
9 |
1001 |
9 |
10 |
1010 |
A |
11 |
1011 |
B |
12 |
1100 |
C |
13 |
1101 |
D |
14 |
1110 |
E |
15 |
1111 |
F |
Table 2-7 Number Systems Equivalency Table
| Note that each hexadecimal number may be represented as a 4 digit binary number. |
Because each hexadecimal digit can be represented by a four-bit binary number (see Table 2-7), it is very easy to convert from hexadecimal to binary. Simply replace each hexadecimal digit with the appropriate four-bit binary number as indicated in the examples below.
Examples
A
3 16 = (10100011) 2(37.12) 16 = (00110111.00010010) 2
Converting binary to hexadecimal is another simple process. Break the binary digits into groups of four starting from the binary point and convert each group into its appropriate hexadecimal digit. For whole numbers, it may be necessary to add a zero as the MSB in order to complete a grouping of four bits. Note that this addition does not change the value of the binary number. Similarly, when representing fractions, it may be necessary to add a trailing zero in the LSB in order to form a complete grouping of four.
Examples:
Converting (1010111) 2 to hexadecimal
0111 = 7 (LSB)
0010 = 5 (MSB)
thus (1010111) 2 = (57) 16
Converting (0.00111111) 2 to hexadecimal
0011 = 3 (MSB)
1111 = F (LSB)
thus (0.00111111) 2 = (0.3F) 16
Copyright © Adrian Als , 1999
This page was last modified: Wednesday, April 12, 2000