Motorola DSP96002 User Manual

Page 826

Advertising
background image

44

MOTOROLA

6.7.2

General purpose IO output

The following routine can be used to write the TIO1 output pin:

movep #$02800000,x:TCSR1

;clear TC2-TC0, set GPIO

;and set DIR for GPIO output, set TIO1 to 0

movep #$02a00000,x:TCSR1

; set TIO1 to 1

movep #$02800000,x:TCSR1

; set TIO1 to 0

This routine generates a pulse on the TIO1 pin with the duration equal to 8 CLK (assuming
no wait states, no external bus conflict etc.)

6.7.3

Standard timer mode (mode 0), input clock, no output and GPIO output

The following program illustrates the standard timer mode with simultaneous GPIO. The
timer is used to activate an internal task after 65536 clocks; at the end of the task the TIO0
pin is toggled to signal end of task.

org p:$14

; this is timer 0 interrupt vector address

jsr task

; go and execute task (long interrupt)

....

org p:main_body

.....

movep #$42000000,x:TCSR0

; enable timer interrupts and enable GPIO

; (input!) and set DO =0 to have stable data

movep #$42800000,x:TCSR0

; change DIR to output (clean 0, no spikes)

movep #$0000ffff,x:TCR0

; load 64k -1 into the counter

bset #24,x:IPR

; enable IPL for timer 0

andi #$cf,mr

; remove interrupt masking in status register

bset #31,x:TCSR0

; timer enable

......

; application program

.....

task

.....

; task instructions

....

end_of_task

bset #22,x:TCSR0

; set TIO0 to signal end of task

bclr #22,x:TCSR0

; clear TIO0

rti

; return to main program

Advertising