hexadecimal numbers

Discussion in 'UK Motorcycles' started by Oldbloke, Sep 26, 2004.

  1. Oldbloke

    Oldbloke Guest

    Help.

    Does anyone understand how to convert normal numbers into hexadecimal ones,
    and can explain the process in words of no more than 2 syllables.

    TIA

    --
    Dan L (Oldbloke)
    My bike 1996 Kawasaki ZR1100 Zephyr
    M'boy's current bike 1990 Suzuki TS50X (Heavily fortified)
    M'boys NEW bike 2003 Honda NSR125R
    BOTAFOT #140, DIAABTCOD #26, BOMB#18 (slow)
     
    Oldbloke, Sep 26, 2004
    #1
    1. Advertisements

  2. In Oldbloke triped:
    Yes and No in that order!

    The basic principle on converting a number to hexadecimal (more than two
    syllables therefore explanation failed!) is to repeatedly divide it by 16
    until the answer is less than 16, with the remainder at each stage forming
    the appropriate figure for each power of 16.

    For example 255 / 16 = 15 remainder 15, therefore the hexadecimal
    equivalent is FF, or put another way 15 * 16 + 15.

    Similarly, 240 / 16 is 15 remainder 0, so the hex value of F0, and so on.

    The really easy way to do this sort of conversions is to use a calculator
    with built-in hex->dec-> bin conversions!

    What number(s) do you want converting to hex?

    Cheers
     
    Andy Ashworth, Sep 26, 2004
    #2
    1. Advertisements

  3. Oldbloke

    dwb Guest

    Windows Calculator can do it. Click on the 'advanced' option. :)

    Surely a Google would reveal something? With a bit of thought I can try to
    remember (did Hex and Binary in school) but it would take a bit of thought.
     
    dwb, Sep 26, 2004
    #3
  4. Oldbloke

    AndrewR Guest

    When you were at school doing long multiplication the teacher probably drew
    column headings on the board like this:

    100's 10's 1's

    So, for example, 321 was 3 hundreds plus 2 tens plus 1 one.

    In hex the headings would be:

    256's 16's 1's

    So 321 is 1 256s remainder 65 and 65 is 4 times 16, remainder 1

    So, in hex, 321 is

    141

    Sometimes you need to use a number great than 9, for example 10 is 0 16's
    plus 10 1's, so in hex we count 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F making 10=A,
    11=B, 12=C and so on.

    Does any of this make sense to you?


    --
    AndrewR, D.Bot (Celeritas)
    Kawasaki ZX-6R J1
    BOTAFOT#2,ITJWTFO#6,UKRMRM#1/13a,MCT#1,DFV#2,SKoGA#0 (and KotL)
    BotToS#5,SBS#25,IbW#34, TEAR#3 (and KotL), DS#5, COSOC#9, KotTFSTR#
    The speccy Geordie twat.
     
    AndrewR, Sep 26, 2004
    #4
  5. Oldbloke

    Eiron Guest


    Start -> Programs -> Accessories -> Calculator

    Enter your number and press HEX.

    HTH,
     
    Eiron, Sep 26, 2004
    #5
  6. Oldbloke

    Oldbloke Guest

    Phew, numbers are:
    256
    280
    300
    600
    8345

    Many thanks (my lad's college stuff)

    --
    Dan L (Oldbloke)
    My bike 1996 Kawasaki ZR1100 Zephyr
    M'boy's current bike 1990 Suzuki TS50X (Heavily fortified)
    M'boys NEW bike 2003 Honda NSR125R
    BOTAFOT #140, DIAABTCOD #26, BOMB#18 (slow)
     
    Oldbloke, Sep 26, 2004
    #6
  7. Oldbloke

    Oldbloke Guest

    We're deliberating, will get right back to you.


    --
    Dan L (Oldbloke)
    My bike 1996 Kawasaki ZR1100 Zephyr
    M'boy's current bike 1990 Suzuki TS50X (Heavily fortified)
    M'boys NEW bike 2003 Honda NSR125R
    BOTAFOT #140, DIAABTCOD #26, BOMB#18 (slow)
     
    Oldbloke, Sep 26, 2004
    #7
  8. Oldbloke

    Oldbloke Guest

    No, seems we're as thick as pigshit here, just don't get it.

    --
    Dan L (Oldbloke)
    My bike 1996 Kawasaki ZR1100 Zephyr
    M'boy's current bike 1990 Suzuki TS50X (Heavily fortified)
    M'boys NEW bike 2003 Honda NSR125R
    BOTAFOT #140, DIAABTCOD #26, BOMB#18 (slow)
     
    Oldbloke, Sep 26, 2004
    #8
  9. Oldbloke

    Ace Guest

    I'd use either a hax calculator or a decent editor, with hex display
    functionality.

    Interesting, though, because I've been happy using hex for 20-odd
    years I've nevere really thought about how to do it long-hand, as it
    were. A quick google, however [1] reveals, amongst others:
    http://www.rwc.uc.edu/koehler/comath/11.html which does, I'm afraid,
    use one or two three-syllable words :)

    [1] Which I decided not to try and pass off as my own work.
     
    Ace, Sep 26, 2004
    #9
  10. Oldbloke

    Ace Guest

    I've never come across that notation. Normally you'd always group them
    into two-digit blocks (because each pair would be a single byte on
    most computers, but you knew that) it would therefore be 04D2, and the
    'x' might be appended thus '04D2'x.
     
    Ace, Sep 26, 2004
    #10
  11. Oldbloke

    Ace Guest

    Oi, I'll have you know that I never touched a computer until 1979.
     
    Ace, Sep 26, 2004
    #11
  12. Oldbloke

    prawn Guest

    Yes. Signed or unsigned? Erm and MSBF or LSBF?
     
    prawn, Sep 26, 2004
    #12
  13. Oldbloke

    Oldbloke Guest

    Sorry m'lud, I'll have to plead the whoosh.

    --
    Dan L (Oldbloke)
    My bike 1996 Kawasaki ZR1100 Zephyr
    M'boy's current bike 1990 Suzuki TS50X (Heavily fortified)
    M'boys NEW bike 2003 Honda NSR125R
    BOTAFOT #140, DIAABTCOD #26, BOMB#18 (slow)
     
    Oldbloke, Sep 26, 2004
    #13
  14. Oldbloke

    prawn Guest

    Ah. I'm off to the pub now. I'll have a look at the thread in the AM.
    I'm pretty sure that your question will have been answered. When you
    start getting down and dirty in to raw integer or floating point data, a
    little knowledge of the data that you are converting would help.

    Anyway, the pub beckons.
     
    prawn, Sep 26, 2004
    #14
  15. Oldbloke

    simonk Guest

    Easy method - Windows calculator, go to Scientific view, type in your
    decimal number and then click the Hex radio button.

    Pen and paper back-to-skool method -

    1. Work out your powers of 16 until you get a number bigger than the
    decimal number you want to convert

    16 ^ 0 = 1
    16 ^ 1 = 16
    16 ^ 2 = 256
    16 ^ 3 = 4096
    16 ^ 4 = 65536
    etc...

    2. Write them out in descending order left to right as column headers

    65536 4096 256 16 1
    ---------------------------------

    3. Find the biggest number in the list that's smaller than the decimal
    number you want to convert. Let's say we want to convert decimal 500. The
    biggest number in the list of column headers that's smaller than this is
    256.

    4. Work out how many 256s go into 500. The answer is 1. Write this under
    the 256 column

    65536 4096 256 16 1
    ---------------------------------
    1

    5. Work out the remainder of 256 into 500 - it's 244. Take 244, and plug
    it in to step 3 - in other words the biggest number that will go into 244 on
    the list is 16, and it goes in 15 times, remainder 4. Write 15 under the 16
    column, and then go back to step 3 again with the remainder, 4.

    65536 4096 256 16 1
    ---------------------------------
    1 15

    6. Now you've just got 4 left as the remainder, 1 is the only column header
    number that's less than 4, and it goes into 4 (duh) 4 times.

    65536 4096 256 16 1
    ---------------------------------
    1 15 4

    7. Now you have the answer, sort-of - (1)(15)(4). Because Hex is base 16,
    and we only have 10 arabic numerals in the normal run of things, we need a
    way of representing digits greater than 9. We use the letters of the
    alphabet instead, so A is (10), B is (11), etc. All you have to do now is
    take the answer you have above, but write it out using hex "digits"

    Decimal Hex (Binary value)
    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

    In other words

    65536 4096 256 16 1
    ---------------------------------
    1 15 4

    1 f 4

    So, 500 decimal is 1f4 hex. Ta-da!!

    Hex to binary and vice versa is a doddle. Each hex digit represents a group
    of exactly 4 binary digits (bits) according to the table above.
    So, 1f4 is 0001 1111 0100
     
    simonk, Sep 26, 2004
    #15
  16. Oldbloke

    AndrewR Guest

    He's just winding you up with techie talk.

    I'm down in his neck of the woods tomorrow night, would you like me to
    deliver a slap on your behalf?


    --
    AndrewR, D.Bot (Celeritas)
    Kawasaki ZX-6R J1
    BOTAFOT#2,ITJWTFO#6,UKRMRM#1/13a,MCT#1,DFV#2,SKoGA#0 (and KotL)
    BotToS#5,SBS#25,IbW#34, TEAR#3 (and KotL), DS#5, COSOC#9, KotTFSTR#
    The speccy Geordie twat.
     
    AndrewR, Sep 26, 2004
    #16
  17. Oldbloke wrote :
    I'll try adding(sic) a little. It is just a different number base. We
    normally count in decimal (ten fingers) 0 to 9 (base 10), but you can
    count in any number base you like.

    Hexadecimal (base 16) is just a more convenient (more compact) way to
    describe the binary numbering system as applied within a digital
    computer, where things can only be on or off. If you arranged 4
    switches in a row, you could count all the way from (in binary/base 2)
    0000 (all off) to 1111 which is all of them turned on. In other words
    there would be 16 different ways in which you could set those switches.

    Hexadecimal is based on 16 numbered 0 to 15(F) - remember zero is a
    number. The four switches would be equivalent to a 4 bit nibble. 8
    switches can be set in 256 different ways, all the way from 00H to FFH,
    this would be an 8 bit byte.

    In the early days of computers an Octal numbering system was in use
    (base 8).

    In the following table D is decimal, H is Hexadecimal, O is Octal
    D = H = O
    0 = 0 = 0
    1 = 1 = 1
    2 = 2 = 2
    3 = 3 = 2
    4 = 4 = 3
    5 = 5 = 5
    6 = 6 = 6
    7 = 7 = 7
    8 = 8 =10
    9 = 9 =11
    10= A =12
    11= B =13
    12= C =14
    13= D =16
    14= E =17
    15= F =20

    With 16 switches/ 16bits we count a little higher....

    So... 000FH is the same as 15D,
    0010H is the same as 16D
    00FFH is the same as 255D
    FFFFH is the same as 65,535D
     
    Harry Bloomfield, Sep 26, 2004
    #17
  18. Oldbloke

    AndrewR Guest

    Actually in "Time" Alexander Waugh makes a good case for the earliest
    counting systems being base-12, counting flanges on the fingers rather than
    fingers themselves.

    He reasons that using the thumb of your left hand you can count the 12
    flanges on the other four fingers and then use the same system on the right
    hand to keep track of how many 12's you've counted.

    He puts this forward as the basis for why 12 is so important in timekeeping
    (12 months in the year, 12 hour clock, 60 minutes in an hour, 60 seconds in
    a minute).


    --
    AndrewR, D.Bot (Celeritas)
    Kawasaki ZX-6R J1
    BOTAFOT#2,ITJWTFO#6,UKRMRM#1/13a,MCT#1,DFV#2,SKoGA#0 (and KotL)
    BotToS#5,SBS#25,IbW#34, TEAR#3 (and KotL), DS#5, COSOC#9, KotTFSTR#
    The speccy Geordie twat.
     
    AndrewR, Sep 26, 2004
    #18
  19. Just imagine you had 8 fingers on each hand. You count in multiples of 16
    rather than 10.

    But numbers only go up to 9 in single figures so you have to add A to F
    on the end to get to 16.
     
    eric the brave, Sep 26, 2004
    #19
  20. Oldbloke

    Nigel Eaton Guest

    Using the patented Mavis Beacon "Hunt&Peck" Technique, AndrewR
    One of the programmers at my place used to have an email .sig that said
    "If God didn't want us to count in octal he wouldn't have given us four
    fingers and a parity thumb."

    Made Oi larf, that did.
    --
    Nigel - Manufacturer of the "Champion-105" range of rearsets

    WS* GHPOTHUF#24 APOSTLE#14 DLC#1 COFF#20 BOTAFOT#150 HYPO#0(KoTL) IbW#41
    ZZR1100, Enfield 500 Curry House Racer "The Basmati Rice Burner",
    Honda GL1000K2 Kawasaki ZN1300 Voyager "Oh, Oh, It's so big"
     
    Nigel Eaton, Sep 26, 2004
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.