SN8P2318 Series
C-type LCD, RFC 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 82
Version 1.5
8.3 TC0 8-BIT TIMER/COUNTER
8.3.1 OVERVIEW
The TC0 timer is an 8-bit binary up timer with basic timer, event counter and PWM functions. The basic timer function
supports flag indicator (TC0IRQ bit) and interrupt operation (interrupt vector). The interval time is programmable
through TC0M, TC0C, TC0R registers. The event counter is changing TC0 clock source from system clock
(Fcpu/Fhosc) to external clock like signal (e.g. continuous pulse, R/C type oscillating signal
…). TC0 becomes a counter
to count external clock number to implement measure application. TC0 also 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
…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.
Event Counter:
The event counter function counts the external clock counts.
Duty/cycle programmable PWM:
The PWM is duty/cycle programmable controlled by TC0R and TC0D
registers.
Green mode function:
All TC0 functions (timer, PWM, event counter, auto-reload) keep running in green mode
and no wake-up function.
TC0 Rate
(Fcpu/1~Fcpu/128)
INT0 (Schmitter Trigger)
TC0CKS1
TC0ENB
CPUM0,1
TC0C
8-Bit Binary Up
Counting Counter
TC0R Reload
Data Buffer
S
R
TC0 Time Out
P5.4 GPIO
P5.4 Pin
PWM
PWM0OUT
Load
Compare
TC0D
Data Buffer
Up Counting
Reload Value
Fcpu
Fhosc
TC0CKS0