Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

convert hex to decimal for 8051

Status
Not open for further replies.

magestech

Newbie level 1
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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top