ZiLOG Z8 Technical Manual page 111

Microcomputer
Hide thumbs Also See for Z8:
Table of Contents

Advertisement

9.4 PORT 2
Port 2 is a general-purpose port.
Each of its
lines can be independently programmed as input or
output via the Port 2 Mode register (Figure 9-9).
A bit set to a 1 in P2M configures the correspond-
ing bit in Port 2 as an input, while a bit set to
o
determines an output line.
R246 P2M
Port 2 Mode Register
(% F6; Write Only)
P2o-P27 MODE
' - - - - - - 0 OUTPUT
1
INPUT
figure 9-9.
Port 2 I/O Operation
9.4.1
Read/Write Operations
Port 2 is accessed as general-purpose register P2
(%02).
The port is written by specifying P2 as an
instruction's destination register.
Writing the
port causes data to be stored in the port's output
register, and reflected externally on any bit con-
figured as an output.
The port 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 open-drain output, the
data returned is the value forced on the output
pin by the external system.
This may not be the
same as the data in the output register.
Reading input bits of Port 2 also returns data on
the external pins.
However, inputs under hand-
shake control return data latched into the input
register via the input strobe.
I/O Ports
9.4.2 Handshake Operation
Port 2 can be placed under handshake control by
programming
the
Port
3 Mode
register
(Figure
9-10).
In this configuration, Port 3 lines P31
and P36 are used as the handshake control lines
DAV2 and RDY2 for input handshake, or RDY2 and
DAV 2 for output handshake.
R247 P3M
Port 3 Mode Register
(% F7; Write Only)
o
P3l
=
INPUT (TIN)
P3s
=
OUTPUT (TOUT)
1
P3l
=
DAV2JRDY2 P3s
=
RDY2JDAV2
Figure 9-10.
Port
J
Handshake Operation
Handshake direction is determined by the configu-
ration (input or output) assigned to bit 7 of Port
2.
Only those bits with the same configuration as
P2 7 will be under handshake control.
Figure 9-11
illustrates Port 2's bit lines and the associated
handshake lines of Port 3.
P20
PORT 2(1/0)
P27
}
HANDSHAKE CONTROLS
DAV2 AND RDY2
(P3
1
AND P3 s )
figure 9-11.
Port 2
2037-014,3047-010,2037-008
9-5

Advertisement

Table of Contents
loading

Table of Contents