Z8
®
CPU
User Manual
UM001604-0108
Input/Output Ports
54
Read/Write Operations
Port 2 is accessed as General-Purpose Register P2 (
02h
). Port 2 is written by specifying
P2 as an instruction’s destination register. Writing to Port 2 causes data to be stored in the
output register of Port 2, and reflected externally on any bit configured as an output.
Port 2 is read by specifying P2 as the source register of an instruction. When an output bit
is read, data on the external pin is returned. Under normal loading conditions, this is
equivalent to reading the output register. However, if a bit of Port 2 is defined as an
Figure 41. Port 2 Configuration with Open-Drain Capability, Autolatch, Schmitt-
Trigger and SPI
P27 OUT
PIN
SPI Active
P27 IN
0 SOI D0 Enable
OPEN-DRAIN
R
≈
500 K
Ω
Autolatch
P27
P20 OE
PIN
P20 OUT
P20 IN
OPEN-DRAIN
R
≈
500 K
Ω
Autolatch
P20
SPI EN
SPI DO
P27 OE
SPI
SPI
Standard
Standard
1 P27 OUT
*SPI must be enabled with D0
D2
SCON
or
SPI DI