Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Сигнальный МП Motorola DSP56002.pdf
Скачиваний:
22
Добавлен:
26.05.2014
Размер:
2 Мб
Скачать
☆

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SOFTWARE EXAMPLES

BSET

#DO,X:TCSR

;set TIO to signal end of task

BCLR

#DO,X:TCSR

;clear TIO

RTI

 

;return to main program

7.8.4Pulse Width Measurement Mode (Timer Mode 4)

The following program illustrates the usage of the timer module for input pulse width measurement. The width is measured in this example for the low active period of the input pulse on the TIO pin and is stored in a table (in multiples of the chip operating clock divided by 2).

ORG

X:$100

;define buffer in X memory internal

pulse_width DS

$100

;measure up to 256 pulses

ORG

P:$3C

;this is timer interrupt vector address

MOVEP X:TCR,X:(r0)+

;store width value in table

NOP

 

;second word of the short interrupt

....

 

 

ORG

P:MAIN_BODY

 

.....

 

 

MOVE

#PULSE_WIDTH,r0 ;r0 points to start of table

MOVE

#$FF,M0

;modulo 100 to wrap around on end of table

MOVEP #$000026,X:TCSR

;enable timer interrupts, mode 4 and set INV

 

 

;to measure the low active pulse

BSET

#IPL,X:IPR

;enable IPL for timer

ANDI

#$CF,MR

;remove interrupt masking in status register

BSET

#TE,X:TCSR

;timer enable

......

 

 

; do other tasks

 

 

.....

 

 

7.8.5Period Measurement Mode (Timer Mode 5)

The following program illustrates the usage of the timer module for input period measurement. The period is measured in this example between 0 to 1 transitions of the input signal on TIO and is stored in a table (in multiples of the chip operating clock divided by 2).

 

ORG

X:$100

;define buffer in X memory internal

period

DS

$100

;measure up to 256 pulses

temp

DS

$1

;temporary storage

MOTOROLA DSP56002 TIMER AND EVENT COUNTER 7 - 21

For More Information On This Product, Go to: www.freescale.com

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SOFTWARE EXAMPLES

 

 

 

 

 

 

ORG

P:$3C

;this is timer interrupt vector address

 

 

JSR

MEASURE

;long interrupt to measure period

 

 

....

 

 

 

 

ORG

P:MAIN_BODY

 

 

 

.....

 

 

 

 

MOVE

#0,X:TEMP

;clear temporary storage

 

 

MOVE

#PERIOD,r0

;r0 points to start of table

 

 

MOVE

#$FF,M0

;modulo 100 to wrap around on end of table

 

 

MOVEP #$00002A,X:TCSR

;enable timer interrupts, mode 5

 

 

BSET

#IPL,X:IPR

;enable IPL for timer

 

 

ANDI

#$CF,MR

;remove interrupt masking in status register

 

 

BSET

#TE,X:TCSR

;timer enable

 

 

......

 

 

 

 

; do other tasks

 

 

 

 

.....

 

 

 

 

measure

 

 

 

 

MOVEP X:TCR,A

;read new counter value

 

 

MOVE

X:TEMP,X0

;retrieve former read value (initially zero)

 

 

SUB

X0,A A,X:TEMP

;compute delta (i.e. new -old) and store the

 

 

 

 

;new read value in temp

 

 

MOVE

A,X:(R0)+

;store period value in table

 

 

RTI

 

 

 

 

 

 

 

 

 

 

 

 

 

7 - 22 DSP56002 TIMER AND EVENT COUNTER MOTOROLA

For More Information On This Product, Go to: www.freescale.com

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

APPENDIX A

BOOTSTRAP

AND

ROM CODE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0100101001011010

1010101010110110

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

0

0

 

 

 

 

 

1

 

1

 

 

 

0

 

0

00

 

 

 

0

 

1010101010010111

0101001010010111

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1000101010100100

0100010101011101

 

 

 

 

 

0

 

 

 

 

 

 

 

1

 

 

 

 

0

 

 

 

 

 

 

0

 

 

1

 

 

 

 

0

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1010100011010101

1001011001110100

 

 

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0100101001011010

1010101010110110

 

 

 

 

10

 

 

 

 

01001010010110101

 

 

 

 

1

 

 

 

 

0101001010010111

 

 

 

 

0

 

 

 

 

10101010101101101010101010010111

 

 

 

 

 

 

 

 

 

 

 

 

1

0

0

 

 

 

 

 

 

 

0

0

1

 

 

 

 

1

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1010101010010111

01010010100101111000101010100100

0100010101011101

 

 

 

 

 

1011011101101

10110100010101010101010010

01000101010

 

10010110011101000

 

 

 

 

 

 

 

 

0

 

 

0

 

 

1

 

 

 

 

10101000110101011

 

 

 

 

 

01011010110101010100011010101110 1010

100101100110100101001011010

1010101010110110

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

1

0

 

 

1

 

 

 

 

 

 

 

1010010101010010101010010101010

10101010101101101010101010010111

0101001010010111

 

 

 

 

 

 

 

 

1

 

 

 

01001010010110100

 

 

 

 

 

0101010101010101010000010101100

01010010100101111000101010100100

0100010101011101

 

 

 

 

 

0

 

1

 

 

 

1010101010010111

 

 

 

 

 

 

 

 

 

 

 

 

10001010101001000

010001010101110110101000110101011

1001011001110100

 

 

 

 

 

0100101001011010

 

1010101010110110

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1010100011010101

100101

 

1000101010100100

0100010101011101

 

 

 

 

 

1010101010010111

1

0101001010010111

010110111011010011010010101

 

 

 

 

100010101010

 

0100101001011010

10101010101101101010100011010101

1001011001110100

 

 

 

 

 

 

100

1

0100010101011101

01010

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

101101110110100110100101011010100011010101 1001011001110100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1010101010010111

0101001010010111

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1000101010100100

 

 

 

 

 

 

 

 

 

 

 

 

01010

 

 

 

0100010101011101

 

 

 

 

 

 

 

 

 

 

1010100011010101

1001011001110100

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1000101010100100 0100010101011101

10110111011010011010010101

1010100011010101 1001011001110100

01010

MOTOROLA

A - 1

For More Information On This Product,

Go to: www.freescale.com

Freescale Semiconductor, Inc.

SECTION CONTENTS

A.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3

Freescale Semiconductor, Inc.

A - 2 BOOTSTRAP AND ROM CODE MOTOROLA

For More Information On This Product, Go to: www.freescale.com

Соседние файлы в предмете Радиоприемные устройства