Chapter 3
Developing Your Application
© National Instruments Corp.
3-7
NI-488.2M SRM for OS/2
Using ibic to Communicate with Devices
Before you begin writing your application program, you might want to use the
ibic
utility. With
ibic
(Interface Bus Interactive Control), you communicate
with your instruments from the keyboard rather than from an application
program. You can use
ibic
to learn to communicate with your instruments
using the NI-488 functions or NI-488.2 routines. For specific device
communication instructions, refer to the user manual that came with your
instrument. For information about using
ibic
and for detailed examples, refer
to Chapter 5, ibic—Interface Bus Interactive Control Utility.
After you have learned how to communicate with your devices in
ibic
, you are
ready to begin writing your application program.
Writing Your NI-488 Application
This section discusses items you should include in your application program,
general program steps, and examples.
Items to Include
•
Include the GPIB header file. This file contains prototypes for the
NI-488 functions and constants that you can use in your application
program. Include the declaration file appropriate for your compiler as
follows:
#include "decl.h"
/* 32-bit C compiler */
#include "decl_16.h"
/* 16-bit C compiler */
•
Check for errors after each NI-488 function call.
•
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
follows
void gpiberr (char *msg);
/* function prototype */
your application invokes the function as follows
if (ibsta & ERR) {
gpiberr("GPIB error");
}