2nd try without HTML!

Don't have a good site, but perhaps this will help.  BTW,
this assumes (and we all know how dangerous that is) that
you are fairly comfortable with binary math.  If you
aren't, I suggest you visit www.learntosubnet.com and
review their section on binary math.

Converting from Hex is quite simple if you use Binary as
your conversion medium or what I call the Nibble Method.
Since Hex is Base16 and Binary is Base2, you can think
of Hex as shorthand for Binary.  In Binary each column
position has a range of two values ( 0 or 1 ).  In Hex
each column position has a range of sixteen values (0-9
& A-F, where A=10, B=11, C=12, D=12, E=14, F=15).
Finally, in Decimal each column position has a range of
ten values (0 - 9).

>From this we can see that it takes four bit positions in
binary to represent all the possible values of one hex
position.  For example, with one binary nibble (four bits):

binary  hex  binary  hex  binary  hex  binary  hex
0000  =  0   0100  =  4   1000  =  8   1100  =  C
0001  =  1   0101  =  5   1001  =  9   1101  =  D
0010  =  2   0110  =  6   1010  =  A   1110  =  E
0011  =  3   0111  =  7   1011  =  B   1111  =  F

Thus any two character HEX number (as Hex is normally
displayed) can be converted to binary simply by converting
each character separately.

HEX:         A     D              E    7
thus
BINARY:     1010  1101          1110  0111
thus
DECIMAL:  128+32+8+4+1 = 173 & 128+64+32+4+2+1 = 231
PROOF:  16^0=1, D * 1 = 13*1 = 13
        16^1=16, A * 16 = 10 * 16 = 160
        160 + 13 = 173
PROOF:  16^0=1, E * 1 = 7 * 1 = 7
        16^1=16, 7 * 16 = 14 * 16 = 224
        224 + 7 = 231

Larger Hex numbers are also easily converted

HEX:         6    B     F
thus
BINARY:    0110  1011  1111
thus
DECIMAL:  1024+512+128+32+16+8+4+2+1 = 1727
PROOF:   16^0 = 1, F * 1 = 15 * 1 = 15
         16^1 = 16, B * 16 = 11 * 16 = 176
         16^2 = 256, 6 * 256 = 1536
         1536 + 176 + 15 = 1727

Going from Decimal to Hex is just a reverse of the above
process. Convert the Decimal number to Binary, divide the
binary bits (working right to left) into Nibbles and then
convert each Nibble to Hex.

When converting Decimal to Binary I prefer the division by two method.
You divide the Decimal number by two and the remainder becomes the
first binary bit, working from right to left.

DECIMAL:   792
CONVERSION:
      792/2 = 396 Remainder 0,  BINARY = 0
      396/2 = 198 Remainder 0,  BINARY = 00
      198/2 =  99 Remainder 0,  BINARY = 000
       99/2 =  49 Remainder 1,  BINARY = 1000
       49/2 =  24 Remainder 1,  BINARY = 1 1000
       24/2 =  12 Remainder 0,  BINARY = 01 1000
       12/2 =   6 Remainder 0,  BINARY = 001 1000
        6/2 =   3 Remainder 0,  BINARY = 0001 1000
        3/2 =   1 Remainder 0,  BINARY = 1 0001 1000
        1/2 =   0 Remainder 1,  BINARY = 0011 0001 1000
                                         ^^ Padded to make a nibble
BINARY:   0011  0001  1000
HEX:       3     1     8
PROOF:  16^0 = 1, 1 * 8 = 8
        16^1 = 16, 16 * 1 = 16
        16^2 = 256, 256 * 3 = 768
        768+16+8 = 792

Another method was provided by Priscilla in a response
to a similar question by someone else.  Whichever you
use, just remember that practice is the key to
understanding.

HTH,

Tom Lisa, Instructor, CCNA, CCAI
Community College of Southern Nevada
Cisco Regional Networking Academy




_________________________________
FAQ, list archives, and subscription info: http://www.groupstudy.com/list/cisco.html
Report misconduct and Nondisclosure violations to [EMAIL PROTECTED]

Reply via email to