SOFTWARE EXAMPLES
7 - 20
DSP56002 TIMER AND EVENT COUNTER
MOTOROLA
MOVEP
#$000042,X:TCSR ;enable timer interrupts and enable GPIO
; (input!) and set DO =0 to have stable data
BSET
#DIR,X:TCSR
;change DIR to output (clean 0, no spikes)
MOVEP
#$00FFFF,X:TCR
;load 64k -1 into the counter
BSET
#IPL,X:IPR
;enable IPL for timer
ANDI
#$CF,MR
;remove interrupt masking in status register
BSET
#TE,X:TCSR
; timer enable
......
; application program
.....
task
.....
; task instructions
....
end_of_task
TE
TCR
Write Preload (N)
TIO (Event)
N
Counter
N
0
N
Interrupt
First Event
Last Event
N-1
Figure 7-15 Standard Timer Mode, External Clock (INV=1)
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
.
..