![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 257](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794257.webp)
GD32E23x User Manual
257
Mode Selection
Source Selection
Polarity Selection
Filter and Prescaler
Exam3
Event mode
The counter will start
to count when a rising
edge of trigger input
comes.
TRGS[2:0] =3’b111
ETIFP is selected.
ETP = 0, the polarity of
ETI does not change.
ETPSC = 1, ETI is
divided by 2.
ETFC = 0, ETI does
not filter.
Figure 14-26. Event mode
TIMER_CK
CNT_REG
94
95
96
97
ETI
TRGIF
ETIFP
Single pulse mode
Single pulse mode is enabled by setting SPM in TIMERx_CTL0. If SPM is set, the counter
will be cleared and stopped when the next update event occurs. In order to get a pulse
waveform, the TIMERx is configured to PWM mode or compare mode by CHxCOMCTL.
Once the timer is set to the single pulse mode, it is not necessary to configure the timer
enable bit CEN in the TIMERx_CTL0 register to 1 to enable the counter. Setting the CEN bit
to 1 or a trigger signal edge can generate a pulse and then keep the CEN bit at a high state
until the update event occurs or the CEN bit is written to 0 by software. If the CEN bit is
cleared to 0 by software, the counter will be stopped and its value will be held.
In the single pulse mode, the active edge of trigger which sets the CEN bit to 1 will enable
the counter. However, there exists several clock delays to perform the comparison result
between the counter value and the TIMERx_CHxCV value. In order to reduce the delay to a
minimum value, the user can set the CHxCOMFEN bit in TIMERx_CHCTL0/1 register. After
a trigger rising occurs in the single pulse mode, the OxCPRE signal will immediately be
forced to the state which the OxCPRE signal will change to, as the compare match event
occurs without taking the comparison result into account. The CHxCOMFEN bit is available
only when the output channel is configured to the PWM mode 0 or PWM mode 1 and the
trigger source is derived from the trigger signal.
Figure 14-27. Single pulse mode TIMERx_CHxCV=4, TIMERx_CAR=99
example.