M68HC11
REFERENCE MANUAL
MAIN TIMER AND REAL-TIME INTERRUPT
MOTOROLA
10-17
The latching action of an input-capture function occurs every time a selected edge is
detected on the corresponding timer input pin (even if the corresponding input-capture
flag is already set). This means that the value read from the input-capture register cor-
responds to the most recent edge at the pin, which may not be the edge that caused
the input-capture flag to be set. In a few applications, there could be a number of close-
ly spaced edges (i.e., an unfiltered bouncing switch contact). In cases where these ex-
tra captures are undesirable, software can write to the edge-select control bits to
inhibit further captures until after the current capture has been handled.
The following registers and paragraphs explain the input-capture status flags and the
local interrupt enable control bits for the input-capture functions.
ICxI, ICxF — Input Capture Interrupt Enables and Input Capture Flags (x = 1, 2, or 3)
The ICxF status bit is automatically set to one each time a selected edge is detected
at the corresponding input-capture pin. This status bit is cleared by writing to the
TFLG1 register with a one in the corresponding data bit position. The ICxI control bit
allows the user to configure each input-capture function for polled or interrupt-driven
operation but does not affect the setting or clearing of the corresponding ICxF bit.
When ICxI is zero, the corresponding input-capture interrupt is inhibited, and the input
capture is operating in a polled mode. In this mode, the ICxF bit must be polled (read)
by user software to determine when an edge has been detected. When the ICxI control
bit is one, a hardware interrupt request is generated whenever the corresponding ICxF
bit is set to one. Before leaving the interrupt service routine, software must clear the
ICxF bit by writing to the TFLG1 register (see
10.2.4 Tips for Clearing Timer Flags
).
10.3.1 Programmable Options
The user can program each input-capture function to detect a particular edge polarity
on the corresponding timer input pin. A pair of control bits (EDGXB, EDGxA) in the tim-
er control register 2 (TCTL2) are used to select the edge(s) detected by each input-
capture function.
TMSK1 —
Timer Interrupt Mask 1 Register
$1022
BIT 7
OC1I
0
6
5
4
3
2
1
BIT 0
IC3I
0
OC2I
0
OC3I
0
OC4I
0
OC5I
0
IC1I
0
IC2I
0
RESET:
TFLG1 —
Timer Interrupt Flag 1 Register
$1023
BIT 7
OC1F
0
6
5
4
3
2
1
BIT 0
IC3F
0
OC2F
0
OC3F
0
OC4F
0
OC5F
0
IC1F
0
IC2F
0
RESET:
TCTL2 —
Timer Control Register
$1021
BIT 7
0
0
6
0
0
5
4
3
2
1
BIT 0
EDG3A
0
EDG1B
0
EDG1A
0
EDG2B
0
EDG2A
0
EDG3B
0
RESET: