![](http://datasheet.mmic.net.cn/390000/M38207M8-051_datasheet_16817049/M38207M8-051_98.png)
APPLICATION
2.1 I/O pins
3820 GROUP USER’S MANUAL
2–12
2.1.4 Notes on use
When using I/O ports, note the following.
(1) Reading the port direction register
The value of the port direction register is not readable. The following cannot be used:
the data transfer instruction (
LDA
, etc.)
the operation instruction 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 (
ROR
,
CLB
, or
SEB
, etc.) to a direction register
Use instructions such as
LDM
and
STA
, etc., to set the port direction registers.
(2) When the data register (port latch) of an I/O port is modified with the bit managing instruction
When the data register (port latch) of an I/O port is modified with the bit managing instruction
8
1
, the
value of the unspecified bit may be changed.
REASON
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 data register of an I/O
port, the following is executed to all bits of the data register.
G
As for a bit which is set for an input port:
The pin state is read in the CPU, and is written to this bit after bit managing.
G
As for a bit which is set for an output port:
The bit value is read in the CPU, and is written to this bit after bit managing.
Note the following:
G
Even when a port which is set as an output port is changed for an input port, its data register holds
the output data.
G
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 data register contents
8
1 bit managing instructions :
SEB
and
CLB
instruction
(3) Pull-up control and pull-down control
To pull-up or pull-down ports by software, note the following.
G
When ports P0, P1 and P3 are used as segment output pins for LCD, the settings of the pull-down
bits corresponding to these ports of the PULL register A are invalid (pull-down is impossible).
G
When ports P0–P2, P4
1
–P4
7
and P5–P7 are set for the output mode, the settings of the bits
corresponding to these ports of the PULL register A and PULL register B are invalid (pull-up or pull-
down are impossible).