Книга: Advanced PIC Microcontroller Projects in C
1.6 Converting Binary Numbers into Decimal
Разделы на этой странице:
1.6 Converting Binary Numbers into Decimal
To convert a binary number into decimal, write the number as the sum of the powers of 2.
Example 1.1
Convert binary number 10112 into decimal.
Solution 1.1
Write the number as the sum of the powers of 2:
10112 = 1 ? 23 + 0 ? 22 + 1 ? 21 + 1 ? 20
= 8 + 0 + 2 = 1
= 11
or, 10112 = 1110
Example 1.2
Convert binary number 110011102 into decimal.
Solution 1.2
Write the number as the sum of the powers of 2:
110011102 = 1 ? 27 + 1 ? 26 + 0 ? 25 + 0 ? 24 + 1 ? 23 + 1 ? 22 + 1 ? 21 + 0 ? 20
= 128 + 64 + 0 + 0 + 8 + 4 + 2 + 0
= 206
or, 110011102 = 20610
Table 1.1 shows the decimal equivalent of numbers from 0 to 31.
Table 1.1: Decimal equivalent of binary numbers
Binary | Decimal | Binary | Decimal |
---|---|---|---|
00000000 | 0 | 00010000 | 16 |
00000001 | 1 | 00010001 | 17 |
00000010 | 2 | 00010010 | 18 |
00000011 | 3 | 00010011 | 19 |
00000100 | 4 | 00010100 | 20 |
00000101 | 5 | 00010101 | 21 |
00000110 | 6 | 00010110 | 22 |
00000111 | 7 | 00010111 | 23 |
00001000 | 8 | 00011000 | 24 |
00001001 | 9 | 00011001 | 25 |
00001010 | 10 | 00011010 | 26 |
00001011 | 11 | 00011011 | 27 |
00001100 | 12 | 00011100 | 28 |
00001101 | 13 | 00011101 | 29 |
00001110 | 14 | 00011110 | 30 |
00001111 | 15 | 00011111 | 31 |
Оглавление статьи/книги
- 1.1 Introduction
- 1.2 Microcontroller Systems
- 1.3 Microcontroller Features
- 1.4 Microcontroller Architectures
- 1.5 Number Systems
- 1.6 Converting Binary Numbers into Decimal
- 1.7 Converting Decimal Numbers into Binary
- 1.8 Converting Binary Numbers into Hexadecimal
- 1.9 Converting Hexadecimal Numbers into Binary
- 1.10 Converting Hexadecimal Numbers into Decimal
- 1.11 Converting Decimal Numbers into Hexadecimal
- 1.12 Converting Octal Numbers into Decimal
- 1.13 Converting Decimal Numbers into Octal
- 1.14 Converting Octal Numbers into Binary
- 1.15 Converting Binary Numbers into Octal
- 1.16 Negative Numbers
- 1.17 Adding Binary Numbers
- 1.18 Subtracting Binary Numbers
- 1.19 Multiplication of Binary Numbers
- 1.20 Division of Binary Numbers
- 1.21 Floating Point Numbers
- 1.22 Converting a Floating Point Number into Decimal
- 1.23 BCD Numbers
- 1.24 Summary
- 1.25 Exercises
Похожие страницы
- Hexadecimal, or ‘hex’ to its friends
- Maintaining Accurate Serial Numbers
- Numbers
- 13.5. Binary Utilities
- 13.6. Miscellaneous Binary Utilities
- 1.7 Converting Decimal Numbers into Binary
- 1.8 Converting Binary Numbers into Hexadecimal
- 1.9 Converting Hexadecimal Numbers into Binary
- 1.10 Converting Hexadecimal Numbers into Decimal
- 1.11 Converting Decimal Numbers into Hexadecimal
- 1.12 Converting Octal Numbers into Decimal
- 1.13 Converting Decimal Numbers into Octal