M68HC11
REFERENCE MANUAL
MAIN TIMER AND REAL-TIME INTERRUPT
MOTOROLA
10-5
not necessary. Details about the implementation of the output-compare functions and
specific examples of how to use output-compare functions in the MC68HC11A8 are
included in
10.4 Output-Compare Functions
.
10.2 Free-Running Counter and Prescaler
The central element of the main timer system in the MC68HC11A8 is a 16-bit free-run-
ning counter. This counter starts from a count of $0000 as the MCU is coming out of
reset and then counts up continuously. When the maximum count is reached ($FFFF),
the counter rolls over to a count of $0000, sets an overflow flag, and continues to count
up. As long as the MCU is running in a normal operating mode, there is no way to re-
set, change, or interrupt the counting of this counter. This counter may be read at any
time to tell what time it is. All activities of the main timer system are referenced to this
one free-running counter; therefore, all timer functions have a known relationship to
each other.
The timer counter (TCNT) register is meant to be read using a double-byte read in-
struction such as load D (LDD) or load X (LDX). The low-order half of the counter pass-
es through a normally transparent buffer to the TCNT register. When the low-order half
of the counter is read using a single-byte read instruction, the value returned is simply
the value of the low-order eight bits of the main timer counter. When the high-order
byte of the TCNT register is read, the transparent buffer on the low-order byte of the
TCNT register is inhibited for one bus cycle. In the case of a double-byte read of
TCNT, the high-order byte is accessed first, which returns the high-order count value
and, at the same time, freezes the low-order count value buffer, which is read during
the next bus cycle. This procedure assures that the two bytes read from TCNT belong
with each other. The count value that is returned on a double-byte read corresponds
to the value of the free-running counter at the second-to-last cycle of the double-byte
read instruction. This and other subtle timing details related to the main timer are dis-
cussed in
10.5 Timing Details For The Main Timer System
.
10.2.1 Overall Clock Divider Structure
The following figures, registers, and paragraphs describe the major clock divider
chains for the entire MCU system. The largest chain includes the 16-bit timer counter
and its associated prescaler. Clocks for the pulse accumulator system, RTI, and COP
watchdog branch off the main timer clocking chain. The alternative to tapping these
slower clocks off the main timer chain would have been to build additional clock divider
chains, which would have used expensive chip area. These taps off the main timer
clocking chain have special circuitry to compensate for the main timer prescaler so that
the clock frequency at these taps is independent of the prescale factor. These
postscaler circuits make it practical to share portions of the timer clocking chain in a
way that still allows the rates of the various systems to be selected independent of
TCNT —
Timer Counter
$100E–$100F
BIT 7
Bit 15
Bit 7
6
5
4
3
2
1
BIT 0
Bit 8
Bit 0
$100E
$100F