
MC68HC11P2
MOTOROLA
8-7
TIMING SYSTEM
8
8.2.3
TI4/O5 — Timer input capture 4/output compare 5 register
Use TI4/O5 as either an input capture register or an output compare register, depending on the
function chosen for the PA3 pin. To enable it as an input capture pin, set the I4/O5 bit in the pulse
accumulator control register (PACTL) to logic level one. To use it as an output compare register,
The TI4/O5 register pair resets to ones ($FFFF).
8.3
Output compare
Use the output compare (OC) function to program an action to occur at a specic time — when
the 16-bit counter reaches a specied value. For each of the ve output compare functions, there
is a separate 16-bit compare register and a dedicated 16-bit comparator. The value in the compare
register is compared to the value of the free-running counter on every bus cycle. When the
compare register matches the counter value, an output compare status ag is set. The ag can be
used to initiate the automatic actions for that output compare function.
To produce a pulse of a specic duration, write a value to the output compare register that
represents the time the leading edge of the pulse is to occur. The output compare circuit is
congured to set the appropriate output either high or low, depending on the polarity of the pulse
being produced. After a match occurs, the output compare register is reprogrammed to change
the output pin back to its inactive level at the next match. A value representing the width of the
pulse is added to the original value, and then written to the output compare register. Because the
pin state changes occur at specic values of the free-running counter, the pulse width can be
controlled accurately at the resolution of the free-running counter, independent of software
latency. To generate an output signal of a specic frequency and duty cycle, repeat this
pulse-generating procedure.
There are four 16-bit read/write output compare registers: TOC1, TOC2, TOC3, and TOC4, and
the TI4/O5 register, which functions under software control as either IC4 or OC5. Each of the OC
registers is set to $FFFF on reset. A value written to an OC register is compared to the
free-running counter value during each E clock cycle. If a match is found, the particular output
compare ag is set in timer interrupt ag register 1 (TFLG1). If that particular interrupt is enabled
in the timer interrupt mask register 1 (TMSK1), an interrupt is generated. In addition to an interrupt,
a specied action can be initiated at one or more timer output pins. For OC[5:2], the pin action is
controlled by pairs of bits (OMx and OLx) in the TCTL1 register. The output action is taken on each
successful compare, regardless of whether or not the OCxF ag in the TFLG1 register was
previously cleared.
Address
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
State
on reset
Capture 4/compare 5 (TI4/O5) high
$001E
(bit 15)
(14)
(13)
(12)
(11)
(10)
(9)
(bit 8) 1111 1111
Capture 4/compare 5 (TI4/O5) low
$001F
(bit 7)
(6)
(5)
(4)
(3)
(2)
(1)
(bit 0) 1111 1111