
Originally Posted by
amgen
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?
Bookmarks