![ARTERY AT32F435 Series Скачать руководство пользователя страница 279](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592279.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 279
Rev 2.03
Figure 14-319
Block diagram of general-purpose TMR10/11/13/14
TMRx_CH1
TMRx_DIV
CNT counter
CH1 edge
detector
CH1 filter
C1IRAW
C1IN DIV
C1IFP1(C1IN)
C1DT
C1C
0
IN MODE
C1C=0
OUT MODE
C1DT
Compare
C1ORAW
Output1
control
C1OUT
CK_INT(from CRM)
DIV counter
preload
Overflow event
TMRx_CH1
CNT counter
Capture
14.3.3 TMR9 to TMR14 functional overview
14.3.3.1 Count clock
The count clock of general-purpose timers can be provided by the internal clock (CK_INT), external clock
(external clock mode A) and internal trigger input (ISx).
Figure 14-3 Count clock
0
1
External clock mode A
(SMSEL=3'b111)
TRGIN
STIS[1:0]
IS0
IS3
IS2
IS1
STIS[1:0]
C1INC
C1IFP1
C2IPF2
0
1
STIS[2]
External trigger
Internal trigger
0
1
Encoder mode
(SMSEL=3'b001/010/011)
CI1FP1/CI2FP2
CK_INT(form CRM)
DIV_counter
CK_CNT
CNT_counter
Internal clock (CK_INT)
By default, the CK_INT divided by the prescaler is used to drive the counter to start counting. The
configuration process is as follows:
-
Set the CLKDIV[1:0] bit in the TMRx_CTRL1 register to set the CK_INT frequency;
-
Set the TWCMSEL[1:0] bit in the TMRx_CTRL1 register to select count mode. If the one-way count
direction is set, configure OWCDIR bit in the TMRx_CTRL1 register to select the specific direction.;
-
Set the TMRx_DIV register to set the counting frequency;
-
Set the TMRx_PR register to set the counting period;
-
Set the TMREN it in the TMRx_CTRL1 register to enable the counter.
Figure 14-41
Use
CK_INT to drive counter, with TMRx_DIV=0x0 and TMRx_PR=0x16
CK_INT
TMREN
COUNTER
12
11
13
14
15
16
00
01
02
03
04
05
06
07
overflow
OVFIF
External clock (TMR9/12 only)
The counter clock can be provided by TRGIN signal.
SMSEL=3’b111
: External clock mode A is selected. Select an external clock source TRGIN signal by