National Instruments NI-488.2 Time Clock User Manual


 
GPIB Programming Techniques Chapter 7
NI-488.2 User Manual for Windows 7-8 © National Instruments Corp.
if ( ibsta & RQS ) {
printf ( "Device asserted SRQ.\n" );
/* Use ibrsp to retrieve the serial poll
response. */
ibrsp ( DeviceHandle, &SerialPollResponse );
}
return SerialPollResponse;
}
SRQ and Serial Polling with NI-488.2 Routines
The NI-488.2 software includes a set of NI-488.2 routines that you can use to conduct
SRQ servicing and serial polling. Routines pertinent to SRQ servicing and serial polling
are AllSpoll , FindRQS, ReadStatusByte, TestSRQ , and WaitSRQ .
AllSpoll can serial poll multiple devices with a single call. It places the status bytes
from each polled instrument into a predefined array. Then you must check the RQS bit
of each status byte to determine whether that device requested service.
ReadStatusByte is similar to AllSpoll, except that it serial polls only a single
device. It is also analogous to the device-level NI-488 ibrsp function.
FindRQS serial polls a list of devices until it finds a device that is requesting service or
until it has polled all of the specified devices. The routine returns the index and status
byte value of the device requesting service.
TestSRQ determines whether the SRQ line is asserted or unasserted, and returns to the
program immediately.
WaitSRQ is similar to TestSRQ, except that WaitSRQ suspends the application
program until either SRQ is asserted or the timeout period is exceeded.
The following examples use NI-488.2 routines to detect SRQ and then determine which
device requested service. In these examples three devices are present on the GPIB at
addresses 3, 4, and 5, and the GPIB interface is designated as bus index 0. The first
example uses FindRQS to determine which device is requesting service and the second
example uses AllSpoll to serial poll all three devices. Both examples use WaitSRQ
to wait for the GPIB SRQ line to be asserted.
Note : Automatic serial polling is not used in these examples because you cannot use
it with NI-488.2 routines.