9 i/O PORTS (P)
S1C17624/604/622/602/621 TeChniCal Manual
Seiko epson Corporation
9-3
*
2: Available only for S1C17624,
*
3: Available only for S1C17624/604,
*
4: Available only for S1C17624/622
*
5: P43 can only be used as an output port. For how to configure P43, see the P43MUX/P40_43PMUX register description.
At initial reset, each I/O port pin (P
xy
) is initialized for the default function (“Pin function 1” in Table 9.2.1).
For information on functions other than the I/O ports, see the descriptions of the peripheral modules indicated in
parentheses. The sections below describe port functions with the pins set as general-purpose I/O ports.
Data input/Output
9.3
Data input/output control
The I/O ports allow selection of the data input/output direction for each bit using P
x
OEN
y
/P
x
_OEN register and
P
x
IEN
y
/P
x
_IEN register. P
x
OEN
y
enables and disables data output, while P
x
IEN
y
enables and disables data
input.
3.1 Data Input/Output Status
Table 9.
P
x
Oen
y
output control
P
x
ien
y
input control
P
x
Pu
y
pull-up control
Port status
0
1
0
Functions as an input port (pull-up off).
The port pin (external input signal) value can be read out from
P
x
IN
y
(input data). Output is disabled.
0
1
1
Functions as an input port (pull-up on). (Default)
The port pin (external input signal) value can be read out from
P
x
IN
y
(input data). Output is disabled.
1
0
1 or 0
Functions as an output port (pull-up off).
Input is disabled. The value read from P
x
IN
y
(input data) is 0.
1
1
1 or 0
Functions as an output port (pull-up off).
Input is also enabled. The port pin value (output value) can be
read out from P
x
IN
y
(input data).
0
0
0
The pin is placed into high-impedance status (pull-up off).
Output and input are both disabled. The value read from P
x
IN
y
(input data) is 0.
0
0
1
The pin is placed into high-impedance status (pull-up on).
Output and input are both disabled. The value read from P
x
IN
y
(input data) is 0.
The input/output direction of ports with a peripheral module function selected is controlled by the peripheral
module. P
x
OEN
y
and P
x
IEN
y
settings are ignored.
Data input
To input the port pin status and read out the value, enable input by setting P
x
IEN
y
to 1 (default).
To input an external signal, P
x
OEN
y
should also be set to 0 (default). The I/O port is placed into high-imped-
ance status and it functions as an input port (input mode). The port is pulled up if pull-up is enabled by P
x
PU
y
/
P
x
_PU register.
In input mode, the input pin status can be read out directly from P
x
IN
y
/P
x
_IN register. The value read will be 1
when the input pin is at High (V
DD
) level and 0 when it is at Low (V
SS
) level.
The port pin status is always input when P
x
IEN
y
is 1, even if output is enabled (P
x
OEN
y
= 1) (output mode). In
this case, the value actually output from the port can be read out from P
x
IN
y
.
When P
x
IEN
y
is set to 0, input is disabled, and 0 will be read out from P
x
IN
y
.
Data output
To output data from the port pin, enable output by setting P
x
OEN
y
to 1 (set to output mode). The I/O port then
functions as an output port, and the value set in the P
x
OUT
y
/P
x
_OUT register is output from the port pin. The
port pin outputs High (V
DD
) level when P
x
OUT
y
is set to 1 and Low (V
SS
) level when set to 0. Note that the
port will not be pulled up in output mode, even if pull-up is enabled by P
x
PU
y
.
Writing to P
x
OUT
y
is possible without affecting pin status, even in input mode.
note: P43 can only be used as an output port. For how to configure P43, see the P43MUX/P40_43PMUX
register description.