Developing Your Application
Chapter 3
NI-488.2M UM for Windows NT
3-6
© National Instruments Corp.
ibcntl
is the number of bytes received. Data begins in the array at index zero (0);
therefore,
ibcntl
is the position for the null character that marks the end of the string.
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.
Writing Your NI-488 Application
This section discusses items you should include in your application program, general
program steps, and an NI-488 example. In this manual the example code is presented in
C using the standard C language interface. The NI-488.2M software includes the source
code for this example written in C (
devsamp.c
) and the source code for this example
written to use direct entry to access the
gpib -32.dll
(
dlldev.c
).
The NI-488.2M software also includes the source code for nine application examples,
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 functions and constants that you can use in your application program.
•
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:
void gpiberr (char * msg);
/* function prototype */
then your application invokes it as follows:
if (ibsta & ERR) {
gpiberr("GPIB error");
}