DMTimer 1ms
Fclk – clock frequency (KHz)
Ttick – tick period (ms)
The Timer Overflow Counter Register (TOCR) and the Timer Overflow Wrapping Register (TOWR) are
used for interrupt filtering. When timer overflows it increments the 24 bit TOCR register. When 24 bit
TOCR register values matches the value in the 24 bit TOWR register and timer overflow is asserted, the
TOCR is reset and an interrupt is generated to TISR.
With the Conversion block, in reset state (Positive Increment register, Negative Increment register and
Counter Value register are all zeroed) the programming model and the behavior of the DMtimer_dmc1ms
remain unchanged.
For 1 ms tick with a 32768-Hz clock:
TPIR = 232000
TNIR = -768000
TLDR = 0xFFFFFFE0
NOTE:
Any value of the tick period can be generated with appropriate value of the TPIR, TNIR and
TLDR registers.
By default the TPIR, TNIR, TCVR, TOCR, TOWR registers and the associated logic are in
reset mode (all 0s) and have no action on the programming model of the DMtimer_dmc1ms.
20.2.3.2 Capture Mode Functionality
The timer value in TCRR can be captured and saved in TCAR1 or TCAR2 function of the mode selected
in TCLR through the field CAPT_MODE when a transition is detected on the module input pin
(PIEVENTCAPT). The edge detection circuitry monitors transitions on the input pin (PIEVENTCAPT).
Rising transition, falling transition or both can be selected in TCLR (TCM bit) to trig the timer counter
capture. The module sets the TISR ( TCAR_IT_FLAG bit) when an active transition is detected and at the
same time the counter value TCRR is stored in one of the timer capture registers TCAR1 or TCAR2 as
follows:
•
If TCLR’s CAPT_MODE field is “0” then, on the first enabled capture event, the value of the counter
register is saved in TCAR1 register and all the next events are ignored (no update on TCAR1 and no
interrupt triggering) until the detection logic is reset or the interrupt status register is cleared on TCAR’s
position writing a “1” in it. .
•
If TCLR’s CAPT_MODE field is “1” then, on the first enabled captured event, the counter value is
saved in TCAR1 register and, on the second enabled capture event, the value of the counter register is
saved in TCAR2 register. If capture interrupt is enabled, the interrupt will be asserted on the second
event capture. All the other events are ignored (no update on TCAR1/2 and no interrupt triggering) until
the detection logic is reset or the interrupt status register is cleared on TCAR’s position writing a “1” in
it. This mechanism is useful for period calculation of a clock if that clock is connected to the
PIEVENTCAPT input pin.
The edge detection logic is reset (a new capture is enabled) when the active capture interrupt is served -
TCAR_IT_FLAG bit of TISR (previously ‘1’) is cleared through a “1” written in it or when the edge
detection mode bits TCLR (TCM bit) passed from the No Capture Mode detection to any other modes.
The timer functional clock (input to prescaler) is used to sample the input pin (PIEVENTCAPT). Input
negative or positive pulse can be detected when pulse time is above functional clock period. An interrupt
can be issued on transition detection if the capture interrupt enable bit is set in the Timer Interrupt Enable
Register TIER (TCAR_IT_ENA bit).
See the following examples:
In the next wave, the TCM value is “01” and CAPT_MODE is “0”- only rising edge of the PIEVENTCAPT
will trigger a capture in TCAR and only TCAR1 will update.
3591
SPRUH73H – October 2011 – Revised April 2013
Timers
Copyright © 2011–2013, Texas Instruments Incorporated