
MOTOROLA
10-16
MAIN TIMER AND REAL-TIME INTERRUPT
M68HC11
REFERENCE MANUAL
edge-detection logic includes control bits so that user software can select the edge po-
larity that will be recognized. Each of the three input-capture functions can be indepen-
dently configured to detect rising edges only, falling edges only, or any edge (rising or
falling). The interrupt generation logic includes a status flag, which indicates that an
edge has been detected, and a local interrupt enable bit, which determines whether or
not the corresponding input-capture function will generate a hardware interrupt re-
quest. If the interrupt request is inhibited, the input capture is operating in polled mode
where software must read the status flag to recognize that an edge was detected.
Input-capture edges are generally asynchronous to the internal timer counter, which
is clocked relative to the PH2 clock. These asynchronous capture requests are then
synchronized to PH2 so that the actual latching will occur on the opposite half cycle of
PH2 from when the timer counter is being incremented. This synchronization process
introduces a delay from when the actual edge occurs to when the counter value is
latched. In almost all cases, this very short delay should be ignored. When the time
between two edges is being measured, both edges are subject to the same delay;
therefore, these delays will offset each other. When an input capture is being used in
conjunction with an output compare, there will be a similar delay between the actual
compare point and when the output pin actually changes state. When a prescale factor
other than one is being used, the capture delay is smaller than the uncertainty due to
timer resolution. Detailed information about timer system delays is given in
10.5 Tim-
ing Details For The Main Timer System
. The central element of each input-capture
function is the input-capture latch, which can be read by software as a pair of 8-bit reg-
isters (see the following input-capture registers). The TLCx registers are not affected
by reset and cannot be written by software. When an edge has been detected and syn-
chronized, the 16-bit free-running counter value is transferred into the input-capture
register pair as a single 16-bit parallel transfer. Timer-counter value captures and tim-
er-counter incrementing occur on opposite half cycles of the PH2 clock so that the
count value is stable whenever a capture occurs. The input-capture functions operate
independently of each other, and all three functions can capture the same 16-bit count
value if the input edges are all detected within the same timer count cycle.
A read of the high-order byte of an input-capture register pair inhibits a new capture
transfer for one bus cycle. As long as a double-byte read instruction such as load D
(LDD) is used to read input-capture values, the user is assured that the two bytes be-
long with each other. If a new input-capture occurs so that a transfer would have oc-
curred immediately after the high-byte read, it will be delayed for one more cycle but
will not be lost.
Bit 7
Bit 15
Bit 7
6
—
—
5
—
—
4
—
—
3
—
—
2
—
—
1
—
—
Bit 0
Bit 8
Bit 0
$1010
$1011
TIC1
$1012
$1013
Bit 15
Bit 7
—
—
—
—
—
—
—
—
—
—
—
—
Bit 8
Bit 0
TIC2
$1015
Bit 7
—
—
—
—
—
—
Bit 0