Chapter 7 GPIB Programming Techniques
© National Instruments Corp. 7-7 NI-488.2 User Manual for Windows
If no device responds positively to the serial poll, or if SRQ remains in effect because of
a faulty instrument or cable, a stuck SRQ state is in effect. If this happens during an
ibwait for RQS, the driver reports the ESRQ error. If the stuck SRQ state happens, no
further polls are attempted until an ibwait for RQS is made. When ibwait is issued,
the stuck SRQ state is terminated and the driver attempts a new set of serial polls.
Autopolling and Interrupts
If autopolling and interrupts are both enabled, the NI-488.2 software can perform
autopolling after any device-level NI-488 call as long as no GPIB I/O is currently in
progress. This means that an automatic serial poll can occur even when your application
is not making any calls to the NI-488.2 software. Autopolling can also occur when a
device-level ibwait for RQS is in progress. Autopolling is not allowed whenever an
application calls a board-level NI-488 function or any NI-488.2 routine, or the stuck SRQ
(ESRQ) condition occurs.
If autopolling is enabled and interrupts are disabled, you can use autopolling in the
following situations only:
During a device-level ibwait for RQS
Immediately after a device-level NI-488 function is completed, before control is
returned to the application program
SRQ and Serial Polling with NI-488 Device Functions
You can use the device-level NI-488 function ibrsp to conduct a serial poll. ibrsp
conducts a single serial poll and returns the serial poll response byte to the application
program. If automatic serial polling is enabled, the application program can use ibwait
to suspend program execution until RQS appears in the status word, ibsta. The
program can then call ibrsp to obtain the serial poll response byte.
The following example illustrates the use of the ibwait and ibrsp functions in a
typical SRQ servicing situation when automatic serial polling is enabled.
#include "decl.h"
char GetSerialPollResponse ( int DeviceHandle )
{
char SerialPollResponse = 0;
ibwait ( DeviceHandle, TIMO | RQS );