Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
34
Добавлен:
27.04.2015
Размер:
1.98 Mб
Скачать

Timer Programming Model

The timer control bits are defined in Section 9.1.1.1, “Timer Enable (TE)—Bit 15, Bit 7,” through Section 9.1.1.6, “Reserved TCR Bits.”

9.1.1.1 Timer Enable (TE)—Bit 15, Bit 7

The timer enable (TE) control bit (bit 7 in TCR01 for Timer 0, bit 15 in TCR01 for Timer 1, or bit 7 in TCR2 for Timer 2) is used to enable or disable the timer. Setting the TE bit to one enables the timer. The counter starts decrementing from its preset value each time an event comes in. Clearing the TE bit disables the timer. The count register is not affected by this operation. However, if a direct write to the count register occurs after the last count register reload, the value written is loaded into the count register instead of the preload value. The TE bit is cleared by reset.

9.1.1.2 Invert (INV)—Bit 6

When the invert (INV) control bit (bit 6 in TCR01 for the TIO01 pin, or bit 6 in TCR2 for the TIO2 pin) is set, the external signal coming in the TIO pin (TIO01 or TIO2, depending on which register has its INV bit set) is inverted before being synchronized and entering the 16-bit counter. All one-to-zero transitions of the TIO pin then decrement the 16-bit counter. When the INV bit is cleared, the external signal on TIO is not inverted and the 16-bit counter is decremented on all zero-to-one transitions. The INV bit is cleared on reset. See Table 9-2.

 

Table 9-2. INV Bit Definition

 

 

 

INV

 

External Event on TIO Pin

 

 

 

 

 

 

0

 

Detects rising edges

 

 

 

1

 

Detects falling edges

 

 

 

9.1.1.3 Overflow Interrupt Enable (OIE)—Bit 12, Bit 4

When the overflow interrupt enable (OIE) control bit (bit 4 in TCR01 for Timer 0, bit 12 in TCR01 for Timer 1, or bit 4 in TCR2 for Timer 2) is set, an interrupt is requested to the DSP56824 at the next event after the count register reaches zero. When the OIE bit is cleared, the interrupt is disabled and any pending interrupts are cleared. The OIE bit can be individually set for each timer, selectively enabling the interrupt capability independently for each timer. The OIE bit is cleared on reset.

As with all on-chip peripheral interrupts for the DSP56824, the status register (SR) must first be set to enable maskable interrupts (interrupts of level IPL 0). Next, the CH4 bit (bit 11) in the IPR (see

Section 3.3.1, “DSP56824 Interrupt Priority Register (IPR),” on page 3-14) must also be set to enable this interrupt. Table 9-3 lists the interrupt vectors for the three timers.

Table 9-3. Timer Interrupt Vectors

Timer

Interrupt Vector

Interrupt Priority

 

 

 

 

 

 

0

$0018

0

 

 

 

1

$001A

0

 

 

 

2

$001C

0

 

 

 

Timers 9-5

Соседние файлы в папке DSP568xx