Interrupt handling – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 102
II. SOFTWARE GUIDES - 8. Driver488/DRV
8I. Turbo Pascal
Personal488 User’s Manual, Rev. 3.0
II-87
Now that we have allocated a place for the readings, we can direct Driver488/DRV to put readings
directly into the
r
array with the
ENTER #count BUFFER
command:
Writeln(IeeeOut,’ENTER 16 #1700 BUFFER’,
Seg(r[0]),’:’,Ofs(r[0]));
This command consists of the keyword
ENTER
, followed by the bus device address (
16
), a number sign
(
#
), the number of bytes to transfer (
1700
), and the keyword
BUFFER
, followed by the memory address
of the buffer. The buffer address is specified as
segment:offset
where
segment
and
offset
are
each 16-bit numbers and the colon (
:
) is required to separate them. The
segment
value we need, is the
value returned by the Turbo Pascal
Seg
function. The
offset
is the offset of the array in that data
segment, which is the value returned by
Ofs(r[0])
.
Once the data has been received, we can print it out:
FOR i:=0 TO 1699 DO Write(r[i]);
The program could process the previous set of data while collecting a new set into a different buffer.
To allow the program to continue, specify
CONTINUE
in the command:
Writeln(IeeeOut,’ENTER 16 #1700 BUFFER ‘,
Seg(r[0]),’:’,Ofs(r[0]),’ CONTINUE’);
Once we have started the transfer, we can check the status:
Writeln(IeeeOut,’STATUS’);
Readln(IeeeIn,Response);
Writeln(Response);
The status that is returned is typically:
CS21 1 L100 000 T0 C0 P1 OK
Notice
P1
which states a transfer is in progress, and
L
which shows we are still a listener. If the bus
device is so fast that the transfer completes before the program can check status, the response is
P0
showing that the transfer is no longer in progress. We can also
WAIT
for the transfer to complete and
check the status again:
Writeln(IeeeOut,’WAIT’);
Writeln(IeeeOut,’STATUS’);
Readln(IeeeIn,Response);
Writeln(Response);
This time the status must be
P0
as the
WAIT
command waits until the transfer has completed. Now that
we know the transfer is complete, we are ready to print out the received data as shown above.
Interrupt Handling
The IEEE 488 bus is designed to be able to attend to asynchronous (unpredictable) events or
conditions. When such an event occurs, the bus device needing attention can assert the Service
Request (
SRQ
) line to signal that condition to the controller. Once the controller notices the
SRQ
, it can
interrogate the bus devices, using Parallel Poll (
PPOLL
) and/or Serial Poll (
SPOLL
) to determine the
source and cause of the
SRQ
, and take the appropriate action.
Parallel Poll is the fastest method of determining which device requires service. Parallel Poll is a very
short, simple IEEE 488 bus transaction that quickly returns the status from many devices. Each of the
eight IEEE 488 bus data bits can contain the Parallel Poll response from one or more devices. So, if
there are eight or fewer devices on the bus, then just the single Parallel Poll can determine which
requires service. Even if the bus is occupied by the full complement of 15 devices, then Parallel Poll
can narrow the possibilities down to a choice of no more than two.
Unfortunately, the utility of Parallel Poll is limited when working with actual devices. Some have no
Parallel Poll response capability. Others must be configured in hardware, usually with switches or
jumpers, to set their Parallel Poll response. If Parallel Poll is not available, or several devices share the
same Parallel Poll response bit, then Serial Polling is still required to determine which device is
requesting service.