CHAPTER 4 PORT FUNCTIONS
User’s Manual U18172EJ2V0UD
60
(2) Port registers (P2 to P4)
These registers are used to write data to be output from the corresponding port pin to an external device
connected to the chip.
When a port register is read, the pin level is read in the input mode, and the value of the output latch of the
port is read in the output mode.
P20 to P23, P32, P40 and P43 are set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets these registers to 00H.
Figure 4-9. Format of Port Register
Address: FF02H, After reset: 00H (Output latch) R/W
Symbol
7 6 5 4 3 2 1 0
P2 0 0 0 0
P23
P22
P21
P20
Address: FF03H, After reset: 00H
Note
(Output latch) R/W
Note
Symbol
7 6 5 4 3 2 1 0
P3 0 0 0
P34
0
P32
0 0
Address: FF04H, After reset: 00H (Output latch) R/W
Symbol
7 6 5 4 3 2 1 0
P4 0 0 0 0
P43
0 0
P40
m = 2 to 4; n = 0 to 4
Pmn
Controls of output data (in output mode)
Input data read (in input mode)
0
Output 0
Input low level
1
Output 1
Input high level
Note
Because P34 is read-only, its reset value is undefined.
(3) Port mode control register 2 (PMC2)
This register specifies the port/alternate function (except the A/D converter function) mode or the A/D
converter mode.
Each bit of the PMC2 register corresponds to each pin of port 2 and can be specified in 1-bit units.
PMC2 is set by using a 1-bit or 8-bit memory manipulation instruction.
Reset signal generation sets PMC2 to 00H.