Z8 Microcontrollers
I/O Ports ZiLOG
5-8 UM001601-0803
5.3.2 Read/Write Operations
In byte input or byte output mode, the port is accessed as Gener-
al-Purpose Register P1 (01H). The port is written by specifying
P1 as an instruction's destination register. Writing 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 in-
struction. When an output is read, data on the external pins is re-
turned. Under normal loading conditions, this is equivalent to
reading the output register. However, if Port 1 outputs are de
-
fined 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 register. When Port 1 is defined as an input,
reading also returns 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 out-
put port by setting bits D
4
and D
3
to 0, or as an input port by set-
ting 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 register bits D
4
and D
3
both to 1. In this configuration, handshake 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
0
-AD
7
00 = Byte Output
P1
0
- P1
3
Mode
AS
, DS, R/W,
11 = High Impedance AD
0
- AD
7
,
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
Port 3 Mode Register
R247 P3M
10 P33 = Input P34 = DM
11 P33 =
DAV1/RDY1 P34 = RDY1/DAV1