CHAPTER 4 PORT FUNCTIONS
User’s Manual U18172EJ2V0UD
52
4.2 Port
Configuration
Ports consist of the following hardware units.
Table 4-2. Configuration of Ports
Item
Configuration
Control registers
Port mode registers (PM2 to PM4)
Port registers (P2 to P4)
Port mode control register 2 (PMC2)
Pull-up resistor option registers (PU2 to PU4)
Ports
Total: 8 (CMOS I/O: 7, CMOS input: 1)
Pull-up resistor
Total: 7
4.2.1 Port
2
Port 2 is a 4-bit I/O port with an output latch. Each bit of this port can be set to the input or output mode by using
port mode register 2 (PM2). When the P20 to P23 pins are used as an input port, an on-chip pull-up resistor can be
connected in 1-bit units by using pull-up resistor option register 2 (PU2).
This port can also be used for A/D converter analog input, timer I/O, and external interrupt request input.
The P22 and P23 pins are also used as the X2 and X1 pins of the system clock oscillator. The functions of the P22
and P23 pins differ, therefore, depending on the selected system clock oscillator. The following three system clock
oscillators can be used.
(1) High-speed internal oscillator
The P22 and P23 pins can be used as I/O port pins or analog input pins to the A/D converter.
(2) Crystal/ceramic oscillator
The P22 and P23 pins cannot be used as I/O port pins or analog input pins to the A/D converter because they are
used as the X2 and X1 pins.
(3) External clock input
The P22 pin can be used as an I/O port pin or an analog input pin to the A/D converter.
The P23 pin is used as the X1 pin to input an external clock, and therefore it cannot be used as an I/O port pin or
an analog input pin to the A/D converter.
The system clock oscillation is selected by the option byte. For details, refer to
CHAPTER 15 OPTION BYTE
.
Reset signal generation sets port 2 to the input mode.
Figure 4-2 and 4-4 show the block diagrams of port 2.