
CHAPTER 4 PORT FUNCTIONS
User’s Manual U15905EJ2V1UD
176
4.4
Cautions
The operation of a port differs depending on whether the port is in the input or output mode, as described below.
4.4.1
Writing data to I/O port
(1) In output mode
A value can be written to the output latch by using a transfer instruction. The contents of the output latch are
output from the pin. Once data has been written to the output latch, it is retained until new data is written to the
output latch.
(2) In input mode
A value can be written to the output latch by using a transfer instruction. Because the output buffer is off,
however, the status of the pin does not change.
Once data has been written to the output latch, it is retained until new data is written to the output latch.
Caution
A 1-bit memory manipulation instruction manipulates 1 bit but accesses a port in 8-bit units.
If this instruction is executed to manipulate a port with a mixture of input and output bits, the
contents of the output latch of a pin set in the input mode, in addition to the bit to be
manipulated, become undefined.
4.4.2
Reading data from I/O port
(1) In output mode
The contents of the output latch can be read by using a transfer instruction. The contents of the output latch do
not change.
(2) In input mode
The status of the pin can be read by using a transfer instruction. The contents of the output latch do not
change.