MOTOROLA
11-2
PULSE ACCUMULATOR
M68HC11
REFERENCE MANUAL
The free-running E divided by 64 clock is a tap off the main timer clocking chain (see
10.2.1 Overall Clock Divider Structure
and
Figure 10-3
). In general, any signal ap-
plied to the PAI pin is asynchronous to this E divided by 64 clock; therefore, the first
count could occur anywhere between zero and 64 E clocks after the PAI pin goes to
the chosen active level.
User software can enable the pulse accumulator system, select its mode, and deter-
mine the polarity of signals recognized at the PAI pin. Two separate interrupts are as-
sociated with the pulse accumulator system: one is generated by detection of a
selected edge at the PAI pin; the other is generated when the 8-bit counter rolls over
from $FF to $00 (overflow). Each of these interrupt sources has its own local enable
bit and its own interrupt vector; thus, no software polling is required to determine the
cause of any pulse accumulator interrupts.
11.1.1 Pulse Accumulator Block Diagram
Figure 11-2
is a functional block diagram of the pulse accumulator subsystem. The
central element of this system is an 8-bit up-counter that can be read or written at any
time. The pulse accumulator enable (PAEN) control bit enables/disables this 8-bit
counter. The pulse accumulator mode (PAMOD) bit selects the clock source to this
counter. In the event counting mode, the clock is the output of the edge detector of the
PAI pin. In the gated time accumulation mode, the clock is a free-running, internal E
divided by 64 clock ANDed (gated) with the active level of the PAI pin. The pulse ac-
cumulator edge select (PEDGE) bit controls the polarity of signals on the PAI pin that
will be recognized by the pulse accumulator system. The pulse accumulator overflow
interrupt enable (PAOVI) bit determines whether or not a pulse accumulator overflow
interrupt flag (PAOVF) will generate hardware interrupt requests. The pulse accumu-
lator input edge interrupt enable (PAII) bit determines whether or not detected edges
at the PAI pin will cause the pulse accumulator input flag (PAIF) to be set (generating
hardware interrupt requests). In addition to the PAII and PAOVI local interrupt enables,
these interrupts are subject to masking by the I bit in the condition code register in the
central processing unit (CPU). For additional information about interrupts, refer to
SECTION 5 RESETS AND INTERRUPTS
.
The input buffer on the PAI pin is always connected from the pin to the pulse accumu-
lator and port A read logic, but the output buffer is enabled or disabled by the data di-
rection control bit (DDRA7) in the pulse accumulator control (PACTL) register.
Normally, when the pulse accumulator is being used, the PAI pin is configured as a
high-impedance input (DDRA7 = 0), but it is possible for software or the main timer (by
way of output compare 1) to directly control the pulse accumulator by setting DDRA7
equal to one (output). A detailed transistor-level schematic of this pin logic is shown in
Table 11-1 Pulse Accumulator Timing Periods vs. Crystal Rate
2.1 MHz
2
23
Hz
8 MHz
4 MHz
Formula:
477 ns
30.52
μ
s
32
μ
s
64
μ
s
64(E Period)
7.81 ms
2 MHz
1 MHz
500 ns
1
μ
s
8.19 ms
16.38 ms
16,384(E Period)