8 I/O PORTS (P)
S1C17554/564 TECHNICAL MANUAL
Seiko Epson Corporation
8-3
Data Input/Output
8.3
Data input/output control
The I/O ports allow selection of the data input/output direction for each bit using PxOENy/Px_OEN register and
PxIENy/Px_IEN register. PxOENy enables and disables data output, while PxIENy enables and disables data
input.
3.1 Data Input/Output Status
Table 8.
PxOENy
output control
PxIENy
input control
PxPUy
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
PxINy (input data). Output is disabled.
0
1
Functions as an input port (pull-up on). (Default)
The port pin (external input signal) value can be read out from
PxINy (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 PxINy (input data) is 0.
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 PxINy (input data).
0
The pin is placed into high-impedance status (pull-up off).
Output and input are both disabled. The value read from PxINy
(input data) is 0.
0
1
The pin is placed into high-impedance status (pull-up on).
Output and input are both disabled. The value read from PxINy
(input data) is 0.
The input/output direction of ports with a peripheral module function selected is controlled by the peripheral
module. PxOENy and PxIENy settings are ignored.
Data input
To input the port pin status and read out the value, enable input by setting PxIENy to 1 (default).
To input an external signal, PxOENy 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 PxPUy/
Px_PU register.
In input mode, the input pin status can be read out directly from PxINy/Px_IN register. The value read will be 1
when the input pin is at High (HVDD) level and 0 when it is at Low (VSS) level.
The port pin status is always input when PxIENy is 1, even if output is enabled (PxOENy = 1) (output mode). In
this case, the value actually output from the port can be read out from PxINy.
When PxIENy is set to 0, input is disabled, and 0 will be read out from PxINy.
Data output
To output data from the port pin, enable output by setting PxOENy to 1 (set to output mode). The I/O port then
functions as an output port, and the value set in the PxOUTy/Px_OUT register is output from the port pin. The
port pin outputs High (HVDD) level when PxOUTy is set to 1 and Low (VSS) level when set to 0. Note that the
port will not be pulled up in output mode, even if pull-up is enabled by PxPUy.
Writing to PxOUTy is possible without affecting pin status, even in input mode.
Pull-up Control
8.4
The I/O port contains a pull-up resistor that can be enabled or disabled individually for each bit using PxPUy/Px_
PU register. Setting PxPUy to 1 (default) enables the pull-up resistor and pulls up the port pin in input mode. It will
not be pulled up if set to 0. The PxPUy setting is ignored and not pulled up in output mode, regardless of how the
PxIENy is set.
I/O ports that are not used should be set with pull-up enabled.
This pull-up setting is also enabled for ports for which the peripheral module function has been selected.