
M0A21/M0A23 Series
May 06, 2022
Page
298
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
meantime, if the INTEN (TIMERx_CTL[29]) bit is set, the timer interrupt signal is generated and sent to
NVIC to inform CPU. In this mode, the timer controller operates counting and compares with CMPDAT
value periodically until the CNTEN bit is cleared by user.
Toggle-Output Mode
If the timer controller is configured in toggle-output mode (TIMERx_CTL[28:27] is 10) and CNTEN
(TIMERx_CTL[30]) is set, the timer counter starts up counting. The counting operation of toggle-output
mode is almost the same as periodic mode, except toggle-output mode has associated TM0 ~ TM3 or
TM0_EXT ~ TM3_EXT pin to output signal while specify TIF (TIMERx_INTSTS[0]) is set. User can set
TGLPINSEL (TIMERx_CTL[22]) to choose TMx or TMx_EXT as toggle-output pin. Thus, the toggle-
output signal on TM0 ~ TM3 pin
is high and changing back and forth with 50% duty cycle.
Continuous Counting Mode
If the timer controller is configured in continuous counting mode (TIMERx_CTL[28:27] is 11) and CNTEN
(TIMERx_CTL[30]) is set, the timer counter starts up counting. Once the CNT (TIMERx_CNT[23:0])
value reaches CMPDAT (TIMERx_CMP[23:0]) value, the TIF (TIMERx_INTSTS[0]) will be set to 1 and
CNT value keeps up counting. In the meantime, if the INTEN (TIMERx_CTL[29]) is set, the timer
interrupt signal is generated and sent to NVIC to inform CPU. User can change different CMPDAT value
immediately without disabling timer counting and restarting timer counting in this mode.
For example, the CMPDAT value is set as 80, first. The TIF will be set to 1 when the CNT value is equal
to 80, the timer counter is kept counting and the CNT value will not go back to 0, it continues to count
81, 82, 83,
… to
2
24
-1, 0, 1, 2, 3,
… to
2
24
-1
again and again. Next, if user programs CMPDAT value as
200 and clears TIF, the TIF will be set to 1 again when the CNT value reaches 200. At last, user
programs CMPDAT as 500 and clears TIF, and the TIF will be set to 1 again when the CNT value
reaches 500.
In this mode, the timer counting is continuous. So, this operation mode is called as continuous counting
mode.
CNT = 0
Set
CMPDAT = 80
TIF = 1 and
Interrupt
Generation
Clear TIF as 0
and Set
CMPDAT = 200
CNT from 2
24
-1 to 0
CNT = 100
CNT = 200
CNT = 300
CNT = 400
CNT = 500
CNT = 2
24
-1
TIF = 1 and
Interrupt
Generation
Clear TIF as 0
and Set
CMPDAT = 500
TIF = 1 and
Interrupt
Generation
Clear TIF as 0
and Set
CMPDAT = 80
Figure 6.7-3 Continuous Counting Mode
Event Counting Mode
The timer controller also provides an application which can count the input event from TMx (x= 0~3) pin
and the number of event will reflect to CNT (TIMERx_CNT[23:0]) value. It is also called as event