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.

Need to convert hex to decimal (8051)

Status
Not open for further replies.

Rafael

Member level 2
Joined
Aug 13, 2001
Messages
44
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,288
Location
Brazil
Activity points
275
hex to decimal 8051

anyone got a quick routine to converte hex to decimal (8 bits only) for 8051?

Thanks
RAF
 

hex to dec 8051

Hi,

**broken link removed**

Bye
 

hextodec 8051

thanks for the link but that code is for 24 bits, and I didn't understand the logic :(

anyone knows a simple 8 bit convertion??
 

dec to hex 8051

In C I often use something like this:

byte byte2bcd(byte databyte)
{
byte temp=0;

while(databyte > 9)
{
databyte-=10;
temp+=0x10;
}

return(temp | databyte);
}

best regards
 

8051 hex to decimal converter

; convert packed-BCD to decimal
; R7: packed-BCD
; R6: decimal output
BCD2DEC:
mov A, R7
anl A, #0F0h
swap A
mov B, #10
mul AB
mov R6, A
mov A, R7
anl A, #0Fh
add R6, A
ret
 

hexadecimal to decimal 8051

thanks for your help people ;)

I did a simple one... pm me if someone needs it 8)
 

Re: 8051 hex to decimal converter

8051 hex to decimal converter

; convert packed-BCD to decimal
; R7: packed-BCD
; R6: decimal output
BCD2DEC:
mov A, R7
anl A, #0F0h
swap A
mov B, #10
mul AB
mov R6, A
mov A, R7
anl A, #0Fh
add R6, A
ret
This small routine helped me a lot!!!!
Thanks....
 

This is a very old thread, no need for further replies, thread closed.

Alex
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top