GPIB Programming Techniques
Chapter 6
NI-488.2M UM for Windows NT
6-4
© National Instruments Corp.
and you make a device-level call with the CIC Protocol enabled, the following
sequence occurs:
1.
The GPIB interface board asserts the SRQ line.
2.
The current CIC serial polls the board.
3.
The interface board returns a response byte of hex 42.
4.
The current CIC passes control to the GP IB board.
If the current CIC does not pass control, the NI-488.2M driver returns the ECIC error
code to your application. This error can occur if the current CIC does not understand
the CIC Protocol. If this happens, you could send a device-specific command
requesting control for the GPIB board. Then use a board-level
ibwait
command to
wait for CIC.
Talker/Listener Applications
Although designed for Controller-In-Charge applications, you can also use the
NI -488.2M software in most non-Controller situations. These situations are known as
Talker/Listener applications because the interface board is not the GPIB Controller. A
typical Talker/Listener application waits for events from the Controller and responds as
appropriate. The following paragraphs describe some programming techniques for
Talker/Listener applications.
Waiting for Messages from the Controller
A Talker/Listener application typically uses
ibwait
with a mask of 0 to monitor the
status of the interface board. Then, based on the status bits set in
ibsta
, the application
takes whatever action is appropriate. For example, the application could monitor the
status bits TACS (Talker Active State) and LACS (Listener Active State) to determine
when to send data to or receive data from the Controller. The application could also
monitor the DCAS (Device Clear Active State) and DTAS (Device Trigger Active State)
bits to determine if the Controller has sent the device clear (DCL or SDC) or trigger
(GET) messages to the interface board. If the application detects a device clear from the
Controller, it might reset the internal state of message buffers. If it detects a trigger
message from the Controller, the application might begin an operation such as taking a
voltage reading if the application is actually acting as a voltmeter.
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