how to perform hex to decimal conversion?

Status
Not open for further replies.

pranitamm

Newbie level 3
Joined
Oct 24, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
hex to decimal?

in my project i require bcd at port 0 and 3 of microcontroller 89s52 since there are three 7447 connected
(i.e p0.0-p0.3 to 7447(1) lsb,
p0.4-p0.7 to7447(1),
p3.0-p3.3 to7447(3)msb)
which drive three 7 segment displays
now suppose i want to display (240)d then in the accumulator there is its hex equivalent i.e (F0)h which is proper but now when i convert it to bcd using the instruction DA A i get 50 in the accumulator with a carry.now this is the problem instead of having 240 at the o/p there comes 150
please can anybody help me to splve this problem??????
please its very urgent!!!!!!
 

Re: hex to decimal?

use this assembly code:

bcd_display:
mov a,data ;convert to decimal
mov b,#10
div ab
mov r0,b
mov b,#10
div ab
mov r1,b
mov r2,a
ret
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…