MAX32600 User’s Guide
System Clock, Timers/Counters, Watchdog Timers and Real Time Clock
10.4 Timers/Counters
• Disable the timer,
= “0”
• Select 32-bit timer mode,
= "0"
• Configure the timer for Compare Mode,
= “101”
• Set the prescale value,
2. If using the Timer Output function, set the initial logic level (High or Low),
3. Write to the Timer Count register,
, to set the starting count value
4. Write to the Timer Compare register,
, to set the Compare value
5. If desired, enable the timer interrupt,
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 Compare mode, the currently selected System Clock always provides the timer input. The Compare time is given by the following equation:
Compare Mode Time
(
s
) =
(
CompareValue
−
StartValue
)
SystemClockFrequency
(
Hz
)
×
Prescale
10.4.2.7
Gated Mode
In Gated Mode, the timer counts only when the Timer Input signal is in its active state (asserted), as determined by the
bit in the Timer Control
register. When the Timer Input signal is asserted, counting begins. A timer interrupt is generated when the Timer Input signal is de-asserted or a Timer Compare
occurs. The timer counts up to the 32-bit Compare value stored in the Timer Compare register,
. The timer input is the currently selected
System Clock. When reaching the Compare value, the timer generates an interrupt, the count value in the Timer register is reset to 0x0000_0001, and counting
resumes (assuming the Timer Input signal is still asserted). Also, if the Timer Output function is enabled (in the GPIO), the Timer Output pin changes state (from Low
to High or from High to Low) at Timer Compare. The steps for configuring a timer for Gated Mode and initiating the count are as follows:
1. Write the following to the
register:
• Disable the timer,
= “0”
• Select 32-bit timer mode,
= "0"
• Configure the timer for Gated Mode,
= “110”
• Set the prescale value,
2. Write to the Timer Count register,
, to set the starting count value
Rev.1.3 April 2015
Maxim Integrated
Page 594
Содержание MAX32600
Страница 1: ...MAX32600 User s Guide April 2015...