Bits and Bytes
Computers store information in bits, which are labeled 0 (empty) or 1 (full).
A set of 8 bits is called a byte, like this: 1010 0010
Each byte has an address, which is labeled with a hexadecimal number, like this: C7.
Decimal, Hexadecimal, and Binary Numbers
Decimal Numbers
When we learn to count, we use Decimal numbers (0-10). The Decimal number system is also called Base 10, since after the number 9, we add a 0 for 10.
Hexadecimal Numbers
The address (location) of a byte is given in Hexadecimal numbers (0-F). This number system is called Base 16, since after the number 9, we use A, B, C, D, E, and F. After F, we add a 0 for 10.
Binary Numbers
Computers store information as Binary numbers (0-1). This number system is also called Base 2, since after the number 1, we add a 0 for 10.
Here is a chart to help you understand these numbers:
Decimal | Hexadecimal | Binary |
0 | 0 | 0000 0000 |
1 | 1 | 0000 0001 |
2 | 2 | 0000 0010 |
3 | 3 | 0000 0011 |
4 | 4 | 0000 0100 |
5 | 5 | 0000 0101 |
6 | 6 | 0000 0110 |
7 | 7 | 0000 0111 |
8 | 8 | 0000 1000 |
9 | 9 | 0000 1001 |
10 | A | 0000 1010 |
11 | B | 0000 1011 |
12 | C | 0000 1100 |
13 | D | 0000 1101 |
14 | E | 0000 1110 |
15 | F | 0000 1111 |
16 | 10 | 0001 0000 |
Converting Binary Numbers to Decimal
Let’s convert the binary number 1001 1010 to a decimal number:
Binary= | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | |
x128 | x64 | x32 | x16 | x8 | x4 | x2 | x1 | ||
= | = | = | = | = | = | = | = | Decimal | |
128 | +0 | +0 | +16 | +8 | +0 | +2 | +0 | =154 |
This means that binary 1001 1010 = decimal 154.
Converting Hexadecimal to Decimal
Let’s convert the hexadecimal number C7F8 to a decimal number:
Hexadecimal= | C | 7 | F | 8 | |
x4096 | x256 | x16 | x1 | ||
= | = | = | = | Decimal | |
49152 | +1792 | +240 | +8 | =51192 |
This means that hexadecimal C7F8 = 51192 decimal.
Converting Hexadecimal to Binary
Hexadecimal numbers usually begin with 0x, which we don’t count when converting to binary. Let’s convert the hexadecimal number OxA2D3 to a binary number:
Hexadecimal= | A | 2 | D | 3 | |
= | = | = | = | ||
1010 | 0010 | 1101 | 0011 | =Binary |
This means that hexadecimal 0xA2D3 = 1010 0010 1101 0011 binary.
Leave a comment