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
  • how to change the value of hex to decimal
    For example from hex "0x15" to decimal 15 or in hex like 0x0f.

    Like this?

    unsigned char bcd2int(unsigned char bcd)
    {
        return 10 * (bcd >> 4) + (bcd & 0xF);
    }
    

    I think some processors even have instructions that do just that.

Reply
  • how to change the value of hex to decimal
    For example from hex "0x15" to decimal 15 or in hex like 0x0f.

    Like this?

    unsigned char bcd2int(unsigned char bcd)
    {
        return 10 * (bcd >> 4) + (bcd & 0xF);
    }
    

    I think some processors even have instructions that do just that.

Children