National Instruments NI-488.2 Refrigerator User Manual


 
Chapter 8 NI-488.2 Programming Techniques
NI-488.2 User Manual 8-4 ni.com
Waiting for GPIB Conditions
You can use the ibwait function to obtain the current ibsta value or to
suspend your application until a specified condition occurs on the GPIB.
If you use
ibwait with a parameter of zero, it immediately updates ibsta
and returns. If you want to use
ibwait to wait for one or more events to
occur, pass a wait mask to the function. The wait mask should always
include the TIMO event; otherwise, your application is suspended
indefinitely until one of the wait mask events occurs.
Asynchronous Event Notification in NI-488.2
Applications
NI-488.2 applications can asynchronously receive event notifications
using the
ibnotify function. This function is useful if you want your
application to be notified asynchronously about the occurrence of one or
more GPIB events. For example, you might choose to use
ibnotify if
your application only needs to interact with your GPIB device when it is
requesting service. After calling
ibnotify, your application does not need
to check the status of your GPIB device. Then, when your GPIB device
requests service, the NI-488.2 driver automatically notifies your
application that the event has occurred by invoking a callback function.
The callback function is registered with the NI-488.2 driver when the
ibnotify call is made.
Calling the ibnotify Function
ibnotify has the following function prototype:
ibnotify (
int ud,// unit descriptor
int mask,// bit mask of GPIB events
GpibNotifyCallback_t Callback,
// callback function
void * RefData// user-defined reference data
)