Convert Hex to dec

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Flouch
Posts: 29
Joined: Thu Oct 18, 2012 10:19 am
Has thanked: 6 times
Been thanked: 1 time
Contact:

Convert Hex to dec

Post 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

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Convert Hex to dec

Post 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

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Convert Hex to dec

Post 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
Martin

Flouch
Posts: 29
Joined: Thu Oct 18, 2012 10:19 am
Has thanked: 6 times
Been thanked: 1 time
Contact:

Re: Convert Hex to dec

Post 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)

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Convert Hex to dec

Post 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

Flouch
Posts: 29
Joined: Thu Oct 18, 2012 10:19 am
Has thanked: 6 times
Been thanked: 1 time
Contact:

Re: Convert Hex to dec

Post 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

Post Reply