Display 2 WORDs as a 32bit integer


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Display 2 WORDs as a 32bit integer

    Is it possible to describe the method or algorithm to get the decimal from the possible 8 hexadecimal of 32 bit number.... the conversion itself is pretty straight forward but the 8 bit manipulations are confusing...
    .
    .Name:  hex.JPG
Views: 879
Size:  53.3 KB

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,705


    Did you find this post helpful? Yes | No

    Default Re: Display 2 WORDs as a 32bit integer

    Just wanted to thank you once again

    No problem
    Henrik glad you could make it work for you. its good to exercise the grey matter occasionally



    @amgen
    the conversion itself is pretty straight forward but the 8 bit manipulations are confusing...
    to which 8bit manipulations do you refer ?
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    971


    Did you find this post helpful? Yes | No

    Default Re: Display 2 WORDs as a 32bit integer

    Quote Originally Posted by amgen View Post
    Is it possible to describe the method or algorithm to get the decimal from the possible 8 hexadecimal of 32 bit number.... the conversion itself is pretty straight forward but the 8 bit manipulations are confusing...
    .
    .Attachment 9870

    Consider this code.

    Code:
    dim array[8] as byte                        ' your hex bytes ($00-$0F) are input here from MSN to LSNibble
    decimal  as long                             ' 32 bit value
    
         decimal = 0
         for i = 0 to 7
               decimal = decimal * 16             ' nibble max value is 16, so multiply the existing value by 16 to move decimal value one nibble to the left
               decimal = decimal + array[i]     ' add in the new nibble
         next
         
         ' at this point, decimal contains the converted value of the hex digits
    Is this what you're looking for?

Similar Threads

  1. Microchip 32bit floating point to integer conversion
    By timmers in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st February 2011, 17:49
  2. IEEE 754 32bit floating point value.
    By shawn in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 18th December 2010, 13:32
  3. Signed 32bit to ASCII?
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th May 2010, 23:13
  4. Retrieving 32bit Multiply Result
    By Darrel Taylor in forum Code Examples
    Replies: 42
    Last Post: - 28th January 2008, 16:15
  5. Newbee How to get LCD to display 4-6 var words
    By emmett brown in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 15th August 2006, 02:11

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts