Interrupt handling – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 73
![background image](https://www.manualsdir.com/files/797818/content/doc073.png)
8E. Microsoft C
II. SOFTWARE GUIDES - 8. Driver488/DRV
II-58
Personal488 User’s Manual, Rev. 3.0
each 16-bit numbers and the colon (
:
) is required to separate them. The
segment
and
offset
values
we need are returned by the
segment
and
offset
functions, respectively.
Once the data has been received, we can print it out:
for (i=0; i<1700; i++) putchar(hundred[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:
ieeeprtf(“ENTER 16 #1700 BUFFER continue\n”,
segment(hundred),offset(hundred));
Once we have started the transfer, we can check the status:
ieeewt(“status\n”);
ieeerd(response);
printf(“%s\n”,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:
ieeewt(“wait\n”);
ieeewt(“status\n”);
ieeerd(response);
printf(“%s\n”,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.
Serial Poll, though it is not as fast as Parallel Poll, does offer three major advantages: it gives an
unambiguous response from a single bus device; it returns additional status information beyond the
simple request/no-request for service; and, most importantly, it is implemented on virtually all bus
devices.
The
SRQ
line can be monitored in two ways: it can be periodically polled by using the
STATUS
command, or by checking the “light pen status.”
BASIC provides a method for detecting and servicing external interrupts: the
ON PEN
statement. The
ON PEN
statement tells BASIC that, when an external interrupt is detected, a specific subroutine,