![](http://datasheet.mmic.net.cn/30000/M30240MC-XXXFP_datasheet_2358667/M30240MC-XXXFP_112.png)
CONFIDENTIAL
114
Mitsubishi microcomputers
M16C / 24 Group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change
Programmable I/O Ports
2.26 Programmable I/O Ports
There are 63 programmable I/O ports: P0 to P3, P6 to P8 (excluding P85), and P10. Each port can be
set independently for input or output using the direction register. A pull-up resistance for each block of
4 ports can be set. P85 is an input-only port and has no built-in pull-up resistance.
Figure 108 and Figure 109 show the programmable I/O ports.
Each pin functions as a programmable I/O port and as the I/O for the built-in peripheral devices.
To use the pins as the inputs for the built-in peripheral devices, set the direction register of each pin to
input mode. When the pins are used as the outputs for the built-in peripheral devices, they function as
outputs regardless of the contents of the direction registers. Unused I/O pins can be terminated as
shown in Figure 114 and Table 36 .
(1) Direction registers
Figure 110 shows the direction registers.
These registers are used to choose the direction of the programmable I/O ports. Each bit in these
registers corresponds one for one to each I/O pin.
Note: There is no direction register bit for P85.
(2) Port registers
Figure 111 shows the port registers.
These registers are used to write and read data for input and output to and from an external device.
A port register consists of a port latch to hold output data and a circuit to read the status of a pin. Each
bit in port registers corresponds one for one to each I/O pin.
(3) Pull-up control registers
Figure 112 shows the pull-up control registers.The pull-up control register can be set to apply a pull-
up resistance to each block of 4 ports. When ports are set to have a pull-up resistance, the pull-up
resistance is connected only when the direction register is set for input.
(4) High drive capacity registers
Figure 113 shows the Port 2 and PWM drive capacity registers. Port 2 can be configured to drive an
LED by increasing the drive strength of the corresponding bit’s N-channel transistor. Each PWM out-
put (TA0OUT~TA4OUT) can be configured for high-drive capability by increasing the drive strength of
the corresponding bits.