Ibnotify Programming Example - National Instruments NI-488.2 User Manual

National instruments user manual ni-488.2
Hide thumbs Also See for NI-488.2:
Table of Contents

Advertisement

Note
The
of your application. If your application will be performing other NI-488.2 operations while
it is using
ThreadIbsta
in the
Writing Multithreaded Win32 NI-488.2 Applications
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 Win32 synchronization objects that came with your development tools.

ibnotify Programming Example

© National Instruments Corporation
GPIB device to request service, you might choose to pass
with RQS (for device-level) or SRQI (for board-level).
mask
The callback function that you register with the
by the NI-488.2 driver when one or more of the mask bits passed to
is TRUE. The function prototype of the callback is as follows:
ibnotify
int __stdcall Callback (
int ud,// unit descriptor
int ibsta,// ibsta value
int iberr,// iberr value
long ibcntl,// ibcntl value
void * RefData// user-defined reference data
)
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
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
, refer to the NI-488.2 online help. For instructions on accessing
ibnotify
the online help, refer to the
About This
Manual.
callback is executed in a separate thread of execution from the rest
ibnotify
, use the per-thread NI-488.2 globals that are provided by the
ibnotify
,
,
ThreadIberr
The following code is an example of how you can use
application. Assume that your GPIB device is a multimeter that you
program it to acquire a reading by sending "
requests service when it has a reading ready, and each reading is a floating
point value.
In this example, globals are shared by the
thread, and the access of the globals is not protected by synchronization.
In this case, synchronization of access to these globals is not necessary
Chapter 7
call. The NI-488.2 driver interprets the
ibnotify
Using the NI-488.2 Documentation
, and
ThreadIbcnt
ThreadIbcntl
7-5
NI-488.2 Programming Techniques
ibnotify
call is invoked
ibnotify
functions described
section of this chapter. In
ibnotify
. The multimeter
SEND DATA"
thread and the main
Callback
NI-488.2 User Manual for Windows
a
section in
in your

Advertisement

Table of Contents
loading

Table of Contents