Preliminary
TC1 INTERRUPT OPERATION
SN8P1702A/SN8P1703A
8-bit micro-controller build-in 12-bit ADC
When the TC1C counter occurs overflow, the TC1IRQ will be set to “1” however the TC1IEN is enable or disable. If the
TC1IEN = 1, the trigger event will make the TC1IRQ to be “1” and the system enter interrupt vector. If the TC1IEN = 0,
the trigger event will make the TC1IRQ to be “1” but the system will not enter interrupt vector. Users need to care for
the operation under multi-interrupt situation.
ꢁExample: TC1 interrupt request setup.
B0BCLR
B0BCLR
MOV
FTC1IEN
FT C1ENB
A, #20H
; Disable TC1 interrupt service
; Disable TC1 timer
;
B0MOV
MOV
B0MOV
TC1M, A
A, #74H
TC1C, A
; Set TC1 clock = Fcpu / 64
; Set TC1C initial value = 74H
; Set TC1 interval = 10 ms
B0BSET
B0BCLR
B0BSET
FTC1IEN
FTC1IRQ
FTC1ENB
; Enable TC1 interrupt service
; Clear TC1 interrupt request flag
; Enable TC1 timer
B0BSET
FGIE
; Enable GIE
ꢁExample: TC1 interrupt service routine.
ORG
JMP
8
; Interrupt vector
INT_SERVICE
INT_SERVICE:
B0XCH
B0MOV
B0MOV
A, ACCBUF
A, PFLAG
PFLAGBUF, A
; Store ACC value.
;
B0BTS1
JMP
FTC1IRQ
EXIT_INT
; Check TC1IRQ
; TC1IRQ = 0, exit interrupt vector
B0BCLR
FTC1IRQ
; Reset TC1IRQ
MOV
A, #74H
B0MOV
TC1C, A
; Reset TC1C.
.
.
.
.
; TC1 interrupt service routine
EXIT_INT:
B0MOV
B0MOV
B0XCH
A, PFLAGBUF
PFLAG, A
A, ACCBUF
; Restore ACC value.
; Exit interrupt vector
RETI
SONiX TECHNOLOGY CO., LTD
Page 84
Revision 0.5