ponnus
Full Member level 2
- Joined
- Mar 17, 2011
- Messages
- 142
- Helped
- 8
- Reputation
- 16
- Reaction score
- 8
- Trophy points
- 1,298
- Location
- Cochin, INDIA
- Activity points
- 2,226
Hai,
I want to enter digits into a character array. For example, I want to enter decimal 123 as '1','2','3'.
But it should take only few instruction cycles.
I tried sprintf, but it is taking too much time.
I also tried to convert the decimal number to hex, separate each nibble of the hex ,add 0x30 to convert to ascii. But, decimal to hex conversion used division in that, which takes more time than actually needed.
So, is there any way to print digits to ascii or an easy method for division(such as using shifts) which use only few instruction cycles?
Thank you
I want to enter digits into a character array. For example, I want to enter decimal 123 as '1','2','3'.
But it should take only few instruction cycles.
I tried sprintf, but it is taking too much time.
I also tried to convert the decimal number to hex, separate each nibble of the hex ,add 0x30 to convert to ascii. But, decimal to hex conversion used division in that, which takes more time than actually needed.
So, is there any way to print digits to ascii or an easy method for division(such as using shifts) which use only few instruction cycles?
Thank you