SN8P2604
8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 84
Version 1.1
8.3.7 TC1 TIMER NOTICE
When TC1C value changes from “0xFF” to not “0xFF”, TC1IRQ is set “1” whether TC1 is operating or not. If TC1IRQ =
0 and TC1C is changed by program, TC1IRQ might be set as TC1C is from “0xFF” to not “0xFF”. The condition makes
unexpected TC1 interrupt occurring.
Example: TC1C = 0xFF and TC1IRQ = 0. TC1IRQ will set as “1” when TC1C is cleared by program (TC1C =
0).
MOV
A, #0
; Clear TC1C.
B0MOV
TC1C, A
; TC1IRQ changed from “0” to “1”.
B0BSET
FTC1IEN
; Enable TC1 interrupt function and system jumps to interrupt
; vector (ORG 8) at next cycle.
If TC1C changing in system operating duration is necessary, to disable TC1 interrupt function (TC1IEN = 0) before
changing TC1C value. The solution can avoid unexpected TC1 interrupt occurring and example is as following.
Example: TC1C = 0xFF and TC1IRQ = 0. Clearing TC1C must be after TC1 interrupt disable.
B0BCLR
FTC1IEN
; Disable TC1 interrupt function.
MOV
A, #0
; Clear TC1C.
B0MOV
TC1C, A
; TC1IRQ changed from “0” to “1”.
B0BCLR
FTC1IRQ
; Clear TC1IRQ flag.
B0BSET
FTC1IEN
; Enable TC1 interrupt function.
…
…
Note: Disable TC1 interrupt function first, and load new TC1C value into TC1C buffer. This way can avoid
unexpected TC1 interrupt occurring.