Datasheet

Section 8 I/O Ports
Rev. 3.00 Sep. 28, 2009 Page 130 of 710
REJ09B0384-0300
8.2 Port 2
Port 2 is a 4-bit I/O port. Port 2 has the following registers.
Port 2 data direction register (P2DDR)
Port 2 data register (P2DR)
Port 2 pull-up MOS control register (P2PCR)
8.2.1 Port 2 Data Direction Register (P2DDR)
The individual bits of P2DDR specify input or output for the pins of port 2.
Bit Bit Name Initial Value R/W Description
7 0 W
6 0 W
5 0 W
4 0 W
Reserved
3 P23DDR 0 W
2 P22DDR 0 W
1 P21DDR 0 W
The corresponding port 2 pins function as address
output port when the P2DDR bits are set to 1, and
as input port when cleared to 0.
0 P20DDR 0 W
8.2.2 Port 2 Data Register (P2DR)
P2DR stores output data for the port 2 pins.
Bit Bit Name Initial Value R/W Description
7 0 R/W
6 0 R/W
5 0 R/W
4 0 R/W
Reserved
3 P23DR 0 R/W
2 P22DR 0 R/W
1 P21DR 0 R/W
0 P20DR 0 R/W
P2DR stores output data for the port 2 pins that are
used as the general output port.
If a port 2 read is performed while the P2DDR bits
are set to 1, the P2DR values are read. If a port 2
read is performed while the P2DDR bits are
cleared to 0, the pin states are read.