Motorola DSP96002 User Manual page 828

32-bit digital signal processor
Table of Contents

Advertisement

6.7.5
Period measurement mode (mode 5)
The following program illustrates the usage of the timer module for input period measure-
ment. The period is measured in this example between 0 to 1 transitions of the input signal
on TIO0 and is stored in a table (in multiples of the chip operating clock divided by 2).
org x:$100
period
ds
temp
ds
org p:$14
jsr measure
....
org p:main_body
.....
move #0,x:temp
move #period,r0
move #$ff,m0
movep #$54000000,x:TCSR0
bset #26,x:IPR
andi #$cf,mr
bset #31,x:TCSR0
......
; do other tasks
.....
measure
movep x:TCR0,d0.l
move x:temp,d1.l
sub d1.l,d0.l
move d0.l,x:(r0)+
rti
46
; define buffer in X memory internal
$100
; measure up to 256 pulses
$1
; temporary storage
; this is timer0 interrupt vector address
; long interrupt to measure period
; clear temporary storage
; r0 points to start of table
; modulo 100 to wrap around on end of table
; enable timer interrupts, mode5
; enable IPL for timer 1
; remove interrupt masking in status register
; timer enable
; read new counter value
; retrieve former read value (initially zero)
d0.l,x:temp
; compute delta (i.e. new -old) and store the
; new read value in temp
; store period value in table
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents