beautypg.com

Motorola DSP96002 User Manual

Page 825

background image

MOTOROLA

43

6.5

TIMER BEHAVIOR DURING WAIT and STOP

During the execution of the WAIT instruction, the timer clocks are active and the timer ac-
tivity continues undisturbed. If the timer interrupt is enabled when the final event occurs,
an interrupt will be generated and serviced.

It is recommended that the timer be disabled before executing the STOP instruction be-
cause, during the execution of the STOP instruction, the timer clocks are disabled and the
timer activity will be stopped. If, for example, the TIO pin is used as input, the changes
that occur while the chip is in STOP mode will be ignored.

6.6

OPERATING CONSIDERATIONS

The value 0 for the Timer Count Register (TCR) is considered a boundary case and af-
fects the behavior of the timer under the following conditions:

If the TCR is loaded with 0, and the counter contained a non-zero value before the

TCR was loaded, then after the timer is enabled, it will count 2

32

events, generate an

interrupt, and then generate an interrupt for every new event.

If the TCR is loaded with 0, and the counter contained a zero value prior to loading,

then after the timer is enabled, it will generate an interrupt for every event.

If the TCR is loaded with 0 after the timer has been enabled, the timer will be loaded

with 0 when the current count is completed and then generate an interrupt for every
new event.

6.7

SOFTWARE EXAMPLES

6.7.1

General purpose IO input

The following routine can be used to read the TIO0 input pin:

movep #$02000000,X:TCSR0

;clear TC2-TC0, set GPIO

;and clear INV for GPIO input

here

jset #22,x:TCSR0,here

; spin here until TIO0 is set

......