SN8P2740 Series
ADC, OP-amp, Comparator 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 80
Version 2.0
8.3 TC0 8-BIT TIMER/COUNTER
8.3.1 OVERVIEW
The TC0 timer is an 8-bit binary up timer with basic timer, PWM function and pulse generator. The basic timer function
supports flag indicator (TC0IRQ bit) and interrupt operation (interrupt vector). The interval time is programmable
through TC0M, TC0C, TC0R registers. TC0 builds in duty/cycle programmable PWM. The PWM cycle and resolution
are controlled by TC0 timer clock rate, TC0R and TC0D registers, so the PWM with good flexibility to implement IR
carry signal, motor control and brightness adjuster…TC0 timer also builds in pulse generator function. The pulse
generator function is one cycle PWM format as start trigger occurrence. The pulse output trigger source has TC0PO
control bit and comparator 0 output edge controlled by register. TC0 counter supports auto-reload function which
always enabled. When TC0 timer overflow occurs, the TC0C will be reloaded from TC0R automatically. The
auto-
reload function is always enabled. The TC0 doesn‟t build in green mode wake-up function. The main purposes of
the TC0 timer are as following.
8-bit programmable up counting timer:
Generate time-out at specific time intervals based on the selected clock
frequency.
Interrupt function:
TC0 timer function supports interrupt function. When TC0 timer occurs overflow, the TC0IRQ
actives and the system points program counter to interrupt vector to do interrupt sequence.
Duty/cycle programmable PWM:
The PWM is duty/cycle programmable controlled by TC0R and TC0D
registers.
Pulse generator:
The pulse generator function is one cycle PWM format as start trigger occurrence. The pulse
output trigger source has TC0PO control bit and comparator 0 output edge controlled by register. When TC0PO =
1, CM0SF = 0, the pulse generator trigger is PWM0OUT bit. When TC0PO = 1, CM0SF = 1, the pulse generator
trigger is comparator 0 output edge.
Green mode function:
All TC0 functions (timer, PWM, pulse generator) keeps running in green mode, but no
wake-
up function. Timer IRQ actives as any IRQ trigger occurrence, e.g. timer overflow…
÷
2
÷
4
÷
8
÷
16
÷
32
÷
64
÷
128
÷
256
TC0 Rate
Comparator 0 output
TC0ENB
CPUM0,1
TC0C
8-Bit Binary Up
Counting Counter
TC0R Reload
Data Buffer
S
R
TC0 Time Out TC0IRQ
P0.1 Output
P0.1 Pin
PWM
PWM0OUT=1, TC0PO=0
Load
Compare
TC0D
Data Buffer
Up Counting
Reload Value
Fcpu
Fhosc
TC0CKS
Compare
TC0 Time Out
PWM0OUT=0, TC0PO=0
TC0PO=1
TC0PO
PWM0OUT
CM0SF
TC0DIR
Pulse Generator