background image

 

9-12

DSP56602 User’s Manual 

MOTOROLA

Triple Timer Module

Triple Timer Module Programming Model

 

 

9.4.6.9

Data Output (DO)—Bit 12

The Data Output (DO) bit writes data to the TIO pin. When the GPIO mode is enabled 
(TC0–TC3 are all cleared) and DIR = 1, the TIO pin acts as data output. Writing the DO 
bit writes the data to the TIO pin. If the INV bit is set, the data on the TIO pin is inverted. 
When GPIO mode is disabled, writing the DO bit has no effect. The DO bit is cleared by 
hardware and software reset.

9.4.6.10

Timer Overflow Flag (TOF)—Bit 13

The Timer Overflow Flag (TOF) bit, when set, indicates that counter wraparound has 
occurred. The Timer Overflow Flag bit is cleared when writing a one into the TOF bit. 
Writing a 0 into the TOF bit has no effect. The bit is also cleared when the timer overflow 
interrupt is serviced (timer overflow interrupt acknowledge). The TOF bit is cleared by 
hardware and software reset, by the STOP instruction, and by timer disabling (TE = 0).

9.4.6.11

Timer Compare Flag (TCF)—Bit 14

In the Timer, PWM, and Watchdog modes, the Timer Compare Flag (TCF) bit when set 
indicates that (N – M + 1) events are counted, where N is the value in the compare 
register and M is TLR value. In the Measurement modes, the TCF bit when set indicates 
that the measurement has been completed. The Timer Compare Flag bit is cleared when 
writing a 1 into the TCF bit. Writing a 0 into the TCF bit has no effect. The bit is cleared 
also when the Timer Compare interrupt is serviced (timer compare interrupt 
acknowledge). The TCF bit is cleared by hardware and software reset, the STOP 
instruction, and also by timer disabling (TE = 0).

Notes:

1.

Writing a 0 in the TOF or TCF bit can be done with the Bit Test and Clear 

(BCLR) instruction. The state of the tested bit is stored in the Carry bit of 
the Status Register (SR).

 2.

TOF and TCF are cleared by writing logic 1 to the specific bit. In order to 

assure that only the desired bit is cleared, the programmer should not use 
the BSET command. The proper way to clear these bits is to write a logic 1 
to the flag to be cleared and 0 to the other flag, using the MOVEP 
instruction.

9.4.6.12

Prescaled Clock Enable (PCE)—Bit 15

The Prescaled Clock Enable (PCE) bit is used to select the prescaled clock as the timer 
source clock. When PCE is cleared the timer uses either internal (CLK/2) or external 
(TIO) source clock as determined by the timer operating mode. When PCE is set, the 
prescaler output is used as the timer source clock for the counter regardless of the timer 
operating mode. 

The PCE bit is cleared by hardware and software reset.

 

   

  

F

re

e

sc

a

le

 S

e

m

ic

o

n

d

u

c

to

r,

 I

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

  

 

Freescale Semiconductor, Inc.

For More Information On This Product,

   Go to: www.freescale.com

n

c

.

..

ARCHIVED BY FREESCALE SEMICONDUCTOR, INC. 2005

ARCHIVED BY FREESCALE SEMICONDUCT

OR,

 INC.

 2005

Summary of Contents for DSP56602

Page 1: ...SECTION 9 TRIPLE TIMER MODULE Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ...

Page 2: ... 3 9 3 TIMER ARCHITECTURE 9 4 9 4 TRIPLE TIMER MODULE PROGRAMMING MODEL 9 6 9 5 TIMER MODES OF OPERATION 9 13 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ...

Page 3: ...TRIPLE TIMER MODULE ARCHITECTURE The triple timer module includes a 16 bit Timer Prescaler Load Register TPLR a 16 bit Timer Prescaler Count Register TPCR a 14 bit Prescaler Counter and three timers Each one of the three timers can use the Prescaler Clock as its clock source The Timer Prescaler Load Register TPLR is a 16 bit read write register that controls the Prescaler Divide Factor and the sou...

Page 4: ...ach timer as a memory mapped peripheral occupying four 16 bit words in the X data memory space The user can use standard polled or interrupt programming techniques The programming model is shown in Figure 9 3 on page 9 6 Figure 9 1 Triple Timer Module Block Diagram Timer Prescaler Count Register GDB 16 16 TPLR 16 Timer 0 Timer 2 Timer 1 14 bit Prescaler CLK 2 TIO0 TIO1 TIO2 TPCR Timer Prescaler Lo...

Page 5: ...imer interrupt Timer Control CLK 2 TIO Compare Register TCPR 16 16 Logic Load Register Count Register TLR Prescaled CLK TCR AA0744 16 16 9 2 16 16 16 16 16 Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ...

Page 6: ...imer Prescaler Count Register Reset Uninitialized Read Only PC7 PC6 PC4 PC3 PC2 PC1 PC0 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 TCF TOF TC1 TCPR0 X FF8D TCPR1 X FF89 TCPR2 X FF85 Timer Compare Register Reset Uninitialized Read Write Compare Register 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 TPLR X FF83 Timer Prescaler Load Register Reset 0000 Read Write PL7 PL6 PL4 PL3 PL2 PL1 PL0 11 10 9 8 7 6 5 4 3 2 ...

