Microcontroller › 8051 › Give me Hex to decimal & decimal to ascii conversion › Hi KunalFirstly, I would like
December 13, 2016 at 11:15 am
#14271
Participant
Hi Kunal
Firstly, I would like to correct you on the DECIMAL to ASCII conversion part, both of them are same stuff; ASCII is represented in decimals only. Now for the HEX to DECIMAL part, multiply each hexadecimal digit with (2^(4*pos)) where "pos" is the position of that particulat digit counting from right side with rightmost position marked zero '0'. For example:
if 0xAB45 is to be converted into decimal then its decimal equivalent would be calculated somewhat like this-
5*(2^(4*0)) + 4*(2^(4*1)) + 11*(2^(4*2)) + 10*(2^(4*3))= 43845
Hope this helps