5 for detailed descriptions of timer modes 4 and 5 – Motorola DSP96002 User Manual

Page 822

Advertising
background image

40

MOTOROLA

6.4.5

Timer Mode 5 (Period Measurement Mode)

Timer Mode 5 is defined by TC2-TC0 equal to 101.

In Timer Mode 5, the counter is driven by a clock derived from the DSP’s internal clock
divided by 2 (CLK/2). With the timer enabled (TE=1), the counter is loaded with the value
contained by the TCR and starts incrementing. On each transition of the same polarity that
occurs on TIO, the TS bit in TCSR is set and, if TIE is set, an interrupt is generated. The
contents of the counter is loaded in the TCR. The user’s program can read the TCR and
subtract consecutive values of the counter to determine the distance between TIO edges.
The counter is not stopped and it continues to increment. The INV bit determines whether
the period is measured between 0-to-1 transitions of TIO (INV=0), or between 1-to-0 tran-
sitions of TIO (INV=1). Figure 16 illustrates Timer Mode 5 when INV=0, and Figure 17
illustrates Mode 5 with INV=1.

6.4.6

Timer Mode 7 (Event Counter Mode, External Clock)

Timer Mode 7 is defined by TC2-TC0 equal to 111.

With the timer enabled (TE=1), the counter is loaded with the value contained by the TCR.
The counter is decremented by the transitions of the signal coming in on the TIO input pin.
At the transition that occurs after the counter has reached 0, the TS bit in TCSR is set and,
if the TIE is set, the timer generates an interrupt. The counter is reloaded with the value
contained by the TCR, and the entire process is repeated until the timer is disabled
(TE=0). The INV bit determines whether 0-to-1 transitions (INV=0) or 1-to-0 transitions
(INV=1) will decrement the counter. Figure 18 illustrates Timer Mode 7 when INV=0, and
Figure 19 illustrates Timer Mode 7 when INV=1.

Advertising