请问我下面这么用中断对吗?
ORG 0000H
JMP RESET
RTNI
JMP TIMER0_INT ;T1 INT THEN GO TO T1_INT
RTNI
JMP TIMER1_INT
RTNI
RTNI
;-----------------------------
TIMER1_INT:
STA ACC_BUF ,BANK0 ;备份ACC的值
ANDIM IRQ ,1011B ;清TIMER0中断请求标志
;-----------------------------
ADIM CT0_200MS ,01H
LDI TMP_T0 ,00H
ADCM CT1_200MS ,BANK0
SBI CT0_200MS ,08H
BNZ TIMER1_INT_END
SBI CT1_200MS ,02H
BNZ TIMER1_INT_END
ORIM TIME_FLAG ,0100B ;设置“0.2s到”标志
LDI CT0_200MS ,00H ;重置0.2S计数器
LDI CT1_200MS ,00H ;重置0.2S计数器
;-----------------------------
ADIM SECOND_L ,01H ;时钟的秒钟低位加一计数
DAA SECOND_L
;STA DISP_R4 ,00H ;秒钟的低位十进制调整
EOR SECOND_L ,BANK0 ;清零累加器A
ADCM SECOND_H ,BANK0 ;秒钟的高位带进位加一
;STA DISP_R3 ,00H
SBI SECOND_H ,06H
BNZ TIMER1_INT_END ;
LDI SECOND_L ,00H ;60秒到则重置秒钟低位
;STA DISP_R4 ,00H
LDI SECOND_H ,00H
;STA DISP_R3 ,00H ;60秒到则重置秒钟高位
TIMER1_INT_END:
ORIM IE ,0100B ;打开timer1中断
LDA ACC_BUF ,BANK0 ;返回ACC的值
RTNI
;========================================================
TIMER0_INT:
STA ACC_BUF ,BANK0 ;备份ACC的值
ANDIM IRQ ,0111B ;清TIMER0中断请求标志
;
ADIM CT0_200MS ,01H
LDI TMP_T0 ,00H
ADCM CT1_5MS ,BANK0
SBI CT0_5MS ,08H
BNZ TIMER1_INT_END
SBI CT1_5MS ,02H
BNZ TIMER1_INT_END
ORIM TIME_FLAG ,0100B ;设置“0.2s到”标志
LDI CT0_5MS ,00H ;重置0.2S计数器
LDI CT1_5MS ,00H ;重置0.2S计数器
;-------------------------
;-----------------------------
ADIM MIN_L ,01H ;时钟的分钟低位加一计数
DAA MIN_L ;分钟的低位十进制调整
;STA DISP_R2 ,00H
EOR MIN_L ,BANK0 ;清零累加器A
ADCM MIN_H ,BANK0
;STA DISP_R1 ,00H ;分钟的高位带进位加一
SBI MIN_H ,06H
BNZ TIMER0_INT_END
LDI MIN_L ,00H ;60分钟到则重置分钟低位
;STA DISP_R2 ,00H
LDI MIN_H ,00H ;60分钟到则重置分钟高位
;STA DISP_R1 ,00H
TIMER0_INT_END:
ORIM IE ,0100B ;打开timer1中断
LDA ACC_BUF ,BANK0 ;返回ACC的值
RTNI
;========================================================
;时钟运算子程序 |
|