
NUC126
Aug. 08, 2018
Page
634
of 943
Rev 1.03
NUC12
6 S
E
RI
E
S
T
E
CH
NI
CA
L R
E
F
E
RE
NCE
MA
NUA
L
6.17.5.2 Timer Counting Mode
The timer controller provides four timer counting modes: one-shot, periodic, toggle-output and
continuous counting operation modes:
6.17.5.3 One
–shot Mode
If the timer controller is configured at one-shot mode (TIMERx_CTL[28:27] is 00) 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,
CNT value and CNTEN bit is cleared automatically by timer controller then timer counting operation
stops. In the meantime, if the INTEN (TIMERx_CTL[29]) is enabled, the timer interrupt signal is
generated and sent to NVIC to inform CPU also.
6.17.5.4 Periodic Mode
If the timer controller is configured at periodic mode (TIMERx_CTL[28:27] is 01) 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,
CNT value will be cleared automatically by timer controller and timer counter operates counting again.
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. In this mode, timer controller operates counting and compares
with CMPDAT value periodically until the CNTEN bit is cleared by user.
6.17.5.5 Toggle-Output Mode
If the timer controller is configured at 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 T0 ~ T3 pin to
output signal while specify TIF (TIMERx_INTSTS[0]) is set. Thus, the toggle-output signal on T0 ~ T3
pin
is high and changing back and forth with 50% duty cycle.
6.17.5.6 Continuous Counting Mode
If the timer controller is configured at 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 enabled, the timer interrupt signal is generated and sent to NVIC to inform CPU
also. User can change different CMPDAT value immediately without disabling timer counting and
restarting timer counting in this mode.
For example, CMPDAT value is set as 80, first. The TIF will set to 1 when CNT value is equal to 80,
timer counter is kept counting and CNT value will not goes 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 set to 1 again when CNT value reaches to 200. At last, user programs
CMPDAT as 500 and clears TIF, the TIF will set to 1 again when CNT value reaches to 500.
In this mode, the timer counting is continuous. So, this operation mode is called as continuous
counting mode.