Product Specs

Table Of Contents
24 TIMER Timer/counter
Page
234
TIMER Core
f
TIMER
= 16 MHz / (2
PRESCALER
)
24 TIMER Timer/counter
The TIMER can operate in two modes: timer and counter.
TIMER
PCLK1M
PCLK16M
PRESCALER
f
TIM ER
Counter
CC[
0..n]
MODE
Figure 42: Block schematic for timer/counter
The timer/counter runs on the high-frequency clock source (HFCLK) and includes a four-bit (1/2X) prescaler
that can divide the timer input clock from the HFCLK controller. Clock source selection between PCLK16M
and PCLK1M is automatic according to TIMER base frequency set by the prescaler. The TIMER base
frequency is always given as 16 MHz divided by the prescaler value.
The PPI system allows a TIMER event to trigger a task of any other system peripheral of the device. The
PPI system also enables the TIMER task/event features to generate periodic output and PWM signals to any
GPIO. The number of input/outputs used at the same time is limited by the number of GPIOTE channels.
The TIMER can operate in two modes, Timer mode and Counter mode. In both modes, the TIMER is started
by triggering the START task, and stopped by triggering the STOP task. After the timer is stopped the timer
can resume timing/counting by triggering the START task again. When timing/counting is resumed, the timer
will continue from the value it had prior to being stopped.
In Timer mode, the TIMER's internal Counter register is incremented by one for every tick of the timer
frequency f
TIMER
as illustrated in Figure 42: Block schematic for timer/counter on page 234. The timer
frequency is derived from PCLK16M as shown below, using the values specified in the PRESCALER
register:
When f
TIMER
<= 1 MHz the TIMER will use PCLK1M instead of PCLK16M for reduced power consumption.
In counter mode, the TIMER's internal Counter register is incremented by one each time the COUNT task
is triggered, that is, the timer frequency and the prescaler are not utilized in counter mode. Similarly, the
COUNT task has no effect in Timer mode.
The TIMER's maximum value is configured by changing the bit-width of the timer in the BITMODE on page
239 register.
PRESCALER on page 239 and the BITMODE on page 239 must only be updated when the timer
is stopped. If these registers are updated while the TIMER is started then this may result in unpredictable
behavior.
BITMODE
Increment
CLEAR
Prescaler
CAPTURE[0..n]
STOP
START
COMPARE[0..n]
COUNT