Page 7: ...urce PS 1 0 bits control the source of the prescaler clock Table 9 1 summarizes the functionality of the PS bits The DSP internal clock CLK divided by two is selected when the PS 1 0 bits are cleared The other combinations select one of the TIO pins as the source clock for the prescaler regardless of the operating mode of the selected timer Notes 1 If the prescaler source clock is external the pre...

Page 8: ... 16 bit write only register In all modes the counter is preloaded with the TLR value after the Timer Enable TE bit in the TCSR is set and a first event occurs In Timer modes if the Timer Reload Mode TRM bit is set the counter is reloaded each time after it has reached the value contained by the Timer Compare Register TCR and the new event occurs In Measurement modes if the TRM bit is set the count...

Page 9: ... three TIO pins are tristated In order to prevent undesired spikes on the TIO pins when switching from tri state into active state external pull up or pull down resistors should be tied to the TIO pins 9 4 6 2 Timer Overflow Interrupt Enable TOIE Bit 1 The Timer Overflow Interrupt Enable TOIE bit is used to enable the timer overflow interrupts The overflow interrupt is generated after the counter ...

Page 10: ...y synchronized to the internal clock and its frequency should be lower than the internal operating frequency divided by 4 CLK 4 Table 9 2 TC 3 0 Bit Functionality TC3 TC2 TC1 TC0 TIO Clock Mode 0 0 0 0 GPIO Internal Timer GPIO 0 0 0 1 Output Internal Timer Pulse 0 0 1 0 Output Internal Timer Toggle 0 0 1 1 Input External Event Counter 0 1 0 0 Input Internal Input Width 0 1 0 1 Input Internal Input...

Page 11: ...The Timer Reload Mode TRM control bit determines the counter preload operation In Timer and Watchdog modes the counter is preloaded with the TLR value after the TE bit is set and a first event occurs If the TRM bit is set the counter is reloaded each time it reaches the value contained by the Timer Compare Register and the new event occurs In PWM mode the counter is reloaded each time counter wrap...

Page 12: ...The Timer Compare Flag bit is cleared when writing a 1 into the TCF bit Writing a 0 into the TCF bit has no effect The bit is cleared also when the Timer Compare interrupt is serviced timer compare interrupt acknowledge The TCF bit is cleared by hardware and software reset the STOP instruction and also by timer disabling TE 0 Notes 1 Writing a 0 in the TOF or TCF bit can be done with the Bit Test ...

Page 13: ...th Modulation Watchdog Table 9 3 summarizes these modes and the following paragraphs describe these modes in detail Table 9 3 Timer Mode Summary Mode Mode Description Mode Type TC 3 0 0 Timer Mode No Output Internal Clock Timer 0000 1 Timer Mode Output Pulse Enable Internal Clock Timer 0001 2 Timer Mode Output Toggle Enable Internal Clock Timer 0010 3 Timer Mode Output Toggle Enable External Clock...

Page 14: ...he TCR 9 5 1 2 Mode 1 Timer Output Pulse Internal Clock This mode is selected when TC 3 0 is set to 0001 In this mode the counter is cleared after the TE bit is set and loaded with the TLR value on the first timer pulse derived either from the DSP clock divided by two CLK 2 or from the prescaled clock input The following timer pulses increment the counter When the counter matches the value contain...

Page 15: ...F bit is set and if the TOIE bit is set an overflow interrupt is generated The counter contents can be read at any time by reading the TCR Note After the TE bit is set the TIO pin output value is set equal to the INV bit to guarantee the correct first pin transition 9 5 1 4 Mode 3 Timer Event Counter External Clock This mode is selected when TC 3 0 is set to 0011 In this mode the counter is cleare...

Page 16: ...OF bit is set If the TOIE bit is set an overflow interrupt is generated In this mode TIO acts as a gating signal for the internal timer clock The INV bit determines whether the counting is enabled when TIO is low the INV bit is set or TIO is high the INV bit is cleared 9 5 2 2 Mode 5 Period Measurement The Period Measurement mode is selected when TC 3 0 is set to 0101 In this mode the counter is c...

Page 17: ...tion mode Output Toggle Enable mode is selected when TC 3 0 is set to 0111 In this mode the counter is cleared after the TE bit is set and loaded with the TLR value on the first timer pulse derived either from the DSP clock divided by two CLK 2 or from the prescaled clock input The following timer pulses increment the counter When the counter matches the value of the TCPR the TIO output pin is tog...

Page 18: ...the TCR Note In this mode the internal hardware preserves the TIO value and direction for an additional 2 5 internal clock cycles after reset was activated This ensures a valid length reset when the TIO is used as input to the RESET pin 9 5 4 2 Mode 10 Watchdog Output Toggle Internal Clock The Watchdog Mode Output Toggle Enable mode is selected when TC 3 0 is set to 1010 In this mode the counter i...

Page 19: ...ring the execution of the WAIT instruction Thus timer activity continues undisturbed On reaching the final event if the timer interrupt is enabled an interrupt is generated and the processor leaves the Wait state and services the interrupt The timer clocks are disabled during the execution of the STOP instruction Thus timer activity is stopped In Stop mode the TIO pins are electrically disconnecte...

Page 20: ...Timer Module Timer Modes of Operation Freescale Semiconductor I Freescale Semiconductor Inc For More Information On This Product Go to www freescale com nc ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ARCHIVED BY FREESCALE SEMICONDUCTOR INC 2005 ...

Reviews: