GD32W51x User Manual
474
Figure 17-31. Pause mode of TIMER0 controlled by enable signal of TIMER2
TIMER_CK
CNT_REG
CNT_REG
CEN
61
62
63
11
12
13
TRGIF
TIMER2
TIMER0
In this example, O0CPRE can also be used as trigger source instead of enable signal output.
Steps are shown as follows:
1.
Configure TIMER2 in master mode and O0CPRE as trigger output (MMS=3’b100 in the
TIMER2_CTL1 register).
2.
Configure the TIMER2 O0CPRE waveform (TIMER2_CHCTL0 register).
3.
Select TIMER2 as TIMER0 input trigger source (TRGS=3’b010 in the TIMERx_SMCFG
register).
4.
Configure TIMER0 in pause mode (SMC=3’b101 in TIMERx_SMCFG register).
5.
Enable TIMER0 by writing ‘1’ to the CEN bit (TIMER0_CTL0 register).
6.
Start TIMER2 by writing ‘1’ to the CEN bit (TIMER2_CTL0 register).
Figure 17-32. Pause mode of TIMER0 controlled by O0CPREF signal of TIMER2
TIMER_CK
CNT_REG
TRGIF
CNT_REG
60
O0CPRE
61
62
63
00
01
11
12
13
14
TIMER2
TIMER0
Using an external trigger to start two timers synchronously.
The start of TIMER0 is triggered by the enable signal of TIMER2, and TIMER2 is triggered by
its CI0 input rising edge. To ensure that two timers start synchronously, TIMER2 must be
configured in master/slave mode. Steps are shown as follows:
1.
Configure TIMER2 in slave mode, and select CI0_ED as the input trigger (TRGS=3’b100
in the TIMER2_SMCFG register).
2.
Configure TIMER2 in event mode (SMC=3’b110 in the TIMER2_SMCFG register).