Chapter 3 Developing Your NI-488.2 Application
NI-488.2 User Manual for Windows 3-10 www.natinst.com
Applications That Use Multiple Interfaces or Communicate with
Multiple GPIB Devices
This section describes items you should include in your application and
provides general program steps with an NI-488.2 example.
Items to Include
Include the following items in your application:
• Header files—In a C application, include the header files
windows.h
and
decl-32.h
. The standard Windows header file,
windows.h
,
contains definitions used by
decl-32.h
, and
decl-32.h
contains
prototypes for the NI-488.2 calls and constants that you can use in your
application.
• Error checking—Check for errors after each NI-488.2 call.
• Error handling—Declare and define a function to handle NI-488.2
errors. This function takes the device offline and closes the application.
If the function is declared as:
void gpiberr (char * msg); /*function prototype*/
Then your application invokes it as follows:
if (ibsta & ERR) {
gpiberr("NI-488.2 error");
}
General Program Steps and Examples
The following steps show you how to use the multi-device NI-488.2 calls
in your application. The NI-488.2 software includes the source code for an
example written in C,
4882query.c
, and the source code for the example
written to use direct entry to access the
gpib-32.dll
,
dll4882query.c
.
The NI-488.2 software also includes a sample program written in Visual
Basic,
query4882.frm
.
Initialization
Step 1. Become Controller-In-Charge (CIC)
Use
SendIFC
to initialize the bus and the GPIB interface so that the GPIB
interface is Controller-In-Charge (CIC). The only argument of
SendIFC
is
the GPIB interface number, typically 0 for
GPIB0
.