Chapter 7
NI-488.2 Programming Techniques
©
National Instruments Corporation
7-13
NI-488.2 User Manual for Windows
Automatic Serial Polling
You can enable automatic serial polling if you want your application to
conduct a serial poll automatically when the SRQ line is asserted. The
autopolling procedure occurs as follows:
1.
To enable autopolling, use the configuration function,
ibconfig
, with
option
IbcAUTOPOLL
, or the NI-488.2 Configuration utility.
(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 the response received.
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, continue to call
ibrsp
until RQS is cleared.
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.