10S計時匯編語言程序設(shè)計
ORG 0000H
AJMP MAIN
ORG 000BH
AJMP INTT0
ORG 0030H
MAIN:CLR P2.7
CLR P2.6
MOV DPTR,#TAB
CLR A
MOV R2,#0H
MOV R3,#0H
MOV TMOD,#01H
MOV TH0,#4CH
MOV TL0,#00H
SETB EA
SETB ET0
SETB TR0
HERE: CJNE R2,#14H,HERE
MOV R2,#0H
PUSH ACC
MOVC A,@A+DPTR
MOV P0,A
POP ACC
INC A
INC R3
CJNE R3,#0AH,HERE
MOV R3,#00H ;此處用DJNZ 更方便,只不過R3的初始值要設(shè)置為0AH,同時取消INC R3指令(此行上面第二行)
CLR A
AJMP HERE
ORG 80H
INTT0:MOV TH0,#4CH
MOV TL0,#00H
INC R2
RETI
TAB: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
END
評論