请问我的程序有问题吗?怎么就是不进入中断呢?
IRQ EQU 01H
TM0 EQU 02H
TM1 EQU 03H
TL0 EQU 04H
TH0 EQU 05H
PROGRAMME:
ORG 0000H
JMP RESET
RTNI
JMP TIMER0_INT ;T1 INT THEN GO TO T1_INT
RTNI
RTNI
RESET:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
CLEARRAM: ;CLEAR RAM 020H-3AFH,
LDI DPH ,07H
LDI DPM ,02H
LDI DPL ,0FH
LDI WDT ,1100B ;CLR WDT WDT=64ms
?CLinx:
LDI INX ,00H
CALL DataPointDec
LDA DPH ,BANK0
OR DPM ,BANK0
BNZ ?CLinx
;--------------------------------------------------------
LDI WDT ,1100B ;CLR WDT WDT=64ms
;--------------------------------------------------------
LDI PAOUT ,1111B ;set PA output
LDI PORTA ,1111B
LDI PFOUT ,1111B ;set PF output
LDI PORTF ,1111B
LDI TMP01 ,1111B
STA PIOUT ,BANK7 ;set PI output
LDI TMP01 ,1111B
STA PORTI ,BANK7
;-----------------------------
LDI TM1 ,1111B
LDI TM0 ,0111B ;T1RM=1111B--; 1/1 ;T1RM=1110B--;1/2 ;CLOCK/4
LDI TL0 ,06H ;T1RL=06H
LDI TH0 ,00H ;T1RH=00H----; /250 ;T1RH=08H----;/125
LDI IRQ ,0000B
LDI IE ,1000B ; T1 INTERRUPT ENABLE
LDI PA_BUF ,0FH
LDI PF_BUF ,0FH
LDI PI_BUF ,0FH
;========================================================
; main programme
;========================================================
MAIN:
LDI WDT ,1100B ;CLR WDT WDT=64ms
JMP TIME_CLOCK
RE_TIME_CLOCK:
JMP KEY_SCAN
RE_KEY_SCAN:
JMP KEY_PROCESS
RE_KEY_PROCESS:
JMP DISPLAY
RE_LED_DISP:
NOP
NOP
NOP
NOP
JMP MAIN
;========================================================
;数据指针减一子程序
;========================================================
DataPointDec:
SBIM DPL ,01H
EOR DPL ,BANK0
SBCM DPM ,BANK0
EOR DPM ,BANK0
SBCM DPH ,BANK0
RTNI
;=================================================
;timer0中断服务子程序
;=================================================TIMER0_INT:
STA ACC_BUF ,BANK0 ;备份ACC的值
LDI IRQ ,00H ;清TIMER0中断请求标志
;-----------------------------
COUNT_1MS:
ADIM CT0_1MS ,01H
SBI CT0_1MS ,04H
BNZ COUNT_5MS
LDI CT0_1MS ,00H
ORIM TIME_FLAG ,0001B ;设置“1ms到”标志
COUNT_5MS:
ADIM CT0_5MS ,01H ;5ms计数
LDI TMP_T0 ,00H
ADCM CT1_5MS ,BANK0 ;5ms计数
SBI CT0_5MS ,04H
BNZ TIMER1_INT_END
SBI CT1_5MS ,01H
BNZ TIMER1_INT_END
ORIM TIME_FLAG ,0010B ;设置“5ms到”标志
ORIM CLOCK_FLAG ,0001B ;设置时钟计时的5ms标志位
LDI CT0_5MS ,00H ;重置5ms计数器
LDI CT1_5MS ,00H ;重置5ms计数器
;-----------------------------
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计数器
;-----------------------------
TIMER1_INT_END:
LDI IE ,1000B ;打开timer0中断
LDA ACC_BUF ,BANK0 ;返回ACC的值
RTNI |
|