|
Numbering Systems
(continued...)
Hexidecimal (base 16)
Remember, that eight bits make a byte, and that
it takes eight bits to store a single character in the computer.
1024 bytes make a kilobyte and 1024 is divisible by eight. Seems
like the magic number for computers is eight. The thing is,
even relatively low binary numbers can be long and cumbersome.
The hexidecimal numbering system consists of
sixteen digits. The digits, from smallest to largest are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Once again, any number can be broken down into
columns. Each column is a placeholder. Using the hexidecimal
numbering system, from right to left, the first column is the
1's column, then the 16's column, then the 256's, then the 4096's,
then the 65536's column, etc.. Because you multiply the number
in each previous column by 16, you can see that the numbers
get very large and scary very quickly.
Here's the number 137:
0 X 65536 = 0 (0 sixty-five thousand five hundred
thirty-sixes)
0 X 4096 = 0 (0 four thousand ninety-sixes)
8 X 16 = 128
9 X 1 = 9
0 + 0 + 128 + 9 = 137
Decimal 137 = 89h (Hexidecimal)
Here's an easier way. Any group of 4 binary
digits can represent up to sixteen values. A single hexidecimal
digit can stand for any one of the 16 values that can be represented
by any 4 bit binary number. In other words, break any binary
number into groups of 4 bits. Use a chart (or if your memory
is good you can use that) to find the proper hex number that
represents those four bits. I know, it sounds a bit confusing,
so let's do a couple.
Here's the chart:
|
Decimal
|
Hex
|
Binary
|
|
0
|
0
|
0000
|
|
1
|
1
|
0001
|
|
2
|
2
|
0010
|
|
3
|
3
|
0011
|
|
4
|
4
|
0100
|
|
5
|
5
|
0101
|
|
6
|
6
|
0110
|
|
7
|
7
|
0111
|
|
8
|
8
|
1000
|
|
9
|
9
|
1001
|
|
10
|
A
|
1010
|
|
11
|
B
|
1011
|
|
12
|
C
|
1100
|
|
13
|
D
|
1101
|
|
14
|
E
|
1110
|
|
15
|
F
|
1111
|
Lets try the number 137 again:
From the previous page, we know that the binary
equivalent is 10001001.
Break this into 2 groups of 4 bits, [1000][1001]
Use the chart to find Hex numbers
[1000] = 8h
[1001] = 9h
Decimal = 137
Binary equivalent = 10001001
Hexidecimal equivalent = 89h
Make sense?
If you don't understand it this far, go back over it until you
do, or get some help.
Hexidecimal numbers are followed by a lowercase
'h' to designate them as hex.
One thing to keep in mind is that if you have
a binary number like
10 (2 decimal), you can add zeros to the left
to make it a full 4 bit number. eg. 0010
|
Decimal
|
Hex
|
Binary
|
|
0
|
0
|
0000
|
|
1
|
1
|
0001
|
|
2
|
2
|
0010
|
|
3
|
3
|
0011
|
|
4
|
4
|
0100
|
|
5
|
5
|
0101
|
|
6
|
6
|
0110
|
|
7
|
7
|
0111
|
|
8
|
8
|
1000
|
|
9
|
9
|
1001
|
|
10
|
A
|
1010
|
|
11
|
B
|
1011
|
|
12
|
C
|
1100
|
|
13
|
D
|
1101
|
|
14
|
E
|
1110
|
|
15
|
F
|
1111
|
OK, lets try the number 77:
We know from the previous page that the binary
equivalent is 01001101.
Let's break that into two groups of 4 bits.
[0100][1101].
Now let's check the chart.
[0100] = 4h
[1101] = Dh
Decimal = 77
Binary equivalent = 01001101
Hexidecimal equivalent = 4Dh
Check it!
0 X 65536 = 0 (0 sixty-five thousand five hundred
thirty-sixes)
0 X 4096 = 0 (0 four thousand ninety-sixes)
0 X 256 = 0 (0 two hundred fifty-sixes)
4 X 16 = 64 (4 sixteens)
D X 1 = 13 (D ones) (remember we're using hex, D = 13 decimal)
0 +0 + 0 + 64 + 13 = 77 decimal
Now, if all this has completely confused you,
don't worry. Remember, this isn't your only resource. Check
out your books, the internet, ask someone else. Once you've
found a method that you can understand, keep it in mind (or
maybe a safer place). If you need to convert a number, refer
to it, make the conversion, then lock it away again.
Tip:
Use a calculator. A scientific calculator will do these conversions
for you.
continued...
|