6 I/O PORTS (PPORT)
S1C17M12/M13 TECHNICAL MANUAL
Seiko Epson Corporation
6-5
(Rev. 1.2)
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.
Table 6.4.1.1 GPIO Port Control List
PxIOEN.
PxIENy bit
PxIOEN.
PxOENy bit
PxRCTL.
PxRENy bit
PxRCTL.
PxPDPUy bit
Input
Output
Pull-up/pull-down
condition
0
0
0
×
Disabled
Off (Hi-Z)
*
1
0
0
1
0
Disabled
Pulled down
0
0
1
1
Disabled
Pulled up
1
0
0
×
Enabled
Disabled
Off (Hi-Z)
*
2
1
0
1
0
Enabled
Disabled
Pulled down
1
0
1
1
Enabled
Disabled
Pulled up
0
1
0
×
Disabled
Enabled
Off
0
1
1
0
Disabled
Enabled
Off
0
1
1
1
Disabled
Enabled
Off
1
1
1
0
Enabled
Enabled
Off
1
1
1
1
Enabled
Enabled
Off
*
1: Initial status. Current does not flow if the pin is placed into floating status.
*
2: Use of the pull-up or pull-down function is recommended, as undesired current will flow if the port input is set to floating status.
Note: If the PxMODSEL.PxSELy bit for the port without a GPIO function is set to 0, the port goes into
initial status (refer to “Initial Settings”). The GPIO control bits are configured to a read-only bit al-
ways read out as 0.
6.4.2 Port Input/Output Control
Peripheral I/O function control
The port for which a peripheral I/O function is selected is controlled by the peripheral circuit. For more infor-
mation, refer to the respective peripheral circuit chapter.
Setting output data to a GPIO port
Write data (1 = high output, 0 = low output) to be output from the P
xy
pin to the P
x
DAT.P
x
OUT
y
bit.
Reading input data from a GPIO port
The data (1 = high input, 0 = low input) input from the P
xy
pin can be read out from the P
x
DAT.P
x
IN
y
bit.
Note: The PxDAT.PxINy bit retains the input port status at 1 clock before being read from the CPU.
Chattering filter function
Some ports have a chattering filter function and it can be controlled in each port. This function is enabled by
setting the P
x
CHATEN.P
x
CHATEN
y
bit to 1. The input sampling time to remove chattering is determined by
the CLK_PPORT frequency configured using the PCLK register in common to all ports. The chattering filter
removes pulses with a shorter width than the input sampling time.
2 to 3
Input sampling time = ———————————————— [second]
(Eq.6.2)
CLK_PPORT frequency [Hz]