Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/31/00 20:07
Read: times


 
#6096 - RE: HEX to ASCII (decimal) conversion
You must take into account the ASCII codes, converting them to integers in an appropriate manner.

pseudo code:

If character >= 'A' and character <= 'F' then
value = character - 55
else
value = character - 48
end if

"45"h > 69

('4'-48) x 16 = 64
64 + ('5'-48) = 69

Example:

"FF"h > 255

('F'-55) x 16 = 240
240 + ('F'-55) = 255

This should convert ASCII codes to integer provided the codes are valide hex values and they are capitalized. Other code should possible be written to verify this. Then perform a loop to multiply and add. This will give you decimal. You then need to convert to bcd, then to ASCII. I suspect that depending on your application, a much easier way to do this is probably possible. Is the integer value available for your use?

Cory Spackman

List of 8 messages in thread
TopicAuthorDate
HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      
RE: HEX to ASCII (decimal) conversion            01/01/70 00:00      

Back to Subject List