
M68HC11
REFERENCE MANUAL
PARALLEL INPUT/OUTPUT
MOTOROLA
7-5
this port C latch are connected to the port C pins, and the latches are clocked when a
selected edge is recognized at the STRA pin. Contrary to first impressions, writes to
PORTCL do not change the data in the port C latch register. Instead, writes to
PORTCL are used as an alternate way to write data to port C. In addition to writing
data to the port C output latches, writes to PORTCL also trigger special handshake
sequences in the handshake I/O subsystem, which allows some port C pins to be
treated as general-purpose outputs while others are being used for full-handshake
outputs. A user would write data to PORTC to change the non-handshake pins in port
C. To change the data on a full-handshake pin of port C, the user would write to
PORTCL.
7.2.2 Data Direction Registers
These registers and control bits are used to specify the primary direction of data flow
at each bidirectional port pin. A zero in a data direction register (DDR) bit disables the
output buffer for that pin so the pin is configured as an input. When a DDR bit is set to
one, it enables the output driver for the associated port pin so the pin is configured as
an output. During reset, internal logic in the MC68HC11A8 forces all DDR bits to zero;
thus, all bidirectional I/O pins are configured as high-impedance inputs until they are
reconfigured by software.
In some cases, an enabled on-chip subsystem can override the DDR bit and force a
pin to be an input or an output. For example, it is illogical for the TxD pin to be config-
ured as an input while the SCI transmitter is using this pin. Whenever the SCI trans-
mitter subsystem is enabled, the TxD pin is configured as an output, regardless of
what the corresponding DDRD bit is. There is a subtle benefit to this override besides
the obvious savings gained by not having to write to the DDR. Depending on the over-
all system attached to the TxD pin, it may be desirable for this pin to revert to a specific
driven logic level or to a high-impedance condition. If the DDR bit is zero, the TxD pin
will revert to a general-purpose, high-impedance input pin when not being used by the
transmitter. If the DDR bit is one, the TxD pin will revert to a general-purpose output
pin, and the driven logic level will reflect what was last written to bit 1 of port D.
In other cases, the DDR bits continue to affect the configuration of a port pin even after
an on-chip subsystem has been enabled to use the pin. Consider the SPI bidirectional
data pins master in/slave out (MISO) and master out/slave in (MOSI). Although the
MC68HC11A8 SPI system is capable of full-duplex operation, some synchronous se-
rial protocols are configured for half-duplex operation with a single, bidirectional data
line. For the MC68HC11A8 to operate in such a system, it must be able to selectively
disable its MOSI and MISO outputs.
The state of a DDR bit influences the source of data when the corresponding port bit
is read. In general, when a pin is configured as an input, reads return the logic level
from the pin itself. When a pin is configured as an output, reads return a value corre-
sponding to the level at the inside of the output buffer for that pin. This fact is especially
important in the case of pins configured for wired-OR operation or for the three-state
variation of full-output handshake at port C. In these cases, the value at the pin itself
does not necessarily reflect the value last written to the port; therefore, it is important
to read the level inside the output buffer rather than the level at the pin.