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

changing hex value to decimal

hi,

how to change the value of hex to decimal

For example from hex "0x15" to decimal 15 or in hex like 0x0f.

do we have any option in keil or any other way.

Thankyou

arun.

Parents
  • In other words, you are using BCD or Binary-Coded Decimal - or, strictly, packed BCD.

    In packed BCD, each nibble of the binary data holds one digit of the decimal value.

    So, all you need to do is to extract the individual nibble values, and display them as the digit values.

    You can extract the individual nibble values by using the standard 'C' shift & mask bitwise operators.

    This really is a very common task indeed - you should easily be able to find plenty of examples...

Reply
  • In other words, you are using BCD or Binary-Coded Decimal - or, strictly, packed BCD.

    In packed BCD, each nibble of the binary data holds one digit of the decimal value.

    So, all you need to do is to extract the individual nibble values, and display them as the digit values.

    You can extract the individual nibble values by using the standard 'C' shift & mask bitwise operators.

    This really is a very common task indeed - you should easily be able to find plenty of examples...

Children
No data