MAX32600 User’s Guide
System Clock, Timers/Counters, Watchdog Timers and Real Time Clock
10.4 Timers/Counters
• Select either the rising edge or falling edge of the Timer Input signal for the count,
(
NOTE
: This also sets the initial logic level (High
or Low) for the Timer Output function; however, the Timer Output function
does not
have to be enabled via GPIO)
2. Write to the Timer register to set the starting count value,
• This only affects the first pass in Counter Mode
• After the first Timer Compare in Counter Mode, counting always begins at the reset value of 0x0000_0001
• In Counter Mode in general, the Timer register should be written with the value 0x0000_0001
3. Write the Compare Count value,
4. If desired, enable the timer interrupt,
5. Configure the associated GPIO port pin for the Timer Input function
6. If using the Timer Output function, configure the associated GPIO port pin for the Timer Output function. (See
GPIO Pins and Peripheral Mode Functions
for
further information.)
7. Enable timer and start counting,
= "1"
In Counter Mode, the number of Timer Input transitions since the timer start is given by the following equation:
Counter Mode Timer Input Transition
=
CurrentCountValue
−
StartValue
10.4.2.4
PWM Mode
In PWM Mode, the timer outputs a Pulse-Width Modulated (PWM) output signal through a GPIO port pin. The timer first counts up to the 32-bit PWM compare value
stored in the
register. When the timer count value matches the PWM value, the Timer Output toggles. The timer continues counting until it
reaches the Compare value stored in the
. Upon reaching the
value, the Timer Output signal toggles again, the timer
generates an interrupt, the count value in the Timer register is reset to 0x0000_0001, and counting resumes.
When
= “0”: Timer Output signal begins as a Low (“0”) and then transitions to a High (“1”) when the timer value matches the PWM
value. The Timer Output signal returns to a Low (“0”) after the timer reaches the Compare value,
, which is reset to 0x0000_0001.
When
= “1”: Timer Output signal begins as a High (“1”) and then transitions to a Low (“0”) when the timer value matches the PWM
Compare/Match value. The Timer Output signal returns to a High (“1”) after the timer reaches the Compare value,
, which is reset
to 0x0000_0001.
The steps for configuring a timer for PWM mode and initiating the PWM operation are as follows:
1. Write the following in the
register:
• Disable the timer,
= “0”
Rev.1.3 April 2015
Maxim Integrated
Page 591