
Functional Description
MC68HC812A4 Data Sheet, Rev. 7
Freescale Semiconductor
123
Setting a force output compare bit, FOCx, causes an immediate output compare on channel x. A forced
output compare does not set the channel flag.
An output compare on channel 7 overrides output compares on all other output compare channels. A
channel 7 output compare causes any unmasked bits in the output compare 7 data register to transfer to
the timer port data register. The output compare 7 mask register masks the bits in the output compare 7
data register. The timer counter reset enable bit, TCRE, enables channel 7 output compares to reset the
timer counter. A channel 7 output compare can reset the timer counter even if the OC7/PAI pin is being
used as the pulse accumulator input.
An output compare overrides the data direction bit of the output compare pin but does not change the
state of the data direction bit.
Writing to the timer port bit of an output compare pin does not affect the pin state. The value written is
stored in an internal latch. When the pin becomes available for general-purpose output, the last value
written to the bit appears at the pin.
12.4.4 Pulse Accumulator
The pulse accumulator (PA) is a 16-bit counter that can operate in two modes:
Event counter mode — Counting edges of selected polarity on the pulse accumulator input pin, PAI
Gated time accumulation mode — Counting pulses from a divide-by-64 clock
The PA mode bit, PAMOD, selects the mode of operation.
The minimum pulse width for the PAI input is greater than two module clocks.
12.4.4.1 Event Counter Mode
Clearing the PAMOD bit configures the PA for event counter operation. An active edge on the PAI pin
increments the PA. The PA edge bit, PEDGE, selects falling edges or rising edges to increment the PA.
An active edge on the PAI pin sets the PA input flag, PAIF. The PA input interrupt enable bit, PAI, enables
the PAIF flag to generate interrupt requests.
NOTE
The PAI input and timer channel 7 use the same pin. To use the PAI input,
disconnect it from the output logic by clearing the channel 7 output mode
and output level bits, OM7 and OL7. Also clear the channel 7 output
compare 7 mask bit, OC7M7.
The PA counter registers, TIMPACNTH/L, reflect the number of active input edges on the PAI pin since
the last reset.
The PA overflow flag, PAOVF, is set when the PA rolls over from $FFFF to $0000. The PA overflow
interrupt enable bit, PAOVI, enables the PAOVF flag to generate interrupt requests.
NOTE
The PA can operate in event counter mode even when the timer enable bit,
TE, is clear.