Chapter 7 GPIB Programming Techniques
© National Instruments Corp. 7-5 NI-488.2 User Manual for Windows

Using the Event Queue

Some applications need to know the order in which certain messages are sent by the
Controller. To monitor the ordering of these messages, your application program must
enable the EVENT bit, using ibconfig (option IbcEventQueue ). When the
EVENT bit is enabled, the DCAS and DTAS bits are no longer activated. Instead, all
DCAS and DTAS messages are stored in a queue, in the order that they are received.
The event queue also stores interface clear (IFC) messages. When the queue contains
some information, the NI-488.2 software sets the EVENT bit in ibsta. When the
application program detects EVENT, it can call the function ibevent to retrieve the
first event that occurred. Retrieving events from the queue ensures that the application
can respond to device clear, device trigger, and interface clear messages in the correct
order.

Requesting Service

Another type of event that might be important in a Talker/Listener application is the
serial poll. A Talker/Listener application can call ibrsv with a serial poll response byte
when it needs to request service from the Controller. If the application needs to know
when the Controller has read the serial poll response byte, it can enable the SPOLL bit in
ibsta using ibconfig , option IbcSPollBit. The NI-488.2 software sets the
SPOLL bit when the Controller serial polls the board.
Serial Polling
You can use serial polling to obtain specific information from GPIB devices when they
request service. When the GPIB SRQ line is asserted, it signals the Controller that a
service request is pending. The Controller must then determine which device asserted the
SRQ line and respond accordingly. The most common method for SRQ detection and
servicing is the serial poll. This section describes how you can set up your application to
detect and respond to service requests from GPIB devices.

Service Requests from IEEE 488 Devices

IEEE 488 devices request service from the GPIB Controller by asserting the GPIB SRQ
line. When the Controller acknowledges the SRQ, it serial polls each open device on the
bus to determine which device requested service. Any device requesting service returns a
status byte with bit 6 set and then unasserts the SRQ line. Devices not requesting service
return a status byte with bit 6 cleared. Manufacturers of IEEE 488 devices use lower
order bits to communicate the reason for the service request or to summarize the state of
the device.