
GD32L23x User Manual
385
Figure 18-8. LPTIMER output with CTNMST = 1
CARL[31:0]
LPTIMER_O
CMPVAL[31:0]
External Trigger
COUNT
ignored
ignored
The SMST and CTNMST bits can be
modified
only when the timer is enabled (The LPTEN bit
is set to 1). And the single counting mode and continuous counting mode can be modified on
the fly.
If the LPTIMER previously working in the continuous counting mode, setting SMST will switch
the LPTIMER to the single counting mode. The counter will stop as soon as it reaches the
value of CARL[31:0] bits.
If the LPTIMER previously working in the single counting mode, setting CTNMST will switch
the LPTIMER to the continuous counting mode. The counter will restart as soon as it
reaches the value of CARL[31:0] bits.
18.4.9.
Output Mode
The LPTIMER_CARL (counter auto reload) register and LPTIMER_CMPV (compare value)
register are used to generate several different waveforms on LPTIMER output.
The LPTIMER can generate the following waveforms:
PWM mode: the LPTIMER output is set as soon as a match occurs between the value
of LPTIMER_CMPV and the LPTIMER_CNT registers. The LPTIMER output is reset as
soon as a match occurs between the value of LPTIMER_CAR and the LPTIMER_CNT
registers.
Single pulse mode: the output waveform is same as the first pulse in PWM mode, and
then the output will always be reset.
Set mode: the output waveform is similar to the single pulse mode, except that the output
remains at the last signal level (depends on the value of the OPSEL bit in the
LPTIMER_CTL0 register).
There modes require that the value of LPTIMER_CAR register is greater than the value of
the LPTIMx_CMPV register.
The OMSEL bit in the LPTIMER_CTL0 register is used to controls the output mode.
OMSEL = 0: the LPTIMER to generate either a PWM mode waveform or a single pulse