English
Language : 

LM3S5P3B Datasheet, PDF (478/1170 Pages) Texas Instruments – Stellaris® LM3S5P3B Microcontroller
General-Purpose Timers
determined by the TnEVENT fields of the GPTMCTL register. Table 10-9 on page 478 shows the
values that are loaded into the timer registers when the timer is enabled.
Table 10-9. Counter Values When the Timer is Enabled in Input Event-Count Mode
Register
TnR
TnV
Count Down Mode
GPTMTnILR
GPTMTnILR
Count Up Mode
Not available
Not available
When software writes the TnEN bit in the GPTMCTL register, the timer is enabled for event capture.
When the selected input event is detected, the current timer counter value is captured in the
GPTMTnR register and is available to be read by the microcontroller. The GPTM then asserts the
CnERIS bit in the GPTM Raw Interrupt Status (GPTMRIS) register, and holds it until it is cleared
by writing the GPTM Interrupt Clear (GPTMICR) register. If the capture mode event interrupt is
enabled in the GPTM Interrupt Mask (GPTMIMR) register, the GPTM also sets the CnEMIS bit in
the GPTM Masked Interrupt Status (GPTMMIS) register. In this mode, the GPTMTnR register
holds the time at which the selected input event occurred while the GPTMTnV register holds the
free-running timer value. These registers can be read to determine the time that elapsed between
the interrupt assertion and the entry into the ISR.
In addition to generating interrupts, an ADC and/or a μDMA trigger can be generated. The ADC
trigger is enabled by setting the TnOTE bit in GPTMCTL.The μDMA trigger is enabled by configuring
and enabling the appropriate μDMA channel. See “Channel Configuration” on page 359.
After an event has been captured, the timer does not stop counting. It continues to count until the
TnEN bit is cleared. When the timer reaches the timeout value, it is reloaded with the value from the
GPTMTnILR register.
Figure 10-4 on page 479 shows how input edge timing mode works. In the diagram, it is assumed
that the start value of the timer is the default value of 0xFFFF, and the timer is configured to capture
rising edge events.
Each time a rising edge event is detected, the current count value is loaded into the GPTMTnR
register, and is held there until another rising edge is detected (at which point the new count value
is loaded into the GPTMTnR register).
478
January 20, 2012
Texas Instruments-Production Data