I want to convert decimal number to hexadecimal in Embedded C.
Actually in my project input to controller is decimal which will be subtracted from hexadecimal value, so I need a conversion.
I tried to write it but after converting a number (75
for example) to its hexadecimal equivalent it will be (411
). The trouble is that I did not know how to convert a number like 11
to b
in hexadecimal as you know that there is no 11
in hexadecimal, it is b
; so please help.
I want to save the converted value in a flag (for subtracting), not for printing. I can print a hex value by simple put a condition like:
(if (a > 10) printf("b"))
but this is not a solution for Embedded.
So please give me a complete solution.