National Instruments NI-488.2 ユーザーズマニュアル

ページ / 135
Chapter 3
Developing Your NI-488.2 Application
3-4
www.natinst.com
Choosing How to Use the NI-488.2 API
The 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 Device
If 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 are a set of low-level functions that perform rudimentary GPIB 
applications. If you use these functions, you need to understand GPIB 
management details like how to address talkers and listeners. Refer to 
Appendix A, 
, for some details on GPIB management. 
The set of low-level functions are called board-level functions. They access 
the interface directly and require you to handle the addressing and bus 
management protocol. These functions give you the flexibility and control 
to handle situations such as the following:
Communicating with non-compliant (non-IEEE 488.2) devices.
Altering various low-level interface configurations.
Managing the bus in non-typical ways.