In the 32-bit modes, the GPTM translates a 32-bit write access to
GPTMTAILR
into a write access
to both
GPTMTAILR
and
GPTMTBILR
. The resulting word ordering for such a write operation is:
GPTMTBILR[15:0]:GPTMTAILR[15:0]
Likewise, a 32-bit read access to
GPTMTAR
returns the value:
GPTMTBR[15:0]:GPTMTAR[15:0]
A 32-bit read access to
GPTMTAV
returns the value:
GPTMTBV[15:0]:GPTMTAV[15:0]
13.4
Initialization and Configuration
To use a GPTM, the appropriate
TIMERn
bit must be set in the
RCGCTIMER
register (see page 380
). If using any CCP pins, the clock to the appropriate GPIO module must be enabled via the
RCGCGPIO
register (see page 382). To find out which GPIO port to enable, refer to Table
26-4 on page 1797. Configure the
PMCn
fields in the
GPIOPCTL
register to assign the CCP signals
to the appropriate pins (see page 787 and Table 26-5 on page 1808).
This section shows module initialization and configuration examples for each of the supported timer
modes.
13.4.1
One-Shot/Periodic Timer Mode
The GPTM is configured for One-Shot and Periodic modes by the following sequence:
1.
Ensure the timer is disabled (the
TnEN
bit in the
GPTMCTL
register is cleared) before making
any changes.
2.
Write the
GPTM Configuration Register (GPTMCFG)
with a value of 0x0000.0000.
3.
Configure the
TnMR
field in the
GPTM Timer n Mode Register (GPTMTnMR)
:
a.
Write a value of 0x1 for One-Shot mode.
b.
Write a value of 0x2 for Periodic mode.
4.
Optionally configure the
TnSNAPS
,
TnWOT
,
TnMTE
, and
TnCDIR
bits in the
GPTMTnMR
register
to select whether to capture the value of the free-running timer at time-out, use an external
trigger to start counting, configure an additional trigger or interrupt, and count up or down. In
addition, if using CCP pins, the
TCACT
field can be programmed to configure the compare action.
5.
Load the start value into the
GPTM Timer n Interval Load Register (GPTMTnILR)
.
6.
If interrupts are required, set the appropriate bits in the
GPTM Interrupt Mask Register
(GPTMIMR)
.
7.
Set the
TnEN
bit in the
GPTMCTL
register to enable the timer and start counting.
8.
Poll the
GPTMRIS
register or wait for the interrupt to be generated (if enabled). In both cases,
the status flags are cleared by writing a 1 to the appropriate bit of the
GPTM Interrupt Clear
Register (GPTMICR)
.
971
June 18, 2014
Texas Instruments-Production Data
Tiva
™
TM4C1294NCPDT Microcontroller