Single-chip microcomputer is not difficult programming problems! URGENT!!!!!!
Converts the 8-bit binary number in the R0 to 3-bit BCD, resulting in a 1002h~1000h (from high to low) unit of external RAM.
For example: At the beginning, the data in the R0 is: 81H (129) 10; After the program executes, the external RAM:
Address content
1002H 01H
1001H 02H
1000H 09H
Reward Points: 15-resolution Time: 2009-10-15 19:10
Questioner: Stefine_-First Class
;-----------------------------------------------------
Best Answer:
Oh, the program upstairs, the use of Dec DPTR, to know, 51 SCM instruction system inside, is no dec DPTR instructions.
According to the following ideas, you can also be more concise.
mov DPTR, #1000H , single-digit address
mov a, R0
mov b, #10
div AB
xch a, B
movx @DPTR, A
INC DPTR
mov a, #10
xch A, b
div AB
xch a, b
movx @DPTR, A
inc DPTR
xch a, B
movx @DPTR, A
RET
Only 24 bytes are used.
;-------------------------------------------------------
Respondents: doing and talking about the Tao-level eight 2009-10-15 19:02
The questioner evaluates the answer: Thank you.
Original URL: http://zhidao.baidu.com/question/121520777.html
;-------------------------------------------------------