想实现p1.0口的led从0-9变完后向 p1.1口加一显示,p1.1口也1-9显示, p0口接了字型。问题是是单步运行时p1.0显示一次不能再显示了,全速时两个led 显示一样的且很暗。 org 000h MOV 50H,#9 MOV 30H,#9 mov p1,#0 MOV A,#0 MOV DPTR,#TAB MOVC A,@A+DPTR MOV 33H,A MOV 44H,A MOV A,#1 MOV P1,#0 MOV R5,#9 STAR: NOP ACALL WEI ACALL ASS ACALL LED ajmp STAR ;----------------------------------- WEI: MOVC A,@A+DPTR ACALL LEDSHUA1 ;------------------------------1段限制9 djnz 30h,aa mov dptr,#TAB mov 30h,#9 INC R5 aa: RET
;-----------------------------2段SHUA2 ASS: CJNE R5,#0,A22 MOV R5,#9 INC 33H MOV 80H,33H ACALL LEDSHUA2 ;------------------------------2段限制9 A22: DJNZ 50H,AAA MOV 50H,#9 MOV 33H,44H AAA: RET
;------------------------LED刷新 LEDSHUA1: MOV R0,A RET LEDSHUA2: MOV A,80H MOV P0,A RET ;------------------------LED位扫描 LED: mov p0,R0 setb p1.0 acall yan clr p1.0 mov p0,80H setb p1.1 acall yan clr p1.1 RET ;-------------------------延时 yan: mov r1,#100 loo3: nop mov r3,#50 zz: djnz r3,zz mov r2,#100 loo1: djnz r2,loo1 djnz r1,loo3 ret TAB: Db 0c0H,0f9H,0a4H,0b0H,099H Db 092H,082H,0f8H,080H,090H END
|