This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

i want convert hex to decimal

i am receiving number from ADC naturally its in the form of hex,but i need display it as decimal
so its need conversion or any other method
pls help me

Parents Reply Children
  • No. Your calculations is most definitely not in hex. Hexadecimal is a numeric base and happens when you want to represent a number. Before you represent it, the number has no numeric base.

    It's irrelevant that the processor internally represent numbers in binary - to your code, they are just numbers. If a datasheet says 0x00 - 0xff or if it says 0 - 255 doesn't matter. That is just a representation of the number - 0xff or 255 or 0377 or 0b11111111 is still the same value. This is similar to how one liter of water is the same amount of water even if you call it 10dl or 100cl or 0.001m3 or 35.1951oz or 0.22gal.

    So stop being so totally locked up on what numeric base a value is presented in.