INT0SHIFT:.........................................................................................20
MOV A,R1.........................................................................................20
MOV B,#10......................................................................................20
DIV AB..............................................................................................21
MOV R5,A.........................................................................................21
MOV R4,B.........................................................................................21
MOV R3,#0AH..................................................................................21
LCALL DISPLAY ;先在两个时间 LED 上显示 R1......................................21
JNB P3.4,INC0 ;P3.4 为+1s 键,如按下跳到 INCO..................................21
JNB P3.5,DEC0 ;P3.5 为-1s 键,如按下跳到 DECO..................................21
JNB P3.1,BACK0 ;P3.1 为确定键,如按下跳到 BACKO.............................21
LJMP INT0SHIFT................................................................................21
INC0: MOV A,R1................................................................................21
CJNE A,#63H,ADD0 ;如果不是 99,R2 加 1,如果加到 99,R1 就置 0,重新加
起。...................................................................................................21
MOV R1,#00H..................................................................................21
LCALL DELAY1..................................................................................21
LJMP INT0SHIFT................................................................................21
ADD0: INC R1....................................................................................21
LCALL DELAY1..................................................................................21
LJMP INT0SHIFT................................................................................21
DEC0: MOV A,R1...............................................................................21
JZ SETR1 ;如果 R1 为 0, R1 就置 99.....................................................21
DEC R1.............................................................................................21
LCALL DELAY1..................................................................................21
LJMP INT0SHIFT................................................................................21
SETR1: MOV R1,#63H ;R1 置 99........................................................21
LCALL DELAY1..................................................................................21
LJMP INT0SHIFT................................................................................21
BACK0: RETI......................................................................................21
;-----INT1(回答时间 R2 调整程序)-----.....................................................21
INT1SHIFT:.........................................................................................21
MOV A,R2 ;与调节抢答程序一样..........................................................21
MOV B,#0AH....................................................................................21
DIV AB..............................................................................................22
MOV R5,A.........................................................................................22
MOV R4,B.........................................................................................22
MOV R3,#0AH..................................................................................22
LCALL DISPLAY.................................................................................22
JNB P3.4,INC1...................................................................................22
JNB P3.5,DEC1..................................................................................22
JNB P3.1,BACK1................................................................................22
LJMP INT1SHIFT................................................................................22
INC1: MOV A,R2................................................................................22
CJNE A,#63H,ADD1..........................................................................22
MOV R2,#00H..................................................................................22
LCALL DELAY1..................................................................................22
LJMP INT1SHIFT................................................................................22
ADD1: INC R2....................................................................................22
LCALL DELAY1..................................................................................22