108/317
5 - Peripherals
05-intof
The interrupt service routine must clear the TOF bit before returning, using the sequence de-
scribed above. No automatic clearing is performed by the interrupt service mechanism.
5.5.3 Input capture operation
The counter, as discussed above, can be read on-the-fly by the program. This is not what the
capture feature means here.
Note before continuing: each 16-bit timer has two capture channels, 1 and 2. In the following
text, the letter i in the register names must be replaced by 1 or 2 accordingly.
The capture feature is a mechanism that takes a snapshot of the counter value at the time of
the transition of an external signal applied to a pin. The capture mode is always enabled; the
ICAPipin is shared with a parallel input-output port pin, and that port must be configured with
the corresponding pin as an input to be able to use the capture input.
The IEDGi bit in the Timer Control Register 1 selects either the rising or the falling edge of the
ICAPi pin as the active transition. When the transition occurs, the ICiHR-ICiLR pair contains
the value of the counter at the time of the transition, plus one.
The capture event also sets the ICFi bit in the TSR register, and that bit can produce an inter-
rupt request if the ICIE mask bit in the TCR1 register is set.
TOF interrupt mechanism
TOF
FFFFh - 0000h (counter)
Timer status register (TSR)
I
Condition code
register (CCR)
TOIE
Timer control register 1 (TCR1)
Timer overflow
interrupt to the core
TOIE : Timer overflow enable bit (bit 7 of TCR1)
TOF : Timer overflow bit
(bit 5 of TSR)
I
: Global interrupt enable bit (bit 3 of CCR)
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...