• Welcome to SC4 Devotion Forum Archives.
 

News:

The SC4 Devotion Forums are no longer active, but remain online in an archived, read-only "museum" state.  It is not possible for regular members to post or use the private messaging system, and no technical support will be provided for any issues pertaining to the forums in their current state.  Attachments (those that still work) are accessible without login.

The LEX has been replaced with SC4Evermore (SC4E), and SC4E maintains an active Discord server.  For traditional forums, we recommend Simtropolis.

Main Menu

Hexidecimal Tutorial

Started by screamingman12, August 22, 2007, 01:02:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

screamingman12

I have been taking the Cisco Networking classes at school, as part of that, I learned Hexidecimal. After reading the tutorial on ST,I have found the Cisco way to be much easier. 

For those who don't already know:

Hexidecimal= Base 16 (0-F)
Decimal= Base 10 (0-9)
Binary= Base 2 (0-1)

Start with this table, this tells you the binary equivalent for each hexidecimal number:

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

convert with this (note: numbers in parentheses represent superscripts)

2(11) 2(10) 2(9) 2(8 ) | 2(7) 2(6) 2(5) 2(4) | 2(3) 2(2) 2(1) 2(0)
2048  1024  512  256 |  128  64   32   16   |  8     4       2    1


so for example '4AF' in hex would be 0100 | 1010 | 1111 in binary (see first chart), plug that into the chart:

2(11) 2(10) 2(9) 2(8 ) | 2(7) 2(6) 2(5) 2(4) | 2(3) 2(2) 2(1) 2(0)
2048  1024  512  256 |  128  64   32   16   |  8     4       2    1
   0       1       0    0  |    1     0     1     0  |  1      1       1    1

Then, add all the numbers with a 1 underneath them:

1024+128+32+8+4+2+1= 1199 in decimal

going from decimal to hex:

let's make 744 a hexidecimal number:

find the largest number on the chart you can subtract 744 from without having a negative number, that's 512:

744-512= 232

so put a 1 under 512

2(11) 2(10) 2(9) 2(8 ) | 2(7) 2(6) 2(5) 2(4) | 2(3) 2(2) 2(1) 2(0)
2048  1024  512  256 |  128  64   32   16   |  8     4       2    1
0       0       1     


and so on:

232-128= 104

2(11) 2(10) 2(9) 2(8 ) | 2(7) 2(6) 2(5) 2(4) | 2(3) 2(2) 2(1) 2(0)
2048  1024  512  256 |  128  64   32   16   |  8     4       2    1
0         0      1      0       1

104-64=40


40-32=8

2(11) 2(10) 2(9) 2(8 ) | 2(7) 2(6) 2(5) 2(4) | 2(3) 2(2) 2(1) 2(0)
2048  1024  512  256  |  128  64   32   16   |  8     4       2    1
0         0      1      0  |    1     1     1    0   |    1     0       0    0

so 744 in decimal is 001011101000 in binary, or 2E8 in hex.

Hope this helps.














"...the streetcar, the carriage of the people, was opposed; but that which is for the greatest good of the greatest number will always conquer in the end..." -Rapid Transit in Cities, Thomas Curtis Clarke, 1892

RippleJet

#1
Screamingman12, you made a mistake in the dec->hex conversion, due to the fact that you've entered 28 to be 156 instead of 256.

The fastest way to convert between HEX/DEC/OCT/BIN is to use the Windows Calculator (in advanced mode).

You can quickly switch between those four bases by pressing F5...F8:

     F5 = Hexadecimal
     F6 = Decimal
     F7 = Octal
     F8 = Binary

If you start the Calculator, press F6, enter 744 (decimal), and then press F5 and F8, you will see that 74410 = 2E816 = 0010 1110 10002

screamingman12

RippleJet, I fixed the tutorial, it should be okay.

and yes, I will admit that the quickest way to do it is the windows calculator, but this is still pretty easy.


"...the streetcar, the carriage of the people, was opposed; but that which is for the greatest good of the greatest number will always conquer in the end..." -Rapid Transit in Cities, Thomas Curtis Clarke, 1892