Automatic Serial Polling
- Updated2023-02-21
- 3 minute(s) read
Automatic Serial Polling
Automatic Serial Polling relieves you of the burden of sorting out occurrences of SRQ and obtaining status bytes from devices. To enable Automatic Serial Polling, or autopolling, use the ibconfig configuration function. If you enable autopolling, the handler automatically conducts serial polls when SRQ is asserted.
As part of the autopolling procedure, the handler stores each positive serial poll response in a queue associated with each device. A positive response has the RQS or hex 0x40 bit set in the device status byte. The handler stores the positive responses in a queue because some devices can send multiple positive status bytes before your program can act on them. When the handler receives a positive response from a device, the handler sets the RQS bit of the status word (ibsta). The polling continues until the device unasserts SRQ or the handler detects an error condition.
If the handler cannot locate the device that requests service because no known device responds positively to the poll, or if SRQ is stuck in the asserted state because of a faulty instrument or cable, a GPIB system error exists that interferes with the proper evaluation of the RQS bit in the status words of devices. The handler reports the ESRQ error to you when you issue an ibwait call with the RQS bit included in the wait mask. Aside from the difficulty ESRQ causes in waiting for RQS, the error has no detrimental effects on other GPIB operations.
If you call the serial poll function ibrsp and have received one or more responses previously through the automatic serial poll feature, the ibrsp function 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 you call ibrsp, the function conducts a serial poll and returns whatever response it receives.
If your application requires that requests for service be noticed, call the ibrsp function whenever the RQS bit appears in the status word. The serial poll response queue of a device can overflow with old status bytes when you neglect to call ibrsp. ibrsp returns the error condition ESTB when status bytes are discarded because the queue is full. If your application has no interest in SRQ or status bytes, you can ignore the occurrence of the automatic polls.
![]() |
Note If the RQS bit of the device status word remains set after you call ibrsp, the response byte queue has at least one more response byte remaining. Continue to call ibrsp until RQS clears. |
Autopolling Compatibility
You cannot detect the SRQI bit in device status words (ibsta) if you enable autopolling. The goal of autopolling is to remove the SRQ from the IEEE 488 bus, thus preventing visibility of the SRQI bit in status words for board calls and device calls. If you choose to look for SRQI in your program, you must disable autopolling.
Board functions also are incompatible with autopolling. The handler disables autopolling whenever you make a board call and re-enables autopolling at the end of a subsequent device call.