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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SOFTWARE EXAMPLES

•If the TCR is loaded with 0, and the counter contained a zero value prior to loading, then after the timer is enabled, it will generate an interrupt for every event.

•If the TCR is loaded with 0 after the timer has been enabled, the timer will be loaded with 0 when the current count is completed and then generate an interrupt for every new event.

7.8SOFTWARE EXAMPLES

7.8.1General Purpose I/O Input

The following routine can be used to read the TIO input pin:

MOVEP

#$000040,X:TCSR

;clear TC2-TC0, set GPIO

 

 

;and clear INV for GPIO input here

Write Preload (N)

First Event

Last Event

TE

TIO (Event)

TCR

N

N+1

FFFF

0

 

 

Counter

N

N+1

FFFF 0

Interrupt

Figure 7-12 Standard Time Counter Mode, External Clock (INV=0)

MOTOROLA DSP56002 TIMER AND EVENT COUNTER 7 - 17

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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SOFTWARE EXAMPLES

JSET

#DI,X:TCSR,here

;spin here until TIO is set

7.8.2General Purpose I/O Output

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

MOVEP

#$000140,X:TCSR

;clear TC2-TC0, set GPIO and

 

 

;set DIR for GPIO output, set TIO to 0

BSET

#DO,X:TCSR

;set TIO to 1

NOP

 

 

Write Preload (N)

First Event

Last Event

TE

TIO (Event)

TCR

N

N+1

FFFF 0

 

 

 

 

 

 

 

Counter

N

N+1

FFFF

0

 

 

 

 

Interrupt

Figure 7-13 Standard Timer Mode, External Clock (INV=1)

7 - 18 DSP56002 TIMER AND EVENT COUNTER MOTOROLA

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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SOFTWARE EXAMPLES

NOP

 

 

BCLR

#DO,X:TCSR

;set TIO to 0

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

7.8.3Timer Mode 0, Input Clock, GPIO Output, and No Timer 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 TIO pin is toggled to signal end of task.

ORG

P:$3C

;this is timer interrupt vector address

JSR

TASK

;go and execute task (long interrupt)

ORG

P:MAIN_BODY

 

 

Write Preload (N)

First Event

Last Event

TE

TIO (Event)

TCR N

Counter

N

N-1

0

N

Interrupt

Figure 7-14 Standard Timer Mode, External Clock (INV=0)

MOTOROLA DSP56002 TIMER AND EVENT COUNTER 7 - 19

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

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc.

SOFTWARE EXAMPLES

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

 

 

 

 

Write Preload (N)

First Event

Last Event

TE

TIO (Event)

TCR N

Counter

N

N-1

0

N

Interrupt

Figure 7-15 Standard Timer Mode, External Clock (INV=1)

7 - 20 DSP56002 TIMER AND EVENT COUNTER MOTOROLA

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

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