
S3C821A/P821A
I/O PORTS
9-5
PORT 2
Port 2 is an 8-bit I/O port with individually configurable pins. It is accessed directly by writing or reading the port 2
data register, P2 (R226, E2H, Bank 0) in set 1. You can use port 2 for general I/O, or for the following alternative
functions:
— P2.0–P2.3 can be configured as multiplexed external interface bus control lines for
AS (address strobe)
signals,
DR (data read), DW (data write), and DM (data memory).
— P2.4–P2.7 can be configured, respectively, as T0CK (T0 clock input), T1CK (T1 clock input), TA, and TB
output.
The special functions that you can program using the port 2 high byte control register must also be enabled in the
associated peripheral. Also, when using port 2 pins for functions other than general I/O, you must still set the
corresponding port 2 control register value to configure each bit to input or output mode.
PORT 2 CONTROL REGISTERS
Two 8-bit control registers are used to configure port 2 pins: P2CONH (E4H, set 1, Bank 1) for pins P2.4–P2.7
and P2CONL (E5H, set 1, Bank 1) for pins P2.0–P2.3. Each byte contains four bit-pairs and each bit-pair
configures one port 2 pin. The P2CONH and the P2CONL registers also control the alternative functions
described above.
Port 2 High-Byte Control Register (P2CONH)
Four bit-pairs in the port 2 control register (P2CONH) configure the port 2 pins, P2.4–P2.7, to schmitt trigger
input, schmitt trigger input with pull-up resistor, or push-pull output mode.
Table 9-3. Port 2 Data Register Summary (High Nibbles)
P2CONH Bit-Pair
Corresponding Port 2 Pin
Alternate Pin Function
Bits 0 and 1
P2.4
T0 output or capture input (T0CK)
Bits 2 and 3
P2.5
T0 clock input (T1CK)
Bits 4 and 5
P2.6
Clock output (TA)
Bits 6 and 7
P2.7
Clock output (TB)