![Geehy SEMICONDUCTOR APM32F030x4x6x8xC Скачать руководство пользователя страница 178](http://html1.mh-extra.com/html/geehy-semiconductor/apm32f030x4x6x8xc/apm32f030x4x6x8xc_user-manual_573629178.webp)
www.geehy.com Page 177
16.4
Functional Description
Clock Source Selection
The general-purpose timer has four clock sources
Internal clock
It is TMRx_CLK from RCM, namely the driving clock of the timer; when the slave
mode controller is disabled, the clock source CK_PSC of the prescaler is driven
by the internal clock CK_INT.
External clock mode 1 (TMR15)
The trigger signal generated from the input channel TI1/2/3/4 of the timer after
polarity selection and filtering is connected to the slave mode controller to control
the work of the counter. Besides, the pulse signal generated by the input of
Channel 1 after double-edge detection of the rising edge and the falling edge is
logically equal or the future signal is TI1F_ED signal, namely double-edge signal
of TIF_ED. Specially the PWM input can only be input by TI1/2.
Internal trigger input (only applicable to TMR15)
The timer is set to work in slave mode, and the clock source is the output signal
of other timers. At this time, the clock source has no filtering, and the
synchronization or cascading between timers can be realized. The master mode
timer can reset, start, stop or provide clock for the slave mode timer.
Timebase Unit
The time base unit in the general-purpose timer contains four registers
Counter register (CNT) 16 bits
Auto reload register (AUTORLD) 16 bits
Prescaler register (PSC) 16 bits
Repetition count register (REPCNT) 8 bits
Counter CNT
The counters of TMR15/16/17 timers can only count up.
Count-up mode
Set to the count-up mode by CNTDIR bit of configuration control register
(TMRx_CTRL1).
When the counter is in count-up mode, the counter will count up from 0; every
time a pulse is generated, the counter will increase by 1 and when the value of
the counter (TMRx_CNT) is equal to the value of the auto reload
(TMRx_AUTORLD), the counter will start to count again from 0, a count-up
overrun event will be generated, and the value of the auto reload
(TMRx_AUTORLD) is written in advance.
When the counter overruns, an update event will be generated. At this time, the
repeat count shadow register, the auto reload shadow register and the prescaler
buffer will be updated. The update event can be disabled by UD bit of
configuration control register TMRx_CTRL1.