Programmable I/O Ports; Overview - Renesas M16C Series User Manual

16-bit single-chip microcomputer
Hide thumbs Also See for M16C Series:
Table of Contents

Advertisement

M30240 Group

2.13 Programmable I/O Ports

2.13.1 Overview

Sixty-three programmable I/O ports and one input-only port are available. I/O pins also serve as I/O pins
for built-in peripheral functions.
Each port has a direction register that defines the I/O direction and also has a port register for I/O data.
In addition, each port has a pull-up control register that defines pull-up resistance in terms of 4 bits. The
input-only port does not have a direction register or a pull-up control bit.
The following is an overview of the programmable I/O ports:
2.13.1.1 Writing to a port register
With the direction register set to output, the level of the written values from each relevant pin is output
by writing to a port register. The output level conforms to CMOS output. Writing to the port register, with
the direction register set to input, inputs a value to the port register, but nothing is output to the relevant
pins. The output level remains floating.
2.13.1.2 Reading a port register
With the direction register set to output, reading a port register takes out the content of the port register,
not the content of the pin. With the direction register set to input, reading the port register takes out the
content of the pin.
2.13.1.3 Input-only port
P8
is used as the input-only port, it also serves as NMI. P8
5
cannot be set to this port. As NMI cannot be disabled, an NMI interrupt occurs if a falling edge is input
to P8
. Use P8
for reading the level input at this time only.
5
5
2.13.1.4 Setting pull-up
The pull-up control bit allows setting of the pull-up resistance, in terms of 4 bits, either enabled or
disabled. For the four bits chosen, pull-up is effective only in the ports whose direction register is set to
input. Pull-up resistance is not effective in ports whose direction register is set to output.
Do not set the pull-up on a pin when a port is used as an A-D input.
2.13.1.5 High drive capacity ports
Port 2 can be configured to drive an LED by increasing the drive strength of the corresponding bits N-
channel transistor. Each timer output (TA0out to TA4out) can be configured for high drive capability also.
To configure high drive, set the corresponding bits in the Port 2 drive capacity register (03FA
Timer A output drive capacity register (03FB
Rev.1.00 Sep 24, 2003 Page 282 of 360
has no direction register. Pull-up resistance
5
).
16
Programmable I/O Ports
) and the
16

Advertisement

Table of Contents
loading

Table of Contents