Timer
21
Timer
21.1
Introduction
The timer API provides a set of functions for dealing with the timer module. Functions are pro-
vided to configure and control the timer, along with functions to modify timer/counter values, and to
manage interrupt handling for the timer.
The timer module provides two 16-bit timer/counters that can be configured to operate indepen-
dently as timers or event counters, or they can be configured to operate as one 32-bit timer or one
32-bit Real Time Clock (RTC). For the purpose of this API, the two timers provided by the timer are
referred to as TimerA and TimerB.
When configured as either a 32-bit or 16-bit timer, a timer can be set up to run as a one-shot timer
or a continuous timer. If configured as a one-shot timer, when it reaches zero the timer will cease
counting. If configured as a continuous timer, when it reaches zero the timer will continue counting
from a reloaded value. When configured as a 32-bit timer, the timer can also be configured to
operate as an RTC. In that case, the timer expects to be driven by a 32 KHz external clock, which
is divided down to produce 1 second clock ticks.
When in 16-bit mode, the timer can also be configured for event capture or as a Pulse Width
Modulation (PWM) generator. When configured for event capture, the timer acts as a counter. It
can be configured to either count the time between events, or it can count the events themselves.
The type of event being counted can be configured as a positive edge, a negative edge, or both
edges. When a timer is configured as a PWM generator, the input line used to capture events
becomes an output line, and the timer is used to drive an edge-aligned pulse onto that line.
The timer module also provides the ability to control other functional parameters, such as output
inversion, output triggers, and timer behavior during stalls.
Control is also provided over interrupt sources and events. Interrupts can be generated to indicate
that an event has been captured, or that a certain number of events have been captured. Interrupts
can also be generated when the timer has counted down to zero, or when the RTC matches a
certain value.
21.2
Functions
Functions
void
(uint32_t ui32Base, uint32_t ui32Config)
void
(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Event)
void
(uint32_t ui32Base, uint32_t ui32Timer, bool bInvert)
void
(uint32_t ui32Base, uint32_t ui32Timer, bool bStall)
void
(uint32_t ui32Base, uint32_t ui32Timer, bool bEnable)
void
(uint32_t ui32Base, uint32_t ui32Timer, bool bWait)
April 8, 2013
231
Summary of Contents for Tiva TM4C123GH6PM
Page 26: ...Boot Loader 26 April 8 2013...
Page 68: ...Controller Area Network CAN 68 April 8 2013...
Page 122: ...Hibernation Module 122 April 8 2013...
Page 136: ...Inter Integrated Circuit I2C 136 April 8 2013...
Page 152: ...Memory Protection Unit MPU 152 April 8 2013...
Page 174: ...Pulse Width Modulator PWM Returns None 174 April 8 2013...
Page 196: ...Synchronous Serial Interface SSI 196 April 8 2013...
Page 222: ...System Control 222 April 8 2013...
Page 270: ...UART 270 April 8 2013...
Page 296: ...uDMA Controller 296 April 8 2013...
Page 351: ...April 8 2013 351...