我这有个数码管动态扫描的程序,可以借鉴
ORG 00H
MOV 20H,#3FH
MOV 21H,#06H
MOV 22H,#5BH
MOV 23H,#4FH
MOV 24H,#66H
MOV 25H,#6DH
MOV 26H,#7DH
MOV 27H,#07H
START:CALL SCAN
JMP START
SCAN: MOV A,#0 ;扫描子程序
MOV R0,#20H
MOV R2,#8
LOOP:
MOV P2,A
MOV P0,@R0
INC R0
CALL DELAY
ADD A,#01H
DJNZ R2,LOOP
MOV R2,#8
CLR A
RET
DELAY:MOV R3,#1 ;扫描延时
D1:MOV R4,#2
D2:MOV R5,#248
DJNZ R5,$
DJNZ R4,D2
DJNZ R3,D1
RET
END
温馨提示:答案为网友推荐,仅供参考