SN8P2200 Series
USB 1.1 Low-Speed 8-Bit Micro-Controller
SONiX TECHNOLOGY CO., LTD
Page 90
Version 1.7
8.5
T1, T2 8-BIT TIMER CAPTURE
8.5.1 OVERVIEW
The T1, T2 are 8-bit binary up timer captures for external pulse width, period measurement. Timer capture’s trigger
edge is controlled by TnG1, 0 and supports four types (falling edge, rising edge, positive pulse with, negative pulse
width). If 2
nd
edge trigger occurrence, the interrupt request flag is set and timer counter stops counting. The counter
value is input signal’s positive/negative pulse width or period.
T1 input signal is from P0.1 and T2 is from P0.2. P0.1 and P0.2 must be set as input mode for timer capture input
function. P0.1 and P0.2 in timer capture input mode has wake-up function from power down mode and green mode.
Note: T2 operation is equal to T1 operation. Use “Tn” to mean “T1” and “T2” in follow sections.
The main purposes of the Tn 8-bit timer capture.
)
Input signal period (frequency inverse)measurement:
When select Tn trigger edge to falling (TnG1,0 = 00) or
rising (TnG1,0 = 01) edge, Tn timer capture can measure input signal’s period. The period is frequency inverse.
)
Input signal plus width measurement:
When select Tn trigger edge as positive pulse width (TnG1,0 = 10) or
negative pulse width (TnG1,0 = 11), Tn timer capture can measure input signal’s positive and negative pulse
width.
Fcpu
Tn Rate
(Fcpu/2~Fcpu/256)
TnENB
CPUM0,1
TnC
8-Bit Binary Up
Counting Counter
00
01
10
11
TnG1,0
External Input Signal
Trigger Edge Selection
TnIRQ = 1
TnIRQ=0, TnC Starts to Count.
TnIRQ=1, TnC Stops Counting.
TnC Counts
Trigger
TnC Stops
Trigger
TnIRQ Cleared by
Firmware