Hardware manual

Rev. 3.0, 09/98, page 89 of 361
Port 2 Data Register (P2DR)H'FFB3
Bit:76543210
P2
7
P2
6
P2
5
P2
4
P2
3
P2
2
P2
1
P2
0
Initial value:00000000
Read/Write: R/W R/W R/W R/W R/W R/W R/W R/W
P2DR is an 8-bit register containing the data for pins P2
7
to P2
0
. When the CPU reads P2DR, for
output pins it reads the value in the P2DR latch, but for input pins, it obtains the logic level
directly from the pin, bypassing the P2DR latch.
Port 2 Input Pull-Up Control Register (P2PCR)H'FFAD
Bit:76543210
P2
7
PCR P2
6
PCR P2
5
PCR P2
4
PCR P2
3
PCR P2
2
PCR P2
1
PCR P2
0
PCR
Initial value:00000000
Read/Write: R/W R/W R/W R/W R/W R/W R/W R/W
P2PCR is an 8-bit readable/writable register that controls the input pull-up transistors in port 2. If
a bit in P2DDR is cleared to “0” (designating input) and the corresponding bit in P2PCR is set to
“1,” the input pull-up transistor for that bit is turned on.
Mode 1: In mode 1 (expanded mode without on-chip ROM), port 2 is automatically used for
address output. The port 2 data direction register is unwritable. All bits in P2DDR are
automatically set to “1” and cannot be cleared to “0.”
Mode 2: In mode 2 (expanded mode with on-chip ROM), the usage of port 2 can be selected on a
pin-by-pin basis. A pin is used for general-purpose input if its data direction bit is cleared to “0,”
or for address output if its data direction bit is set to “1.”
Mode 3: In the single-chip mode port 2 is a general-purpose input/output port.
Reset: A reset clears P2DDR, P2DR, and P2PCR to all “0,” placing all pins in the input state with
the pull-up transistors off. In mode 1, when the chip comes out of reset, P2DDR is set to all “1.”
Hardware Standby Mode: All pins are placed in the high-impedance state with the pull-up
transistors off. P2DR and P2PCR are initialized to H'00. In modes 2 and 3, P2DDR is initialized
to H'00.
Software Standby Mode: In the software standby mode, P2DDR, P2DR, and P2PCR remain in
their previous state. Address output pins are Low. General-purpose output pins continue to output
the data in P2DR.