SN8P1700
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 144
Revision 1.93
Example: How does users check the interrupt request in multi-interrupt situation?
ORG
8
; Interrupt vector
B0XCH
A,
ACCBUF
; B0XCH doesn
'
t change C, Z flag
PUSH
;
Push
INTP00CHK:
; Check INT0 interrupt request
B0BTS1
FP00IEN
; Check P00IEN
JMP
INTP01CHK
; Jump check to next interrupt
B0BTS0
FP00IRQ
; Check P00IRQ
JMP
INTP00
; Jump to INT0 interrupt service routine
INTP01CHK:
; Check INT1 interrupt request
B0BTS1
FP01IEN
; Check P01IEN
JMP
INTP02CHK
; Jump check to next interrupt
B0BTS0
FP01IRQ
; Check P01IRQ
JMP
INTP01
; Jump to INT1 interrupt service routine
INTP02CHK:
; Check INT2 interrupt request
B0BTS1
FP02IEN
; Check P02IEN
JMP
INTT0CHK
; Jump check to next interrupt
B0BTS0
FP02IRQ
; Check P02IRQ
JMP
INTP02
; Jump to INT2 interrupt service routine
INTT0CHK:
; Check T0 interrupt request
B0BTS1
FT0IEN
; Check T0IEN
JMP
INTTC0CHK
; Jump check to next interrupt
B0BTS0
FT0IRQ
; Check T0IRQ
JMP
INTT0
; Jump to T0 interrupt service routine
INTTC0CHK:
; Check TC0 interrupt request
B0BTS1
FTC0IEN
; Check TC0IEN
JMP
INTTC1CHK
; Jump check to next interrupt
B0BTS0
FTC0IRQ
; Check TC0IRQ
JMP
INTTC0
; Jump to TC0 interrupt service routine
INTTC1HK:
; Check TC1 interrupt request
B0BTS1
FTC1IEN
; Check TC1IEN
JMP
INTSIOCHK
; Jump check to next interrupt
B0BTS0
FTC1IRQ
; Check TC1IRQ
JMP
INTTC1
; Jump to TC1 interrupt service routine
INTSIOCHK:
; Check SIO interrupt request
B0BTS1
FSIOIEN
; Check SIOIEN
JMP
INT_EXIT
; Jump to exit of IRQ
B0BTS0
FSIOIRQ
; Check SIOIRQ
JMP
INTSIO
; Jump to SIO interrupt service routine
INT_EXIT:
POP
;
Pop
B0XCH
A, ACCBUF
; Restore ACC value.
RETI
; Exit interrupt vector