SN8P2200 Series
USB 1.1 Low-Speed 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 67
Version 1.7
6.10
T1 INTERRUPT OPERATION
When the T1C counter stops by T1 pulse width measurement finished, the T1IRQ will be set to “1” no matter the T1IEN
is enable or disable. If the T1IEN and the trigger event T1IRQ is set to be “1”. As the result, the system will execute
the interrupt vector. If the T1IEN = 0, the trigger event T1IRQ is still set to be “1”. Moreover, the system won’t execute
interrupt vector even when the T1IEN is set to be “1”. Users need to be cautious with the operation under
multi-interrupt situation.
¾
Example: T1 interrupt request setup.
B0BCLR
FT1IEN
; Disable T1 interrupt service
B0BCLR
FT1ENB
; Disable T1 timer
MOV
A,
#20H
;
B0MOV
T1M, A
; Set T1 clock = Fcpu / 64 and falling edge trigger.
CLR
T1C
B0BSET
FT1IEN
; Enable T1 interrupt service
B0BCLR
FT1IRQ
; Clear T1 interrupt request flag
B0BSET
FT1ENB
; Enable T1 timer
B0BSET
FGIE
; Enable GIE
¾
Example: T1 interrupt service routine.
ORG
8
; Interrupt vector
JMP
INT_SERVICE
INT_SERVICE:
PUSH
; Push routine to save ACC and PFLAG to buffers.
B0BTS1
FT1IRQ
; Check T1IRQ
JMP
EXIT_INT
; T1IRQ = 0, exit interrupt vector
B0BCLR
FT1IRQ
; Reset T1IRQ
B0MOV A,
T1C
B0MOV
T1CBUF, A
; Save pulse width.
CLR T1C
…
; T1 interrupt service routine
…
EXIT_INT:
POP
; Pop routine to load ACC and PFLAG from buffers.
RETI
; Exit interrupt vector