
CHAPTER 4 PORT FUNCTIONS
Preliminary User’s Manual U16541EJ1V0UM
176
4.4
Port Function Operation
The port operation differs according to the I/O mode settings, as follows.
4.4.1
Write to I/O ports
(1) Output mode
Values are written to output latches using transfer instructions. Moreover, the output latch contents are output
from the pin. Once data has been written to an output latch, it is held until data is newly written to that output
latch.
(2) I/O mode
Values are written to output latches using transfer instructions. However, since the output buffer is off, the
status of the pin does not change.
Once data has been written to an output latch, it is held until data is newly written to that output latch.
Caution
In the case of a 1-bit memory manipulation instruction, the manipulation target is 1 bit, but
the port is accessed in 8-bit units. Therefore, for ports where input and output are mixed, the
contents of output latches of pins specified for input other than the manipulation target bit
become undefined.
4.4.2
Read from I/O port
(1) Output mode
The contents of the output latch are read using a transfer instruction. The contents of the output latch do not
change.
(2) Input mode
The pin status is read using a transfer instruction. The contents of the output latch do not change.
4.4.3
I/O port calculation
(1) Output port
Calculation for the output latch contents is performed and the result is written to the output latch. The output
latch contents are output from the pin.
Once data has been written to an output latch, it is held until data is newly written to that output latch.
(2) Input mode
The output latch contents become undefined. However, since the output buffer is off, the pin status does not
change.
Caution
In the case of a 1-bit memory manipulation instruction, the manipulation target is 1 bit, but
the port is accessed in 8-bit units. Therefore, for ports where input and output are mixed, the
contents of output latches of pins specified for input other than the manipulation target bit
become undefined.