Rev.2.02
Mar 31, 2009
REJ03B0210-0202
7548 Group
4. Modifying Output Data with Bit Handling
Instruction
When the port latch of an I/O port is modified with the bit
handling instruction*1, the value of an unspecified bit may
change.
<Reason>
I/O ports can be set to input mode or output mode in byte units.
When the port register is read or written, the following will be
operated:
Port as input mode
Read: Read the pin level
Write: Write to the port latch
Port as output mode
Read: Read the port latch or peripheral function output
(specifications vary depending on the port)
Write: Write to the port latch (output the content of the port
latch from the pin)
Meanwhile, the bit handling instructions are the read-modify-
write instructions*2. Executing the bit handling instruction to the
port register allows reading and writing a bit unspecified with the
instruction at the same time.
If an unspecified bit is set to input mode, the pin level is read and
the value is written to the port latch. At this time, if the original
content of the port latch and the pin level do not match, the
content of the port latch changes.
If an unspecified bit is set to output mode, the port latch is
normally read, but the peripheral function output is read in some
ports and the value is written to the port latch. At this time, if the
original content of the port latch and the peripheral function
output do not match, the content of the port latch changes.
*1 Bit handling instructions: CLB, SEB
*2 Read-modify-write instruction: Reads 1-byte of data from
memory, modifies the data, and writes 1-byte of the data to
the original memory.
5. Direction Registers
The values of the port direction registers cannot be read. This
means, it is impossible to use the LDA instruction, memory
operation instruction when the T flag is “1”, addressing mode
using direction register values as qualifiers, and bit test
instructions such as BBC and BBS. It is also impossible to use bit
operation instructions such as CLB and SEB, and read-modify-
write instructions to direction registers, including calculations
such as ROR. To set the direction registers, use instructions such
as LDM or STA.
Termination of Unused Pins
1. Terminate unused pins
Perform the following wiring at the shortest possible distance (20
mm or less) from microcomputer pins.
(1)
I/O ports
Set the I/O ports for the input mode and connect each pin to VCC
or VSS through each resistor of 1 k
to 10 k. The port which
can select a built-in pull-up resistor can also use the built-in pull-
up resistor.
When using the I/O ports as the output mode, open them at “L”
or “H”.
When opening them in the output mode, the input mode of the
initial status remains until the mode of the ports is switched
over to the output mode by the program after reset. Thus, the
potential at these pins is undefined and the power source
current may increase in the input mode. With regard to an
effects on the system, thoroughly perform system evaluation
on the user side.
Since the direction register setup may be changed because of a
program runaway or noise, set direction registers by program
periodically to increase the reliability of program.
2. Termination remarks
(1)
I/O ports setting as input mode
[1] Do not open in the input mode.
<Reason>
The power source current may increase depending on the first
stage circuit.
An effect due to noise may be easily produced as compared
with proper termination (1) shown on the above “1. Terminate
unused pins”.
[2] Do not connect to VCC or VSS directly.
<Reason>
If the direction register setup changes for the output mode
because of a program runaway or noise, a short circuit may
occur.
[3] Do not connect multiple ports in a lump to VCC or VSS
through a resistor.
<Reason>
If the direction register setup changes for the output mode
because of a program runaway or noise, a short circuit may occur
between ports.