CHAPTER 4 PORT FUNCTIONS
User’s Manual U16896EJ2V0UD
73
(1) Port n register (Pn)
Data I/O with external devices is performed by writing to and reading from the Pn register. The Pn register is
configured of a port latch that retains the output data and a circuit that reads the pin status.
Each bit of the Pn register corresponds to one pin of port n and can be read or written in 1-bit units.
Pn7
0 is output
1 is output
Pnm
0
1
Control of output data (in output mode)
Pn6
Pn5
Pn4
Pn3
Pn2
Pn1
Pn0
0
1
2
3
7
5
6
7
Pn
After reset:
00H
Note
(output latch)
R/W
Note
Input-only port pins are undefined.
Writing to and reading from the Pn register are executed as follows depending on the setting of each register.
Table 4-3. Reading to/Writing from Pn Register
Setting of PMCn Register
Setting of PMn Register
Writing to Pn Register
Reading from Pn Register
Output mode
(PMnm bit = 0)
Write to the output latch
Note
.
The contents of the output latch are output
from the pin.
The value of the output
latch is read.
Port mode
(PMCnm bit = 0)
Input mode
(PMnm bit = 1)
Write to the output latch
Note
.
The status of the pin is not affected.
The pin status is read.
Output mode
(PMnm bit = 0)
Write to the output latch
Note
.
The status of the pin is not affected.
The pin operates as an alternate-function
pin.
•
When alternate function is
output
The output status of the
alternate function is read.
•
When alternate function is
input
The output latch value is
read.
Alternate-function mode
(PMCnm bit = 1)
Input mode
(PMnm bit = 1)
Write to the output latch
Note
.
The status of the pin is not affected.
The pin operates as an alternate-function
pin.
The pin status is read.
Note
The value written to the output latch is retained until a new value is written to the output latch.
<R>
Содержание ?PD703302
Страница 2: ...User s Manual U16896EJ2V0UD 2 MEMO ...