Z8 Microcontrollers
I/O Ports
ZiLOG
5-8
UM001600-Z8X0599
5.3.2 Read/Write Operations
In byte input or byte output mode, the port is accessed as
General-Purpose Register P1 (01H). The port is written by
specifying P1 as an instruction's destination register. Writ-
ing to the port causes data to be stored in the port's output
register.
The port is read by specifying P1 as the source register of
an instruction. When an output is read, data on the exter-
nal pins is returned. Under normal loading conditions, this
is equivalent to reading the output register. However, if
Port 1 outputs are defined as open-drain, the data returned
is the value forced on the output by the external system.
This may not be the same as the data in the output regis-
ter. When Port 1 is defined as an input, reading also re-
turns data on the external pins. However, inputs under
handshake control return data latched into the input regis-
ter via the input strobe.
Using the Port 0-1 Mode Register, Port 1 is configured as
an output port by setting bits D
4
and D
3
to 0, or as an input
port by setting D
4
to 0 and D
3
to 1 (Figure 5-8).
5.3.3 Handshake Operations
When used as an I/O port, Port 1 can be placed under
handshake control by programming the Port 3 Mode regis-
ter bits D
4
and D
3
both to 1. In this configuration, hand-
shake control lines are DAV
1
(P3
3
) and RDY1 (P3
4
) when
Port 1 is an input port, or RDY1(P3
3
) and DAV1 (P3
4
)
when Port 1 is an output port. See Figures 5-8 and 5-10.
Handshake direction is determined by the configuration
(input and output) assigned to Port 1. For example, if Port
1 is an output port then handshake is defined as output.
Figure 5-9. Port 1 I/O Operation
D4 D3
(F8, Write-Only)
Port 0-1 Mode Register
R248 P01M
01 = Byte Output
10 = AD
-AD
1 = High Impedance AD
0
- AD
7
,
00 = Byte Output
P1
- P1
Mode
AS
,
DS
,
R
/W,
A
8
- A
11
, A
12
- A
15
Figure 5-10. Handshake Operation
D4 D3
(F7, Write-Only)
00 P33 = Input P34 = Output
01 P33 = Input P34 =
DM
10 P33 = Input P34 =
DM
11 P33 =
DAV1
/
RDY1 P34 = RDY1/
DAV1
Port 3 Mode Register
R247 P3M