Page 1 of 1

Convert Hex to dec

Posted: Thu Feb 07, 2013 8:04 pm
by Flouch
Hi,
i work on flowcode V5 and i don't know how to convert a value from hexadecimal to decimal. I saw this function NumberToHex$() but no the reverse.
Thanks
Flouch

Re: Convert Hex to dec

Posted: Thu Feb 07, 2013 9:44 pm
by JonnyW
Good evening.

When a number is a string you can represent it as hex or decimal for display purposes. When a number is stored as an integer it has no base - hex or decimal, it is the same thing.

What is it you need to do the conversion for?

Jonny

Re: Convert Hex to dec

Posted: Thu Feb 07, 2013 10:15 pm
by medelec35
I did an article that includes a flowchart which will convert hex to decimal and decimal back to hex.
Can be found here:
http://www.matrixmultimedia.com/article.php?a=416

Martin

Re: Convert Hex to dec

Posted: Thu Feb 07, 2013 11:25 pm
by Flouch
JonnyW wrote:Good evening.

When a number is a string you can represent it as hex or decimal for display purposes. When a number is stored as an integer it has no base - hex or decimal, it is the same thing.

What is it you need to do the conversion for?

Jonny
Hi thanks for answer i need to do this programs (a part of my main programs)

Read the RSSI status register
2) Convert the reading from a hexadecimal
number to a decimal number (RSSI_dec)
3) If RSSI_dec ≥ 128 then RSSI_dBm =
(RSSI_dec - 256)/2 – RSSI_offset
4) Else if RSSI_dec < 128 then RSSI_dBm =
(RSSI_dec)/2 – RSSI_offset

( http://www.ti.com/lit/ds/symlink/cc2500.pdf page 35)

Re: Convert Hex to dec

Posted: Thu Feb 07, 2013 11:51 pm
by JonnyW
Hello.I see - I think the data sheet is a little unclear here.

The value is already a decimal - Twos-compliment is the format that most processors store their integers in now.

If I were you I would just skip this step and see if this works for your results, as I am unsure as to why a data sheet would add something that confusing.

Cheers,

Jonny

Re: Convert Hex to dec

Posted: Fri Feb 08, 2013 10:38 am
by Flouch
JonnyW wrote:Hello.I see - I think the data sheet is a little unclear here.

The value is already a decimal - Twos-compliment is the format that most processors store their integers in now.

If I were you I would just skip this step and see if this works for your results, as I am unsure as to why a data sheet would add something that confusing.

Cheers,

Jonny
ok i will see with out the conversion thanks
I got a question i don't have on my laptop any RS232 because i want to send the data on RS232 and read on the Hyperterminal. But with windows7 and no RS232, how send data on laptop and read them?
Thanks again

E/ i work with E-blocks USB PICmicro multiprogrammer board
Eé/ NVM i just buy a LCD screen
thanks again, i will just send the data in the LCD screen should work