CHAPTER 12 PORT FUNCTIONS
566
User’s Manual U15195EJ5V0UD
12.3.3 Port 2
Port 2 is an 8-bit I/O port in which input or output can be specified in 1-bit units.
7
P27
P2
6
P26
5
P25
4
P24
3
P23
2
P22
1
P21
0
P20
Address
FFFFF404H
After reset
Undefined
Bit position
Bit name
Function
7 to 0
P2n
(n = 7 to 0)
I/O port
Besides functioning as a port, in control mode, it also can operate as the timer/counter I/O and external interrupt
request input.
(1) Operation in control mode
Port
Alternate Pin Name
Remarks
Block Type
P20
TI2/INTP20
Timer/counter input or external interrupt request input
B
P21 to 24
TO21/INTP21 to
TO24/INTP24
Timer/counter output or external interrupt request
input
K
P25 TCLR2/INTP25
P26 TI3/TCLR3/INTP30
Timer/counter input or external interrupt request input
B
Port 2
P27 TO3/INTP31 Timer/counter
output or external interrupt request
input
L
Caution P20, P21, and P25 to P27 have hysteresis characteristics when the alternate functions are input, but
not in the port mode.
(2) Setting of I/O mode and control mode
The port 2 mode register (PM2) is used to set the I/O mode of port 2 and the port 2 mode control register
(PMC2) and port 2 function control register (PFC2) are used to set the operation in control mode.
(a) Port 2 mode register (PM2)
This register can be read or written in 8-bit or 1-bit units.
7
PM27
PM2
6
PM26
5
PM25
4
PM24
3
PM23
2
PM22
1
PM21
0
PM20
Address
FFFFF424H
After reset
FFH
Bit position
Bit name
Function
7 to 0
PM2n
(n = 7 to 0)
Specifies input/output mode of P2n pin.
0: Output mode (output buffer on)
1: Input mode (output buffer off)