National Instruments NI-488.2 Refrigerator User Manual


 
Chapter 8 NI-488.2 Programming Techniques
© National Instruments Corporation 8-5 NI-488.2 User Manual
Both board-level and device-level ibnotify calls are supported by the
NI-488.2 driver. If you are using device-level calls, you can call
ibnotify
with a device handle for
ud and a mask of RQS, CMPL, END, or TIMO.
If you are using board-level calls, you can call
ibnotify with a board
handle for
ud and a mask of any values except RQS. The ibnotify mask
bits are identical to the
ibwait mask bits. In the example of waiting for
your GPIB device to request service, you might choose to pass
ibnotify
a
mask with RQS (for device-level) or SRQI (for board-level).
The callback function that you register with the
ibnotify call is invoked
by the NI-488.2 driver when one or more of the mask bits passed to
ibnotify is TRUE.
The callback function is of type
GPIBNotifyCallback_t and is defined
in the gpib header file,
ni488.h.
The callback function is passed a unit descriptor, the current values of the
NI-488.2 global variables, and the user-defined reference data that was
passed to the original
ibnotify call. The NI-488.2 driver interprets the
return value for the callback as a mask value that is used to automatically
rearm the callback if it is non-zero. For a complete description of
ibnotify, refer to the NI-488.2 online help. For instructions on accessing
the online help, refer to the Using the NI-488.2 Documentation section in
About This Manual.
Note The ibnotify callback is executed in a separate thread of execution from the rest
of your application. If your application will be performing other NI-488.2 operations while
it is using
ibnotify, use the per-thread NI-488.2 globals that are provided by the
ThreadIbsta, ThreadIberr, ThreadIbcnt, and ThreadIbcntl functions described
in the Writing Multithreaded NI-488.2 Applications section of this chapter. In addition, if
your application needs to share global variables with the callback, use a synchronization
primitive (for example, a semaphore) to protect access to any globals. For more
information about the use of synchronization primitives, refer to the documentation about
using operating system synchronization objects that came with your development tools.