Chapter 4 Developing Your NI-488.2 Application
© National Instruments Corporation 4-3 NI-488.2 User Manual
Linux
NI-488.2 has libgpibapi.so—a dynamic library you can use from your
C/C++ applications. Refer to the Language-Specific Programming
Instructions for Linux section for more details on how to develop your
application.
Choosing How to Use the NI-488.2 APIThe NI-488.2 API has two subsets of calls to meet your application needs.
Both of these sets, the traditional calls and the multi-device calls, are
compatible across computer platforms and operating systems, so you can
port programs to other platforms with little or no source code modification.
For most applications, the traditional NI-488.2 calls are sufficient. If you
have a complex configuration with one or more interfaces and multiple
devices, use the multi-device NI-488.2 calls. Whichever option you
choose, bus management operations necessary for device communication
are performed automatically.
The following sections describe some differences between the traditional
NI-488.2 calls and the multi-device NI-488.2 calls.
Communicating with a Single GPIB DeviceIf your system has only one device attached to each interface, the traditional
NI-488.2 calls are probably sufficient for your programming needs.
A typical NI-488.2 application with a single device has three phases:
• Initialization: use ibdev to get a handle and use ibclr to clear the
device.
• Device Communication: use ibwrt, ibrd, ibtrg, ibrsp, and
ibwait to communicate with the device.
• Cleanup: use ibonl to put the handle offline.
Refer to the sample applications that are installed with the NI-488.2
software to see detailed examples for different GPIB device types.
For NI-488.2 applications that need to control the GPIB in non-typical
ways—for example, to communicate with non-compliant GPIB
devices—there is a set of low-level functions that perform rudimentary
GPIB functions. If you use these functions, you need to understand GPIB
management details such as how to address talkers and listeners. Refer to
Appendix A, GPIB Basics, for some details on GPIB management.