
2-6
3874 Group User's Manual
APPLICATION
2.1 I/O port
2.1.3 Notes on use
When using I/O ports, note the following.
(1)
Modifying port latch of I/O port with bit managing instruction
When the port latch of an I/O port is modified with the bit managing instructionV1, the value of the
unspecified bit may be changed.
qREASON
The bit managing instructions are read-modify-write form instructions for reading and writing data by
a byte unit. Accordingly, when these instructions are executed on a bit of the port latch of an I/O port,
the following is executed to all bits of the port latch.
As for bit which is set for input port:
The pin state is read in the CPU, and is written to this bit after bit managing.
As for bit which is set for output port:
The bit value is read in the CPU, and is written to this bit after bit managing.
Note the following:
Even when a port which is set as an output port is changed for an input port, its port latch holds
the output data.
As for a bit of which is set for an input port, its value may be changed even when not specified
with a bit managing instruction in case where the pin state differs from its port latch contents.
V1 Bit managing instructions : SEB and CLB instructions
(2)
Reading port direction register
The value of the port direction register cannot be read. The following cannot be used:
the data transfer instruction (LDA, etc.) when the index X mode flag (T) is “1”
the addressing mode which uses the value of a direction register as an index
the bit-test instruction (BBC or BBS, etc.) to a direction register
the read-modify-write instruction (bit managing instructions of CLB and SEB, operation instructions
of ROR, etc.) to a direction register.
Use instructions such as LDM and STA, etc., to set the port direction registers.
(3)
Pull-up control
To pull-up ports by software, note the following.
Ports P20–P27s’ pull-up is valid only at input, and TxD, SCLK1, SOUT2 and SCLK2s’ pull-up is valid only
at output.
Ports except port P25 cannot be pull-up in a unit of 1 bit. For example, when Port P26 (pull-up control
in a unit of 2 bits) is set to pull-up, port P27 is set to pull-up, too.