
MOTOROLA
10-28
MAIN TIMER AND REAL-TIME INTERRUPT
M68HC11
REFERENCE MANUAL
amount of time to respond to the event, the time at which it took place was latched (re-
corded), thus eliminating uncertainty due to software latency. Now software can read
the timer counter to determine the present timing relationship between the program
and when the event occurred. Better yet, an output-compare function can be set up to
produce the desired output signal action at another specific value of the timer counter
(i.e., at another specific time relative to the input event). Since both the input event and
the output action are referenced to the same timer counter, the resolution of the
counter determines the worst-case uncertainty in the timing relationship. Although
software latency still determines the minimum controllable delay between the input
event and the output action, it no longer influences the accuracy of the timing relation-
ship.
10.3.7 Other Uses for Input-Capture Pins
At any time, software can read the logic levels on the pins used for input-capture func-
tions (even if the input-capture function is enabled). These three pins may also be
used as flexible interrupt input pins when the timer input-capture functions are not
needed. Each of these pins can be used as a separate edge-triggered interrupt with
its own interrupt vector. The significant edge(s) can be individually selected by the
control bits in the TCTL2 register. An important advantage of these interrupt pins over
the IRQ pin is that these interrupts can be enabled/disabled with the local interrupt en-
able bits (ICxI) in the TMSK1 register. Another advantage of these pins is that there is
a readable status indicator (ICxF) so software can tell if an interrupt request is pending
from these sources. Software can also choose to clear any pending interrupt from one
of these sources before enabling it. As with all maskable interrupt sources, interrupts
can be disabled from these pins by setting the I bit in the CCR in the CPU.
10.4 Output-Compare Functions
Rather than being specifically configured to perform a single function, such as vari-
able-frequency square-wave generation, the output-compare functions in the
MC68HC11A8 are configured and controlled by software-accessible control registers
and bits so they can perform a wide variety of tasks. Although some software overhead
exists for some common timing functions, such as pulse-width modulation (PWM) sig-
nals, these software-controlled output-compare functions are easily adaptable to a
much wider range of applications than dedicated timer functions would be.
There are five output-compare functions in the MC68HC11A8. Each output compare
has a 16-bit compare register and a dedicated 16-bit comparator. The comparator
checks the free-running timer value against the 16-bit compare register during every
timer count. When a match is detected, a status flag is set (OCxF), an interrupt is op-
tionally generated, and timer output pins are automatically changed according to soft-
ware-accessible control bits. Since each of the five interrupts is separately maskable
with a local interrupt enable control bit and since each has its own interrupt vector,
there is no need to perform any software polling to determine the cause of an interrupt.
Four of the output compares operate much like the output compares on the M6801
Family of MCUs except that the M68HC11 has more output-compare channels and
has slightly more control over the timer output pins. The fifth output compare on the