Motorola DSP96002 User Manual page 827

32-bit digital signal processor
Table of Contents

Advertisement

6.7.4
Pulse width measurement mode (mode 4)
The following program illustrates the use of the timer module for input pulse width mea-
surement. The width is measured in this example for the low active period of the input
pulse on the TIO1 pin and is stored in a table (in multiples of the chip operating clock di-
vided by 2).
org x:$100
pulse_width
ds
org p:$16
; this is timer1 interrupt vector address
movep x:TCR1,x:(r0)+
nop
....
org p:main_body
.....
move #pulse_width,r0
move #$ff,m0
movep #$70000000,x:TCSR1
bset #26,x:IPR
andi #$cf,mr
bset #31,x:TCSR1
......
; do other tasks
.....
MOTOROLA
; define buffer in X memory internal
$100
; measure up to 256 pulses
; store width value in table
; second word of the short interrupt
; r0 points to start of table
; modulo 100 to wrap around on end of table
; enable timer interrupts, mode 4 and set INV
; to measure the low active pulse
; enable IPL for timer 1
; remove interrupt masking in status register
; timer enable
45

Advertisement

Table of Contents
loading

Table of Contents