mov a,40h
delay:
mov r6,a
d32: mov r3,#10; 1秒
d33: mov r4,#200;
d34: mov r5,#248;
djnz r5,$;
djnz r4,d34;
djnz r3,d33;
djnz r6,d32;
ret
40h中的内容是BCD码,例如是37H,那如何做到37S的延时呢?
请大家帮帮忙,谢谢
更多 0
------解决思路----------------------
mov a,37h
mov r6, a
swap a
anl a, #0fh
xch a, r6
da: djnz r6, da1
sjmp delay
da1: subb a, #6
sjmp da
delay:
mov r6,a
d32: mov r3,#10; 1秒
d33: mov r4,#200;
d34: mov r5,#248;
djnz r5,$;
djnz r4,d34;
djnz r3,d33;
djnz r6,d32;
ret