SN8P275X Series
8-bit micro-controller build-in 12-bit ADC
SONiX TECHNOLOGY CO., LTD
Page 103
Version 0.7
)
Set TC1 timer function mode.
B0BSET
FTC1IEN
; Enable TC1 interrupt function.
or
B0BSET
FTC1OUT
; Enable TC1OUT (Buzzer) function.
or
B0BSET
FPWM1OUT
; Enable PWM function.
)
Enable TC1 timer.
B0BSET
FTC1ENB
; Enable TC1 timer.
8.4.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.
Note: TC1C and TC1R can’t be set as 0xFF when TC1 timer operating in interrupt, buzzer output modes.
TC1C and TC1R available range is 0x00~0xFE. The problem doesn’t exist in pure PWM mode.