Developing Your Application
Chapter 3
NI-488.2M SRM for OS/2
3-4
© National Instruments Corp.
•
Specify board index, GPIB address, and termination parameters so that you
do not need to remember device names, unit descriptors, or termination
modes separately
•
Use routine names that are descriptive of their purpose
Using the OS/2 API Interface
If the NI-488.2 interface does not meet your requirements, you can access the
NI-488.2M driver through the OS/2 API interface. This interface uses the OS/2
standard device driver interface instead of a particular language interface.
Because this interface is supported by all devices, you can use it with all
development environments. Using the API interface, however, is not as easy as
using the NI-488.2 interface. Refer to Chapter 3, Application Program Interface
Function, in the NI-488.2M Function Reference Manual for OS/2, for more
information about the API functions.
Checking Status with Global Variables
Each NI-488 function and NI-488.2 routine updates the global variables to reflect
the status of the device or board that you are using. The status word (
ibsta
),
the error variable (
iberr
), and the count variables (
ibcnt
and
ibcntl
)
contain useful information about the performance of your application program.
Your program should check these variables frequently. The following sections
describe each of these global variables and how you can use them in your
application program.
Status Word—ibsta
All functions update a global status word,
ibsta
, which contains information
about the state of the GPIB and the GPIB hardware. The value stored in
ibsta
is the return value of all NI-488 functions except
ibfind
and
ibdev
. You can
test for the conditions reported in
ibsta
and use that information to make
decisions about continued processing. Also, if you check for possible errors after
each call, debugging your application is much easier.
ibsta
is a 16-bit value. A bit value of 1 indicates that a certain condition is in
effect. A bit value of 0 indicates that the condition is not in effect. Each bit in
ibsta
can be set for device calls (dev), board calls (brd), or both (dev, brd).