We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I want a code for converting a 32bit hexadecimal number to its decimal ascii equivalent. I mean if number is 0x1234, then its decimal will be 4660 and its ascii equivalent will be 34 36 36 30.
I am not able to do this conversion. Pl advice.
Regards, Unnati.
"There is a hex number"
No, there isn't - at this point, there is just a number. Did you not read Per's post?
"which needs to be sent via serial communication to other device which accepts the number in ascii format"
It is only when it has to be represented in some output format like this that you have to decide what notation to use; eg, Hex.
"Internally in keil, all the numbers are treated in hex and not decimal"
No!
Again, internally they are just numbers - hex and decimal are irrelevant!
"Then how do I do this conversion?"
You can use one of the library functions that has already been pointed out to you.
But you really should understand how to do this by hand - it is school maths!