Chapter 6
GPIB Programming Techniques
© National Instruments Corp.
6-7
NI-488.2M UM for Windows NT
Autopolling and Interrupts
If autopolling and interrupts are both enabled, the NI-488.2M software can perform
autopolling after any device-level NI-488 call as long as no GPIB I/O is currently in
progress. In this case, an automatic serial poll can occur even when your application is
not making any calls to the NI-488.2M 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.
Note: The NI-488.2M software for Windows NT does not function properly if
interrupts are disabled.
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 );
if ( ibsta & RQS ) {
printf ( "Device asserted SRQ.\n" );
/* Use ibrsp to retrieve the serial poll
response. */
ibrsp ( DeviceHandle, &Serial PollResponse );
}
return SerialPollResponse;
}