
Mini57
Apr. 06, 2017
Page 189 of 475
Rev.1.00
MINI5
7
S
E
RI
E
S
TECH
NIC
A
L R
E
F
E
RE
N
CE
MA
N
UA
L
6.6.4
Basic Configuration
The peripheral clock source of Tiimer0 ~ Timer1 can be enabled in TMRxCKEN
(CLK_APBCLK[3:2]) and selected as different frequency in TMR0SEL (CLK_CLKSEL1[10:8]) for
Timer0, TMR1SEL (CLK_CLKSEL1[14:12]) for Timer1.
6.6.5
Functional Description
The timer controller provides One-shot, Period, Toggle and Continuous Counting operation
modes. The event counting function is also provided to count the events/counts from external pin
and external pin capture function for interval measurement or reset timer counter. Each operating
function mode is shown as follows.
6.6.5.1
Timer Interrupt Flag
Timer controller supports two interrupt flags; one is TIF (TIMERx_INTSTS[0]) flag and its set while
timer counter value CNT (TIMERx_CNT[23:0]) matches the timer compared value CMPDAT
(TIMERx_CMP[23:0]), the other is CAPIF (TIMERx_EINTSTS[0]) flag and its set when the
transition on the ACMPOx (ACMP_STATUS[3] and ACMP_STATUS[2]) associated CAPEDGE
(TIMERx_EXTCTL[2:1]) setting.
6.6.5.2
Timer Counting Operation Mode
Timer controller provides four timer counting modes: one-shot, periodic, toggle-output and
continuous counting operation modes:
6.6.5.3
One
–shot Mode
If timer controller is configured at one-shot OPMODE (TIMERx_CTL[28:27] is 00) and CNTEN
(TIMERx_CTL[30]) bit 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]) flag will be set to 1, CNT (TIMERx_CNT[23:0]) value and CNTEN bit is
cleared by timer controller then timer counting operation stops. In the meantime, if the INTEN
(TIMERx_CTL[29]) bit is enabled, the timer interrupt signal is generated and sent to NVIC to
inform CPU also.
6.6.5.4
Periodic Mode
If timer controller is configured at periodic OPMODE (TIMERx_CTL[28:27] is 01) and CNTEN
(TIMERX_CTL[30]) bit 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 flag will be set
to 1, CNT value will be cleared by timer controller and timer counter operates counting again. In
the meantime, if the INTEN bit is enabled, the timer interrupt signal is generated and sent to NVIC
to inform CPU also. In this mode, timer controller operates counting and compares with CMPDAT
value periodically until the CNTEN bit is cleared by software.
6.6.5.5
Toggle-Output Mode
If timer controller is configured at toggle-out OPMODE (TIMERx_CTL[28:27] is 10) and CNTEN