
M68HC11
REFERENCE MANUAL
MAIN TIMER AND REAL-TIME INTERRUPT
MOTOROLA
10-35
10.4.2 Advanced I/O Pin Control Using OC1
One of the five output-compare functions (OC1) in the MC68HC11A8 has special timer
output pin controls that were not present on any previous Motorola MCUs. These new
controls allow this output-compare function to simultaneously control the states of up
to five output pins. This output compare can also be configured to control a pin or pins
that are also being controlled by one of the other four output-compare functions.
OC1 uses the OC1M and the OC1D to control the automatic timer output pin actions
occurring as a result of a match between the OC1 register and the free-running timer.
Each of the five MSBs of these registers corresponds bit-for-bit with a port A output
pin. The three remaining low-order bits of these registers are not used and always read
as zeros. For each port A output pin to be affected by OC1, the user would set the cor-
responding bit of OC1M. When a successful OC1 compare occurs, each port A pin to
be affected (indicated by the corresponding bit of OC1M set) will assume the value of
the corresponding bit of OC1D. Values of bits in OC1D corresponding to zeros in the
OC1M register are don’t cares. Usually, the user only has to write to the OC1M register
once to establish which pins will be controlled by OC1. The relationship between reg-
ister bits and port A pins is provided in the reference below the following registers:
OC1 can only affect the PA7 pin if the pin is configured as an output as opposed to its
default configuration as an input. To configure PA7 as an output, the data direction
control bit for port A bit 7 (DDRA7) in the pulse accumulator control register (PACTL)
must be set to one.
10.4.2.1 One Output Compare Controlling up to Five Pins
The special pin control mechanisms on OC1 allow it to simultaneously control as many
as five timer output pins. (Software can be used to allow any single output compare to
control multiple outputs, but software latency will affect the resolution and the ability to
repeat timed actions accurately.) The OC1 mechanism allows pins to be controlled
with a timing accuracy equal to one count of the timer counter.
The ability to control multiple outputs with a single output-compare channel is espe-
cially useful where the outputs are all associated with a single external device — for
example, the signals driving a stepper motor. In such a case, it is always possible to
know the required state for all of the outputs whenever any one is going to change. On
OC1M —
Output Compare 1 Mask
$100C
BIT 7
OC1M7
0
6
5
4
3
2
0
0
1
0
0
BIT 0
0
0
OC1M6
0
OC1M5
0
OC1M4
0
OC1M3
0
RESET:
OC1D —
Output Compare 1 Data
$100D
BIT 7
OC1D7
0
6
5
4
3
2
0
0
1
0
0
BIT 0
0
0
OC1D6
0
OC1D5
0
OC1D4
0
OC1D3
0
RESET:
REFERENCES: PA7/PA1 PA6/OC2 PA5/OC3 PA4/OC4 PA3/OC5 PA2/IC1 PA1/IC2 PA0/IC3