![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 260](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794260.webp)
GD32E23x User Manual
260
mode, so Timer0 can not be disabled by Timer2
’s disable signal. Do as follow:
1. Configure Timer2 master mode to send its enable signal as trigger output
(MMC=3’b001
in the TIMER2_CTL1 register)
2. Configure Timer0 to select the input trigger from Timer2 (TRGS
=3’b010 in the
TIMERx_SMCFG register).
3. Configure Timer0 in event mo
de (SMC=3’b 110 in TIMERx_SMCFG register).
4. Start Timer2 by writing 1 in the CEN bit (TIMER2_CTL0 register).
Figure 14-29. Triggering TIMER0 with enable signal of TIMER2
TIMER_CK
CNT_REG
CNT_REG
CEN
61
62
63
11
12
13
TRGIF
14
TIMER2
TIMER0
Using an external trigger to start 2 timers synchronously
We configure the start of TIMER0 is triggered by the enable of TIMER2, and TIMER2 is
triggered by its CI0 input rises edge. To ensure 2 timers start synchronously, TIMER2 must
be configured in Master/Slave mode. Do as follow:
1. Configure TIMER2 slave mode to get the input trigger from CI0 (TRGS=100 in the
TIMER2_SMCFG register).
2. Configure TIMER2 in event mode (SMC=110 in the TIMER2_SMCFG register).
3. Configure the TIMER2 in Master/Slave mode by writing MSM=1 (TIMER2_SMCFG
register).
4. Configure TIMER0 to get the input trigger from TIMER2 (TRGS=010 in the
TIMER0_SMCFG register).
5. Configure TIMER0 in event mode (SMC=110 in the TIMER0_SMCFG register).
When a rising edge occurs on TIMER2’s CI0, two timer counters starts counting
synchronously on the internal clock and both TRGIF flags are set.