ORG 0000H SJMP MAIN ORG 0003H SJMP INTT0 ORG 0030HMAIN: CLR IT0 SETB EX0 SETB EA MOV 40H,#1 MOV R0,#1 ; MOV R1,#1LOOP: ACALL DISPLAY1 SJMP LOOP
INTT0: CLR EA PUSH PSW PUSH ACC JNB P1.0,S1 JNB P1.1,S2 JNB P1.2,S3 JNB P1.3,S4 JNB P1.4,S5 JNB P1.5,S6 JNB P1.6,S7 JNB P1.7,S8RETUP: POP ACC POP PSW ;CLR IT0 ;SETB EX0 SETB EA RETI
S1: MOV R0,#1 ACALL DISPLAY AJMP RETUP
S2: MOV R0,#2 ACALL DISPLAY AJMP RETUP
S3: MOV R0,#3 ACALL DISPLAY AJMP RETUP
S4: MOV R0,#4 ACALL DISPLAY AJMP RETUP
S5: MOV R0,#5 ACALL DISPLAY AJMP RETUP
S6: MOV R0,#6 ACALL DISPLAY AJMP RETUP
S7: MOV R0,#7 ACALL DISPLAY AJMP RETUP
S8: MOV R0,#8 ACALL DISPLAY AJMP RETUP
DISPLAY: MOV 30H,40H MOV 40H,R0 MOV R0,30H
DISPLAY1: MOV P2,#00H CLR P3.0 CLR P3.1 MOV DPTR,#TABLOOP11: MOV A,R0 MOV 42H,A MOVC A,@A+DPTR MOV P2,A SETB P3.1 CALL DELAY CLR P3.1 MOV A,42H CJNE A,40H,QQ RET
QQ: JNC QQ1 INC R0 SJMP LOOP11
QQ1: DEC R0 SJMP LOOP11
TAB: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
DELAY: MOV R7,#250DEL1: MOV R6,#250DEL2: MOV R5,#4DEL3: DJNZ R5,DEL3 DJNZ R6,DEL2 DJNZ R7,DEL1 RET END
INTT0: CLR EA PUSH PSW PUSH ACC JNB P1.0,S1 JNB P1.1,S2 JNB P1.2,S3 JNB P1.3,S4 JNB P1.4,S5 JNB P1.5,S6 JNB P1.6,S7 JNB P1.7,S8RETUP: POP ACC POP PSW ;CLR IT0 ;SETB EX0 SETB EA RETI
S1: MOV R0,#1 ACALL DISPLAY AJMP RETUP
S2: MOV R0,#2 ACALL DISPLAY AJMP RETUP
S3: MOV R0,#3 ACALL DISPLAY AJMP RETUP
S4: MOV R0,#4 ACALL DISPLAY AJMP RETUP
S5: MOV R0,#5 ACALL DISPLAY AJMP RETUP
S6: MOV R0,#6 ACALL DISPLAY AJMP RETUP
S7: MOV R0,#7 ACALL DISPLAY AJMP RETUP
S8: MOV R0,#8 ACALL DISPLAY AJMP RETUP
DISPLAY: MOV 30H,40H MOV 40H,R0 MOV R0,30H
DISPLAY1: MOV P2,#00H CLR P3.0 CLR P3.1 MOV DPTR,#TABLOOP11: MOV A,R0 MOV 42H,A MOVC A,@A+DPTR MOV P2,A SETB P3.1 CALL DELAY CLR P3.1 MOV A,42H CJNE A,40H,QQ RET
QQ: JNC QQ1 INC R0 SJMP LOOP11
QQ1: DEC R0 SJMP LOOP11
TAB: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
DELAY: MOV R7,#250DEL1: MOV R6,#250DEL2: MOV R5,#4DEL3: DJNZ R5,DEL3 DJNZ R6,DEL2 DJNZ R7,DEL1 RET END