
S3C821A/P821A
9-4
PORT 1
Port 1 is basically identical to port 0, except for its alternate use as multiplexed address/data lines for the external
interface. (Port 0 can alternately be configured as additional address lines A8–A15.)
Port 1 pins, P1.0–P1.7, can be configured on a nibble basis for general data input or output. When configured as
outputs, the pins in each nibble may optionally be set to open-drain. You can alternately configure port 0 as
additional address/data lines (AD0–AD7) for external peripheral interface.
To access port 1, you should write or read the port 1 data register, P1 (R225, E1H, Bank 0) in set 1. The port 1
data register cannot be written, however, when the port 1 bits are configured as address lines for external
interface: writing has no effect and reading only loads P1 data register with the state of the pin.
PORT 1 CONTROL REGISTER
The port 1 control register, P1CON (R226, E2H, set 1, Bank 1), controls the direction of the I/O lines and allows
an optional selection of pull-up resistor in input mode, and that of open-drain, or push-pull in output mode. The
P1CON setting "1xxxB" for each nibble configures the pins as external interface lines. The bits 4–7 control the
upper nibble pins, P1.4–P1.7, and the bits 0–3 control the lower nibble pins, P1.0–P1.3.
In normal operating mode a reset operation clears all P1CON register values to "0". If you want to configure an
external memory area, you can use a routine to set the P1CON value to "1xxx1xxxB". This setting correctly
configures the address/data lines AD0–AD7.
I/O PORT 1 CONTROL REGISTER (P1CON)
R226, E2H, Set 1, Bank 1, R/W
MSB
LSB
.7
.6
.5
.4
.3
.2
.1
.0
Upper nibble port configuration
Lower nibble port configuration
7 (3)
0
1
Port Mode Selection
Input mode
Input, pull-up mode
Output, push-pull mode
Output, open-drain mode
LCD segment (SEG31 -SEG24)
External interface (AD7-AD0)
6 (2)
0
1
0
1
x
4 (0)
0
1
x
5 (1)
x
0
1
x
(“x” means don’t care.)
Figure 9-3. Port 1 Control Register (P1CON)