Download Print this page

ZiLOG Z80 Handbook page 118

Hide thumbs Also See for Z80:

Advertisement

As data is written out to the PIO, the RDY signal associated with
the port goes high, indicating to the external device that data is
available on the port I/O lines. After the external device has read
the data, it responds with signal STB, resetting the port RDY signal
and generating an interrupt (if the PIO has been programmed for
an interrupt) .
PIO MODE 1
PIO mode 1 is the input mode. If a port is in mode 1, the data-in-
put register is active and the data-output register is inactive. The
sequence of operations for inputting data into the PIO from an ex-
ternal device is as follows:
1. External device senses RDY line from PIO. If true, external
device__puts data on port I/O lines and momentarily brings
down STB line.
2. Data is strobed into port data-input register. This resets the
RDY line and causes an interrupt (if the PIO has been pro-
grammed for an interrupt).
3. Z-80 CPU reads the data from the PIO using an IN instruction
with an I/O address of the PIO port.
4. RDY line is set by action of IN instruction, causing external
device to ready next byte of data.
The actions in mode 1 are repeated for each byte of data to be
read in. The input operation is initiated by an IN instruction in
which the data is ignored as the RDY line is set for the first time.
PIO MODE 2
PIO mode 2 is the bidirectional data mode. Since mode 3 uses all
four handshake lines, only port A may be used for this mode. The
port A handshake lines are used for output operations and the port
B handshake lines for input operations. When A STB is low, data
from the data-output register of port A is gated onto the port I/O
lines. When a A STB is high, data may be input into the data-input
register by B STB. Signals A RDY and B RDY may both be active
at the same time, indicating that both output data is available from
the PIO and that the PIO is ready to receive input data from the
device.
PIO MODE 3
Mode 3 operations are set by addressing one of the two ports by
an OUT instruction and transferring a second 8-bit control word
125

Advertisement

loading