Counters And Peripherals; Comparing Capture Channels And Perimeters; Encoder Mode - WCH CH32V003 Series Reference Manual

Table of Contents

Advertisement

CH32V003 Reference Manual
http://wch.cn
ECE position is set, the external clock source mode 2 is used. when using the external clock source mode 2,
ETRF is selected as CK_PSC. the ETR pin becomes ETRP after passing through the optional inverter (ETP),
divider (ETPS), and then ETRF after passing through the filter (ETF).
With the ECE position bit and the SMS set to 111b, this is equivalent to the TS selecting ETRF as an input.

10.2.2.4 Encoder mode

Setting the SMS to 001b, 010b, 011b will enable the encoder mode. Enabling encoder mode allows you to
select a specific level in TI1FP1 and TI2FP2 to signal the output with another jump edge as the signal. This
mode is used when an external encoder is used. Refer to Section 10.3.9 for specific functions.

10.2.3 Counters and peripherals

CK_PSC is input to the prescaler (PSC) for dividing. the PSC is 16-bit and the actual dividing factor is equal
to the value of R16_TIMx_PSC + 1. CK_PSC goes through the PSC and becomes CK_INT. changing the
value of R16_TIM1_PSC does not take effect in real time, but is updated to the PSC after an update event. the
update event includes a UG bit clear and reset. The core of the timer is a 16-bit counter (CNT). CK_CNT is
eventually fed to the CNT, which supports incremental count mode, decremental count mode, and incremental
and decremental count modes, and has an Automatic Reload Register (ATRLR) that reloads the initial value
for the CNT at the end of each count cycle. There is also an auxiliary counter that keeps track of the number
of times the ATRLR reloads the initial value for the CNT and can generate a specific event when the number
of times set in the Repeat Count Register (RPTCR) is reached.

10.2.4 Comparing capture channels and perimeters

The core of the timer is the comparison capture register, which is complemented by digital filtering, frequency
division and inter-channel multiplexing in the peripheral input section, comparator and output control in the
output section.
V1.3
89

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents