![](http://datasheet.mmic.net.cn/330000/PEF20321_datasheet_16444041/PEF20321_200.png)
PEB 20321
PEF 20321
General Purpose Port
Data Sheet
200
2001-02-14
9
General Purpose Port
This 16-bit port may be used for general purpose I/O. It also provides alternate
functionality to support LBI and SSC operations.
The General Purpose Bus consists of two separate 8-bit ports, that can be individually
selected to be general purpose or to provide the alternate function, i.e., each port line
has a programmable alternate input or output function associated with it. The alternate
function of the low 8-bit port is to provide DMA support pins (selected by setting
Configuration register
’
s bit field CONF.LBI), and the alternate function of high 8-bit port
is to provide Synchronous Serial Control (SSC) interface support (selected by setting
Configuration register
’
s bit field CONF.SSC).
Additionally, if CONF.LBI is selected, the DMA Tx/Rx acknowledge pins may be
combined for each channel A/B. This is performed by setting LBI Configuration register
’
s
bit field LCONF.CDP.
Note that the pin configuration for general purpose or alternate function mode is shown
in
Figure 78
on
Page 238
.
Within each 8-bit port, all input/output lines are individually (bit-wise) programmable as
inputs or outputs via the General Purpose Bus Direction register GPDIR.
The General Purpose Bus is a true bi-directional port which is switched to high
impedance state when configured as input. The output drivers of the port are push/pull
drivers. The logic level of a pin is clocked into the input latch once per state time,
regardless whether the port is configured as input or output.
A write operation to a general purpose pin configured as an input (GPDIR.x =
‘
0
’
) causes
the value to be written into the port output latch, while a read operation returns the
latched state of the pin itself. A read-modify-write operation reads the value of the pin,
modifies it, and writes it back to the output latch.
Writing to a general purpose pin configured as an output (GPDIR.x =
‘
1
’
) causes the
output latch and the pin to have the written value, since the output buffer is enabled.
Reading this pin returns the value of the output latch. A read-modify-write operation
reads the value of the output latch, modifies it, and writes it back to the output latch, thus
also modifying the level at the pin.
If an alternate output function of a General Purpose Bus pin is to be used, the direction
of this pin must be programmed for output (GPDIR.x =
‘
1
’
); otherwise the pin remains in
high-impedance state and is not effected by the alternate output function. The respective
port latch should hold a
‘
1
’
, because its output is ANDed with the alternate output data.
If an alternate input function of a General Purpose Bus pin is used, the direction of the
pin must be programmed for input (GPDIR.x =
‘
0
’
), if an external device is driving the pin.
On reset, the input direction is default. If no external device is connected to the pin,
however, the direction for this pin may also be set to output. In this case, the pin reflects
the state of the port output latch. Thus, the alternate input function reads the value stored