Anda di halaman 1dari 1

EED 3018 LABORATORY

EXPERIMENT 9:
INTERRUPTED I/O FOR Z80 PIO (mode 0 and mode 1)
Preliminary Work
Read about interrupt mode 2 and Z80 PIO mode 0 (byte output ) and mode 1
(byte input) with interrupted I/O and handshake signals.
Exercise : Your task is to send each incoming data at the port A (input
mode) to the port B (output mode). Each incoming data will cause the port A
to generate an interrupt so data will be read in first and then sent to the port B
in the interrupt service routine of the port A. Write initialization instructions
(including setting SP to 0100H) followed by a dummy main program (an
infinite loop). After that, continue with the interrupt vector table (at 0150H)
and interrupt service routine.
Using PIO in the Simulator: It is assumed that address outputs A0 and A1 of
the Z80 have been connected respectively, to B/A and C/D inputs of PIO.
Set the switches in the hardware address decoder so as to read base I/O addres
(this is the most significant 6 bits of an 8-bit I/O address) of the PIO being
used. See the following table for two examples of I/O addres configurations.
Do not forget to check 'set' box in the address decoder section of PIO virtual
machine window after you set a suitable I/O base address for the PIO.
In the Z80 simulator, some I/O devices connected to a port have a READY
DELAY input parameter. This is a delay time specified by number of clock
cycles. Those I/O devices delay a STB pulse to the port for the given number
of clock cycles from the time RDY signal of the port goes high. Simulator
assumes that every instruction takes 4 clock cycles for simplicity (beware that
this is not true in fact). Therefore you can also determine how many
instructions will be executed between active RDY and active STB signals (to
find it divide READY DELAY by 4 and round the result to integer).
Base Address
Address lines in the port A
address decoder:
data
A7 A6 A5 A4 A3 A2
register
0 0 0 0 0 0
00H
0 1 1 0 1 0
68H

I/O ADDRESS
port B port A
data
control
register register
01H
02H
69H
6AH

port B
control
register
03H
6BH

Laboratory Work
1. Data Echoing with Interrupt : Type in the simulator all your program code written for the Exercise. Connect an input line to port A,
and a LED line to port B (set READY DELAY to zero).
a) Test your program using the highest clock rate operation in the simulator and see it it works correctly.
b) Test your program using the single step operation in the simulator: monitor RDY and STB signals of both port A and B, and INT
signal. Find out which signals become active when you input data at the port A data bus (on pressing Set button in the Line Input box).
Interprete the data-in and data-out operations based on the handshake and interrupt signals (Warning: RDY output of an input port
remains always inactive as the result of some software bug in the Simulator, ignore this error and assume the correct signalling for RDY).
2. Running light :
Set port A as output port (generates interrupts). Connect a LED line to port A (set READY DELAY to zero). The task is to produce a
running light effect over the LED line using interrupt operation. That is, a single segment light will be shifted to the next LED to the left
(use a suitable rotate instruction for this) by every interrupt ocurrence. Recall that a LED line connected to a port provides a pulse at the
STB input of that port some delay time (set by READY DELAY) after RDY signal goes to high. Write initialization instructions, vector
table and interrupt service routine.
a) Test your program using the highest clock rate operation in the simulator. Make sure it works correctly.
b) Test your program using the single step operation in the simulator:
i) Monitor RDY and STB signals of port A and INT signal. Find out which signals become active after data is sent to the port A data
bus.
ii) Monitor the PC while instructions are being executed. See that interrupt service routine of port A is called repeatedly. Why do you
think program flow does not pass to an instruction in the main program? Try increasing READY DELAY to a higher value such as 20,
and monitor if program flow passes to the main program.

Anda mungkin juga menyukai