![Maxim Integrated MAX32660 User Manual Download Page 105](http://html1.mh-extra.com/html/maxim-integrated/max32660/max32660_user-manual_1744484105.webp)
MAX32660 User Guide
Maxim Integrated
Page 105 of 195
10
Timers
The MAX32660 contains three 32-bit, reloadable timers. Each timer provides multiple operating modes. Timer modes
supported include:
•
One-Shot: Timer counts up to terminal value then halts.
•
Continuous: Timer counts up to terminal value then repeats.
•
Counter: Timer counts input edges received on timer input pin (Timer 0 only).
•
Capture: Captures a snapshot of the current timer count when timer input edge transitions (Timer 0 only).
•
Compare: Timer pin toggles when timer exceeds terminal count (Timer 0 only).
•
Gated: Timer increments only when timer input pin is asserted (Timer 0).
•
Capture/Compare: Timer counts when timer input is asserted, captures timer count when input is deasserted
(Timer 0 only).
10.1
Features
•
32-bit reload counter
•
Programmable prescaler with values from 1 to 4096
•
Independent interrupt
•
Timer 0 supports a Timer I/O alternate function pin for:
−
Capture, compare, and capture/compare capability
−
Timer pin available as alternate function
−
Configurable Input pin for event triggering, clock gating, or capture signal
−
Configurable output pin for event output and PWM signal generation
10.2
Basic Operation
The timer modes operate by incrementing the
register, driven by either the timer clock, an external stimulus on
the timer pin, or a combination of both. The
register is always readable, even while the timer is enabled and
counting.
Each timer mode has a user-configurable timer period, which terminates on the timer clock cycle following the end of timer
period condition. Each timer mode has a different response at the end of a timer period, which can include changing the
state of the timer pin, capturing a timer value, reloading
with a new starting value, or disabling the counter. The
end of a timer period will always set the corresponding interrupt bit and can generate an interrupt, if enabled.
In most modes the timer peripheral automatically sets
to 0x0000 0001 at the end of a timer period, but
is set to 0x0000 0000 following a system reset. This means the first timer period following a system reset will be
one timer clock longer than subsequent timer periods if
is not initialized to 0x0000 0001 during the timer
configuration step.
Clocking of timer functions is driven by the timer clock frequency,
f
CNT_CLK
. The timer clock frequency is a user-configurable,
division of the system peripheral clock, PCLK. Each timer has an independent prescaler, allowing timers to operate at
different frequencies. The prescaler can be set from 1 to 4096 using the
.pres3
.pres
fields. Unless
otherwise mentioned, the timer clock is generated as follows: