-
interrupt question
hi,
question: I have 2 codes for the interrupt to the INTERRUPT vector
04h, one on RBIE and the other on TOIE.
If during the execution of the program it occurs the second
interrupt, as ago the MCU to recognize which of the 2 codes it has
to perform?
THX
chip
MCU = 16f84a
ORG 04H
CODE 1..... (ON RBIE)
CODE 2......(ON TOIE)
----------------------------------------------------
MAIN PROGRAMM
-
Just test your interrupt flag bits in the int handler. These tell you which source generated the interrupt condition.
Code:
ORG 0x4
; save state if needed here
ISR
btfss INTCON,T0IF ; if TMR0 interrupt, handle it
goto RB_INT ; else skip to RB_INT
T0_INT
; CODE 2......(ON TOIE)
bcf INTCON,T0IF ; clear TMR0 int flag, and run handler
; insert your timer0 int handler here
RB_INT
; CODE 1..... (ON RBIE)
bcf INTCON,RBIF ; clear RB int flag, and run handler
; insert your RB int handler here
ISR_EXIT
; restore state if needed here
retfie
-
Thx
Tank you Bruce!!!!!
Best regard
chip15