Книга: Advanced PIC Microcontroller Projects in C

1.10 Converting Hexadecimal Numbers into Decimal

1.10 Converting Hexadecimal Numbers into Decimal

To convert a hexadecimal number into decimal, calculate the sum of the powers of 16 of the number.

Example 1.11

Convert hexadecimal number 2AC16 into decimal.

Solution 1.11

Calculating the sum of the powers of 16 of the number:

2AC16 = 2 ? 162 + 10 ? 161 + 12 ? 160

      = 512 + 160 + 12

      = 684

The required decimal number is 68410.

Example 1.12

Convert hexadecimal number EE16 into decimal.

Solution 1.12

Calculating the sum of the powers of 16 of the number:

EE16 = 14 ? 161 + 14 ? 160

     = 224 + 14

     = 238

The decimal number is 23810.

Оглавление книги


Генерация: 0.662. Запросов К БД/Cache: 2 / 0
поделиться
Вверх Вниз