XC886/888CLM
Parallel Ports
User’s Manual
6-2
V1.3, 2010-02
Parallel Ports, V 1.0
6.1
General Port Operation
shows the block diagram of an XC886/888 bidirectional port pin. Each port
pin is equipped with a number of control and data bits, thus enabling very flexible usage
of the pin. By defining the contents of the control register, each individual pin can be
configured as an input or an output. The user can also configure each pin as an open
drain pin with or without internal pull-up/pull-down device.
Each bidirectional port pin can be configured for input or output operation. Switching
between input and output mode is accomplished through the register Px_DIR
(x = 0, 1, 3, 4 or 5), which enables or disables the output and input drivers. A port pin can
only be configured as either input or output mode at any one time.
In input mode (default after reset), the output driver is switched off (high-impedance).
The actual voltage level present at the port pin is translated into a logic 0 or 1 via a
Schmitt-Trigger device and can be read via the register Px_DATA.
In output mode, the output driver is activated and drives the value supplied through the
multiplexer to the port pin. In the output driver, each port line can be switched to open
drain mode or normal mode (push-pull mode) via the register Px_OD.
The output multiplexer in front of the output driver enables the port output function to be
used for different purposes. If the pin is used for general purpose output, the multiplexer
is switched by software to the data register Px_DATA. Software can set or clear the bit
in Px_DATA and therefore directly influence the state of the port pin. If an on-chip
peripheral uses the pin for output signals, alternate output lines (AltDataOut) can be
switched via the multiplexer to the output driver circuitry. Selection of the alternate
function is defined in registers Px_ALTSEL0 and Px_ALTSEL1. When a port pin is used
as an alternate function, its direction must be set accordingly in the register Px_DIR.
Each pin can also be programmed to activate an internal weak pull-up or pull-down
device. Register Px_PUDSEL selects whether a pull-up or the pull-down device is
activated while register Px_PUDEN enables or disables the pull device.
*