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.
We constanly suffer from people that don't want to describe what problem they have.
I think suffering is the wrong word. To me it's fun :-)
For example, see my posts of 15-Jun-2011 12:52 GMT and 13:40 GMT in this thread: http://www.keil.com/forum/19091/
There seems to be a fundamental problem in distinguishing between a requirement (or "goal"), and an attempted solution to that requirement.
www.catb.org/.../smart-questions.html
First sorry if i irritated you all.
I know how to convert hex "0x15" to decimal 21.
I am using a RTC DS1307 with 89s52 and displaying time in LCD.
have to write and read in hex only with the RTC.
I can write and read the values in RTC and also displayed it in LCD.
The problem for me is when i try to edit the time.
I receiving it in hex and if i directly send it to LCD and edit, the value after 09 became some other characters. if i convert it to decimal and send to LCD it works.
But in the first place itself, if i read 0x15 it displays 21 because i converting it to decimal.
That's why i need to change the hex '0x15' to decimal 15 not 21.
I think you may understand my problem. if not again sorry.
i thought keil will have some option for this, like the typecast.
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...