6 I/O PORTS (PPORT)
6-4
Seiko epson Corporation
S1C17F13 TeChniCal Manual
(Rev. 1.0)
Initial settings when using a port for a peripheral I/O function
When using the P
xy
port for a peripheral I/O function, perform the following software initial settings:
1. Set the following P
x
IOEN register bits:
Set the P
x
IOEN.P
x
IEN
y
bit to 0.
(Disable input)
Set the P
x
IOEN.P
x
OEN
y
bit to 0.
(Disable output)
2. Set the P
x
MODSEL.P
x
SEL
y
bit to 0. (Disable peripheral I/O function)
3. Initialize the peripheral circuit that uses the pin.
4. Set the P
x
FNCSEL.P
xy
MUX[1:0] bits. (Select peripheral I/O function)
5. Set the P
x
MODSEL.P
x
SEL
y
bit to 1. (Enable peripheral I/O function)
For the list of the peripheral I/O functions that can be assigned to each port of this IC, refer to “Control Register
and Port Function Configuration of this IC.” For the specific information on the peripheral I/O functions, refer
to the respective peripheral circuit chapter.
Initial settings when using a port as a general-purpose output port
(only for the ports with GPIO function)
When using the P
xy
port pin as a general-purpose output pin, perform the following software initial settings:
1. Set the P
x
IOEN.P
x
OEN
y
bit to 1.
(Enable output)
2. Set the P
x
MODSEL.P
x
SEL
y
bit to 0. (Enable GPIO function)
Initial settings when using a port as a general-purpose input port
(only for the ports with GPIO function)
When using the P
xy
port pin as a general-purpose input pin, perform the following software initial settings:
1. Write 0 to the P
x
INTCTL.P
x
IE
y
bit. * (Disable interrupt)
2. When using the chattering filter, configure the PPORT operating clock (see “PPORT Operating Clock”) and
set the P
x
CHATEN.P
x
CHATEN
y
bit to 1. *
When the chattering filter is not used, set the P
x
CHATEN.P
x
CHATEN
y
bit to 0 (supply of the PPORT op-
erating clock is not required).
3. Configure the following P
x
RCTL register bits when pulling up/down the port using the internal pull-up or
down resistor:
- P
x
RCTL.P
x
PDPU
y
bit
(Select pull-up or pull-down resistor)
- Set the P
x
RCTL.P
x
REN
y
bit to 1. (Enable pull-up/down)
Set the P
x
RCTL.P
x
REN
y
bit to 0 if the internal pull-up/down resistors are not used.
4. Set the P
x
MODSEL.P
x
SEL
y
bit to 0. (Enable GPIO function)
5. Configure the following bits when using the port input interrupt: *
- Write 1 to the P
x
INTF.P
x
IF
y
bit.
(Clear interrupt flag)
- P
x
INTCTL.P
x
EDGE
y
bit
(Select interrupt edge (input rising edge/falling edge))
- Set the P
x
INTCTL.P
x
IE
y
bit to 1. (Enable interrupt)
6. Set the following P
x
IOEN register bits:
- Set the P
x
IOEN.P
x
OEN
y
bit to 0. (Disable output)
- Set the P
x
IOEN.P
x
IEN
y
bit to 1.
(Enable input)
*
Steps 1 and 5 are required for the ports with an interrupt function. Step 2 is required for the ports with a chat-
tering filter function.
Table 6.4.1.1 lists the port status according to the combination of data input/output control and pull-up/down
control.