72 / 129 page

Port Definitions
PRELIMINARY V1.8
67
TABLE 39.
Read-Modify-Write Instructions
It is not obvious that the last three instructions in this list are read-modify-instructions,
but they are. They read the port byte, all 8 bits, modify the addressed bit, then write the
new byte back to the latch. The reason that read-modify-write instructions are directed
to the latch than the pin is to avoid a possible misinterpretation of the voltage level at the
pin. For example, a port bit might be used to drive the base of the transistor. When a 1 is
written to the bit, the transistor is turn on. If the CPU then reads the same port bit at the
pin rather than the latch, it will read the base voltage of the transistor and interpret it as a
0. Reading the latch rather than the pin will return the correct value of 1.
14.3.
PCR (Port Control Register)
SET PX.Y
set bit Y of Port-X
Address
9AH
Bit Addr.
None
BIT
7
6
5
4
3
2
1
0
NAME
P4LATIN
P35INEN
PCR3
PCR2
PCR1
PCR0
Definition
Reserved
bit
Reserved
bit
Port-4
Input
Select
0: Pin In
1:Latch In
Port-3.5
Input
Enable bit
0 : Dis-
able (DIA)
1: P3.5
Input
Enable
(DI).
This bit is
the DI/DIA
selection
bit
Port-3 I/O
Control bit
0: CPU
Control
1: P3IO
Control
Port-2 I/O
Control bit
0: CPU
Control
1: P2IO
Control
Port-1 I/O
Control bit
0: CPU
Control
1: P1IO
Control
Port-0 I/O
Control bit
0: CPU
Control
1: P0IO
Control
Reset Value
0
0
0
0
0
0
0
0
Read/Write
by Software
R
R
R/W
R/W
R/W
R/W
R/W
R/W
Write
by Hardware
INSTRUCTIONS
DESCRIPTION