Chapter 3 Developing Your Application
© National Instruments Corp. 3-11 NI-488.2 User Manual for Windows
Writing Your NI-488.2 Application
This section discusses items you should include in an application program that uses
NI-488.2 routines, general program steps, and an NI-488.2 example. In this manual the
example code is presented in C. The NI-488.2 software includes the source code for C
(samp4882.c), Visual Basic (samp4882.bas), direct entry functions in C
(dll4882.c), and direct entry functions in Visual Basic (dll4882.bas).
The NI-488.2 software also includes the source code for nine example programs, which
are described in Chapter 2, Application Examples.
Items to Include
• Include the appropriate GPIB header file. This file contains prototypes for the
NI-488.2 routines and constants that you can use in your application program.
• Check for errors after each NI-488.2 routine.
• Declare and define a function to handle GPIB 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 ("GPIB error");
}