Friday, May 10, 2013

Hex and How it Works

Since my dad taught me about hex I thought I should put it in one of my posts.


This is how you count to 15 in hex.
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

Looks pretty weird huh? Well believe it or not those letters are numbers in hex!

A=10
B=11
C=12
D=13
E=14
F=15

Since there are more digits before you overlap numbers that look like decimal numbers are actually
much higher.For example:
                                         10 in hex = 16 in decimal

Lets count to 20 in decimal then count to 20 in hex.
                 
 1
 2
 3
 4
 5
 6
 7
 8
 9 
10
11
12
13
14
15
16
17
18
19
20
 1
 2 
 3
 4 
 5
 6
 7
 8
 9
 A
 B
 C
 D
 E
 F
 10
 11
 12
 13
 14

I'm sure there are some differences you notice very quickly. The reason the numbers after F look like 10 to 14 is because the 1 tells how many 16's there are and the number after shows how many 1's there are.
This time were going to count to 20 in hex then were going to count to 20 in binary.


0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
10
11
12
13
14
 0000
 0001
 0010
 0011
 0100
 0101
 0110
 0111
 1000
 1001
 1010
 1011
 1100
 1101
 1110
 1111
10000
10001
10010
10011
10100




Binary and hex are related in a way can you see it? (If you can't the answers at the bottom of the page.)

The reason we use hex is because computers think in binary and if they showed numbers in binary there would be so many 1's and 0's it would take forever to figure out what the number was. So we abstract binary digits into hex digits to make it easier to show the numbers. 1 hex number = 4 binary digits which =1 nibble. So the way to convert binary numbers into hex is simple.

1011  1010  0111  1111  1110  1100
 D       A       7        F        E       C

Answer: Binary and hex are related because both of them add an extra digit when they get to 16 because they both overlap at 16.

No comments:

Post a Comment