convert hex to decimal for 8051

Status
Not open for further replies.

magestech

Newbie level 1
Joined
Mar 27, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,285
Hii..
I have a problem to convert hex to decimal (8 bits only) for 8051.
Anyone help me??

Thx
 

Hello!

Preliminary:

uint16 a1 = 0x1234; // a1 is an unsigned int value, not hexa
uint16 a2 = 4660; // a2 is an unsigned int value, not decimal either. And a1 = a2
uint16 a3 = 0x4660; // a3 is the bcd (binary coded decimal) value of a1 or a2
char * str1 = "0x1234"; // str1 is a string, that can represent a1 or a2 in hexadecimal
char * str2 = "4660"; // str2 is a string, that can represent a1 or a2 in decimal

There is no decimal nor hexa in an MCU, only binary. Decimal and hex a are
only representations for humans.
That said, what do you want to convert? Something like str1 to str2?
a1 or a2 to str2?

Dora.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…