
CH32V003
Reference Manual
V1.3
115
Figure 11-3 Block diagram of the structure of the comparison capture channel
The signal is input from the channel x pin and optionally made as TIx (the source of TI1 can be more than
CH1, see block diagram 10-1 of the timer), TI1 is passed through the filter (ICF[3:0]) to generate TI1F, and
then divided into TI1F_Rising and TI1F_Falling through the edge detector, these two signals are selected
(CC1P) to generate TI1FP1, TI1FP1 and TI2FP1 from channel 2 are sent together to CC1S to select to become
IC1, which is sent to the comparison capture register after ICPS dividing.
The compare capture register consists of a preload register and a shadow register, and the read/write process
operates only on the preload register. In capture mode, the capture occurs on the shadow register and is then
copied to the preload register; in compare mode, the contents of the preload register are copied to the shadow
register, and then the contents of the shadow register are compared to the core counter (CNT).
11.3 Functionality and implementation
The complex functions of a general-purpose timer are implemented by manipulating the timer's compare
capture channel, clock input circuitry, and counter and peripheral components. The clock input to the timer
can be derived from multiple clock sources including the input to the compare capture channel. The operation
0
1
01
10
11
TI1F
Edge
detector
ICF[3:0]
TIMx_CHCTLR1
TI1F_Rising
TI1F_Falling
To the slave mode controller
TI1F_ED
TI1FP1
CC1P/CC1NP
TIMx_CCER
TI2F_Rising
TI2F_Falling
0
1
(from channel 2)
(from channel 2)
TI2FP1
TRC
(from slave mode
controller)
Divider
/1,/2,/4,/8
IC1
CC1S[1:0] ICPS[1:0]
CC1E
TIMx_CCER
Filter
downcounter
TI1
f
DTS
APB Bus
MCU-peripheral interface
Capture/compare preload register
Capture/compare shadow register
hi
gh
8
(if
16
-b
it)
lo
w
8
Capture
Counter
CC1G
TIM1_SWEVGR
CC1E
IC1PS
CC1S[0]
CC1S[1]
S
R
Read CCR1H
Read CCR1L
read_in_progress
capture_transfer
Input
mode
compare_transfer
Output
mode
S
R
write_in_progress
Write CCR1H
Write CCR1L
CC1S[0]
CC1S[1]
OC1PE
OC1PE
UEV
(from time
base unit)
Comparator
CNT
>
CCR1
CNT = CCR1
ETRF
OC1REF
To the master mode
controller
0
1
Output
enable
circuit
OC1
Output
mode
controller
OC1M[2:0]
TIM1_CCER
CC1E
CC1P
TIM1_CCER
TIMx_CHCTLR1
TIMx_CHCTLR1
TIMx_CHCTLR1