SN8P2714X_2715
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 88
V1.4
Â
Example: How does users check the interrupt request in multi-interrupt situation?
ORG
8
; Interrupt vector
NOP
B0XCH
A, ACCBUF
; B0XCH doesn’t change C, Z flag
B0MOV
A,
PFLAG
B0MOV
PFLAGBUF, A
; Save PFLAG register in a buffer
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
INTTC0CHK
; Jump check to next interrupt
B0BTS0
FP01IRQ
; Check P01IRQ
JMP
INTP01
; Jump to INT1 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
INT_EXIT
; Jump check to next interrupt
B0BTS0
FTC1IRQ
; Check TC1IRQ
JMP
INTTC1
; Jump to TC1 interrupt service routine
INT_EXIT:
B0MOV
A,
PFLAGBUF
B0MOV
PFLAG, A
; Restore PFLAG register from buffer
B0XCH
A, ACCBUF
; Restore ACC value.
RETI
; Exit interrupt vector