GPIB Programming Techniques
Chapter 6
NI-488.2M UM for Windows NT
6-6
© National Instruments Corp.
request, command error, execution error, device dependent error, query error, request
control, and operation complete. The device can assert SRQ when ESB or MAV are set,
or when a manufacturer-defined condition occurs.
Automatic Serial Polling
You can enable automatic serial polling if you want your application to conduct a serial
poll automatically any time the SRQ line is asserted. The autopolling procedure occurs
as follows:
1.
To enable autopolling, use the configuration utility, ibconf, or the configuration
function,
ibconfig
with option
IbcAUTOPOLL
. (Autopolling is enabled by
default.)
2.
When the SRQ line is asserted, the driver automatically serial polls the open devices.
3.
Each positive serial poll response (bit 6 or hex 40 is set) is stored in a queue
associated with the device that sent it. The RQS bit of the device status word,
ibsta
, is set.
4.
The polling continues until SRQ is unasserted or an error condition is detected.
5.
To empty the queue, use the
ibrsp
function.
ibrsp
returns the first queued
response. Other responses are read in first-in-first-out (FIFO) fashion. If the RQS
bit of the status word is not set when
ibrsp
is called, a serial poll is conducted and
returns whatever response is received. You should empty the queue as soon as an
automatic serial poll occurs, because responses might be discarded if the queue is
full.
6.
If the RQS bit of the status word is still set after
ibrsp
is called, the response byte
queue contains at least one more response byte. If this happens, you should continue
to call
ibrsp
until RQS is cleared.
Stuck SRQ State
If autopolling is enabled and the GPIB interface board detects an SRQ, the driver serial
polls all open devices connected to that board. The serial poll continues until either SRQ
unasserts or all the devices have been polled.
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.