SN8P26L38
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 71
Version 1.5
6.9
T1 INTERRUPT OPERATION
When the T1C (T1CH, T1CL) counter occurs overflow, the T1
IRQ will be set to “1” however the T1IEN is enable or
disable. If the T1IEN = 1, the trigger event will make the T1
IRQ to be “1” and the system enter interrupt vector. If the
T1IEN = 0, the trigger event will make the T1
IRQ to be “1” but the system will not enter interrupt vector. Users need to
care for 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