Chapter 8 NI-488.2 Programming Techniques
NI-488.2 User Manual 8-14 ni.com
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 the response received.
To prevent queue overflow, empty the queue as soon as an automatic
serial poll occurs.
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, continue to call
ibrsp until the RQS bit is cleared from the
status word.
Stuck SRQ State
If autopolling is enabled and the GPIB interface detects an SRQ, the driver
serial polls all open devices connected to that interface. 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.
Autopolling and Interrupts
If autopolling is enabled, the NI-488.2 software can perform autopolling
after any device-level call provided that no GPIB I/O is currently in
progress. Because the driver uses interrupts, 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 when an application calls a
board-level traditional or multi-device NI-488.2 call, or the stuck
SRQ (ESRQ) condition occurs.