46
Chapter 2
Pin Functions
Preliminary User’s Manual U17566EE1V2UM00
2.2.3
Pin data input/output
If a pin is in port mode, the registers for pin data input/output specify the input
and output data.
(1)
Pn - Port register
In port mode (PMCn.PMCnm=0), data is input from or output to an external
device by writing or reading the Pn register.
For port groups with up to eight ports, this is an 8-bit register. For port groups
with up to 16 ports, this is a 16-bit register.
Access
This register can be read/written in 8-bit and 1-bit units.
16-bit registers can also be read/written in 16-bit units.
Address
see
“Port Group Configuration“ on page 56
Initial Value
00
H
or 0000
H
. This register is cleared by any reset.
Note
After reset, the ports are in input mode (PMn.PMnm = 1). The read input value
is determined by the port pins.
Note
The value written to register Pn is retained until a new value is written to
register Pn.
Data is written to or read from the Pn register as follows:
7
6
5
4
3
2
1
0
Pn7
Pn6
Pn5
Pn4
Pn3
Pn2
Pn1
Pn0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Pn15 Pn14 Pn13 Pn12 Pn11 Pn10
Pn9
Pn8
Pn7
Pn6
Pn5
Pn4
Pn3
Pn2
Pn1
Pn0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Table 2-9
Pn register contents
Bit position
Bit name
Function
7 to 0
or
15 to 0
Pn[7:0]
or
Pn[15:0]
Data, see
Table 2-10
for details.
Table 2-10
Writing/reading register Pn
Function
PM
I/O
Write to Pn
and output contents of Pn to pins
0
O
Write to Pn
without affecting the pin status
1
I
Read from Pn
and thus read the pin status
1
I
Read from Pn
and disregard the pin status
0
O
1
I
electronic components distributor