
MB90670/675 Series
36
I
PERIPHERALS
1. Parallel Ports
(1) I/O Ports
When not being used as output pins by their corresponding peripherals, all pins except for ports 5, 7 and 9 can
be individually specified for input or output by setting the corresponding location in the port direction register.
When reading a port data register during input, the value is always read as the pin level; when reading a port
data register during output, the value latched in the port data register is read. This also applies to the read portion
of a read-modify-write operation.
When reading a port data register used as a control output, the data being output as the control output is read,
regardless of the value of the port direction register.
If read-modify-write instructions (bit set instruction, etc.) are used to access this register, the bit that is the focus
of the instruction is set to the prescribed value, but the contents of the output register corresponding to any other
bits for which the input setting has been made are overwritten with the current input value of the corresponding
pin. Therefore, when switching a pin that was being used for input over to output, first write the desired value to
the port data register, and then write “1” to the port direction register.
Reading and writing an I/O port differs from reading and writing memory as follows:
Input mode
Reads: The read data is the level of the corresponding pin.
Writes: The write data is stored in the output latch. The data is not output to the pin.
Output mode
Reads: The read data is the value stored in the PDR.
Writes: The write data is both stored in the output latch and output to the pin.
Block Diagram
Port data register
Port direction register
Port data register read
Port data register write
Port direction register write
Port direction register read
Pin
I