|
|
| JetGDI 2003-02-13, 12:03 am |
| Can anyone explain it to me?
I understand the concept of 1-9 = 1-9 and
10-15 = A-F.
But when I see a Hex number I have know idea
how to convert it to binary or decimal.
I have a firm grasp on binary so I don't think that is the problem.
Take the decimal number 16 for example
Dec. = 16
bin. = 10000
hex = 10 ? wtf? where did they get that?
to me, in hex, the number 16 should be F1
F=15 + 1 ... that makes 16.
I know it's a simple trick that escapes me..
can anyone help? | |
| xsr999 2003-02-13, 2:41 am |
| b=bin
d=dec
h=hex
0001b = 1d = 1h
0010b = 2d = 2h
1010b = 10d = Ah
1011b = 11d = Bh
1111b = 15d = Fh
The first part should be easy
10000b = 16d = 10h
Instead of writing the bin like this 10000
write it like this 0001 0000.
0001 = 1
0000 = 0
101111 seperate it like this 0010 1111
0010 = 2
1111 = F
Hope you understand, if not keep asking. | |
|
| Decimal to Hex
1.
Convert the decimal into binary.
i.e. 16 decimal - 10000 Binary
2.
Split the binary into nibbles (4 bits) pad it out if it makes it easier for you.
10000 (or 00010000) split into nibbles gives us
0001 0000
3.
Convert each nibble into Hex and put the figures together.
0001 0000
1 0
16 decimal = 10 Hex
Get it? It's just the reverse for Hex to decimal.
Try a few examples - Decimal to Hex
Decimal - Hex
8 ?
14 ?
35 ?
255 ? (you should know this one!)
Hex - Decimal
A ?
12 ?
BC ?
FF ?
Check the answer on your windows calc, any your not sure on post here. | |
| ANDRONDA 2003-02-13, 12:53 pm |
| The easy way I do it is assign the various values.
0 = 0
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9
10 = A
11 = B
12 = C
13 = D
14 = E
15 = F
16 = G
17 = H
Then think in “fours”
0 0 0 0
You know that an all “zero” equals zero and all “ones” equal 16. And then there is everything in between. Each place has a value based on powers of 2.
The values are”
8 4 2 1 (substitute these number for each 0 above)
You are only going to either see 1’s or 0’s. Based on where they are they denote the value.
For example:
8421 (your Key)
0000 is 0
0001 is 1 (look a the key)
0010 is 2
0011 is 3 (1+2)
0100 is 4
0101 is 5 (4+1)
When you get to ten it switches to the ABC’s
1010 is A (8+2 = 10)
1011 is B
1100 is C
And so on until you arrive at
1111 which is F and that is as high as you can go in this system.
To convert from decimal to hex take any decimal number from 0 to 16.
Choose 6
Ok that is
0110 (0+4+2+0) in binary and obviously 6 in hex as well.
Try 11
That is
1011 (8+0+2+1= 11) in binary.
In hex it is B because as you recall after the number 9 we start with ABC’s.
Now you may see many groupings of numbers such as:
6.F.7.A
Just blow them out to binary.
0110.1111.0111.1010
Then add up the values from the key:
6.16.7.10 | |
| edmonds_robert 2003-02-13, 1:58 pm |
| Here's an easy way to convert from hex to decimal:
(rightmost digit) + (2nd digit*16) + (3rd digit*256) + (4th digit*4096) and so on. |
|
|
|