![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_234.png)
210
CHAPTER 8 I/O PORTS
MB90560 series
8.8
8.8.2 Operation of Port 5
Port 5
This section describes the operation of port 5.
I
Operation of Port 5
G
Port operation in output mode
Setting a bit of the DDR5 register to “1” places the corresponding port pin in output mode.-
Data written to the PDR5 register in output mode is held in the output latch of the PDR and
output to the port pins.
The PDR5 register can be accessed in read mode to read the value at the port pins (the
same value as in the output latch of the PDR).
<Check>
If a read-modify-write instruction (such as an instruction that sets bits) is used with the port
data register, the target bits of the register are set to the specified value. The bits that have
been specified for output using the DDR register are not affected, but for the bits that have
been specified for input, a value input from the pins is written to the output latch and output
as it is. Before switching the mode for the bits from input to output, therefore, write the output
data to the PDR register, then specify output mode in the DDR register.
G
Port operation in input mode
Writing a bit of the DDR5 register to “0” places the corresponding port pin in input mode.
In input mode, the output buffer is turned off, and the pins are placed in a high impedance
state.
Data written to the PDR5 register in input mode is stored in the output latch of the PDR but
not output to the port pins.
The PDR5 register can be accessed in read mode to read the level value (“0” or “1”) at the
port pins.
G
Port operation for analog input
To use a port pin for analog input, write “1” to the corresponding ADER bit. Doing so disables the
port from operating as a general-purpose port pin and enables it to function as an analog input
pin. When PDR5 is accessed in read mode in this situation, a value of “0” is read.
G
Port operation after a reset
When the CPU is reset, the DDR5 register is initialized to “0” and the ADER register is initialized
to “1” to place the port in analog input mode. To use the port as a general-purpose port, write “0”
to the ADER register in advance to place the port in port I/O mode.
G
Port operation in stop or time-base timer mode
If the pin state setting bit (SPL) in the low-power mode control register (LPMCR) is already “1”
when the CPU is shifted to stop or time-base timer mode, the port pins are placed in a high-
impedance state. This is because the output buffer is turned off forcibly. Note that the inputs are
fixed at a certain level to prevent leakage due to an open circuit.
Table 8.8-4 lists the states of the port 5 pins.