Finding hex values

I have been searching all over the globe looking for some formula or a conversion utility that can take a decimal number and convert it to a hex text number like in the below examples:

Steps Wordtable   $03DC, $0C15, $13CF, $7B85, $839E, $8BB0,

Lets say my number is .75 how can I convert that to hex number?

Thanks.

Hi Mike!

Maybe this isn’t what you’re looking for but I use windows calculator to convert from decimal to hex. But I’m not sure of any way to convert non integer decimal values to hex. If you’re going to be using values less than one you will need to look into floating point variables. Bear in mind though that they use 32 bits compared to a byte size variable that uses 8 bits. So you will want to create only as many float variables as necessary.

Thanks Jim,

Part of my problem was using the $ symbol with is a hex indicator and not part of the number. I think I understand how to do this now.

lol, np if you need any more help just post. I will do my best to help you.

Ok, I have another question regarding the hex values.

When defining a constant, why not just use the decimal value instead of a hex number? Whats the benefit of using a hex value vs. a dec value?

Instead of $607 just use 1543

Hi Mike,

Although all internal calculations are handled in binary users can use decimal , hexadecimal or binary to work with or display tha values. Whichever is more convenient for the programmer. There are benefits to displaying a number in a certain format. For example it might be better to display the number in binary if the number is to be used to enable or disable a device on a certain I/O pin. FYI, I found from playing with the Atom Pro Saturday that you can store a characters ascii value just by doing this…

aa var byte aa = "A" ; now aa holds a dec 65.