Книга: Introduction to Microprocessors and Microcontrollers
Converting hex to denary
Converting hex to denary
To do this, we can use a similar method to the one we used to change binary to denary.
Example
Convert A40E5H to denary
1 Each column increases by 16 times as we move towards the righthand side so the column values are:
164 | 163 | 162 | 161 | 160 |
---|---|---|---|---|
65536 | 4096 | 256 | 16 | 1 |
2 Simply enter the hex number using the columns
65536 | 4096 | 256 | 16 | 1 |
---|---|---|---|---|
A | 4 | 0 | E | 5 |
3 Use your calculator to find the denary value of each column
65536 | 4096 | 256 | 16 | 1 |
---|---|---|---|---|
A | 4 | 0 | E | 5 |
655360 | 16384 | 0 | 224 | 5 |
The left-hand column has a hex value of 1010 (A=10) so the column value is 65536?10=655360. The next column is 4?4096=16384. The next column value is zero (256?0). The fourth column has a total value of 16?14=224 (E = 14). The last column is easy. It is just 1?5=5 no calculator needed!
4 Add up all the denary values:
655 360 + 16 384 + 0 + 224 + 5 = 671 97310
Method
1 Write down the column values using a calculator. Starting on with 160 (=1) on the right-hand side and increasing by 16 times in each column towards the left.
2 Enter the hex numbers in the appropriate column, converting them into denary numbers as necessary. This means, for example, that we should write 10 to replace an ‘A’ in the original number.
3 Multiply these denary numbers by the number at the column header to provide a column total.
4 Add all the column totals to obtain the denary equivalent.
Another example
Convert 4BF0H to denary
163 | 162 | 161 | 160 | column values |
---|---|---|---|---|
4096 | 256 | 16 | 1 | column values |
4 | 11 | 15 | 0 | hex values |
16 384 | 2816 | 240 | 0 | denary column totals |
Total = 16 384 + 2816 + 240 + 0 = 19 44010
- Hexadecimal, or ‘hex’ to its friends
- 3. Hexadecimal – the way we communicate with micros
- Converting denary to hex
- Converting binary to hex
- Converting hex to binary
- Глава 4 Работа с программой GraphExpress
- 1.6 Converting Binary Numbers into Decimal
- 1.7 Converting Decimal Numbers into Binary
- 1.8 Converting Binary Numbers into Hexadecimal