Chapter 3 Developing Your NI-488.2 Application
© National Instruments Corporation 3-7 NI-488.2 User Manual for Windows
The language header file defines each of the ibsta status bits. You can test
for an ibsta status bit being set using the bitwise and operator (& in
C/C++). For example, the ibsta ERR bit is bit 15 of ibsta.
To check for an NI-488.2 error, use the following statement after each
NI-488.2 call:
if (ibsta & ERR)
printf("NI-488.2 error encountered");

Error Variable (iberr)

If the ERR bit is set in ibsta, an NI-488.2 error has occurred. When an
error occurs, the error type is specified by iberr. To check for an NI-488.2
error, use the following statement after each NI-488.2 call:
if (ibsta & ERR)
printf("NI-488.2 error %d encountered", iberr);
Note The value in iberr is meaningful as an error type only when the ERR bit is set in
ibsta, indicating that an error has occurred.
For more information about error codes and solutions, refer to Chapter4,
Debugging Your Application, or Appendix C, Error Codes and Solutions.

Count Variables (ibcnt and ibcntl)

The count variables are updated after each read, write, or command
function. In Win32 applications, ibcnt and ibcntl are 32-bit integers.
On some systems, like MS-DOS, ibcnt is a 16-bit integer, and ibcntl is
a 32-bit integer. For cross-platform compatibility, all applications should
use ibcntl. If you are reading data, the count variables indicate the
number of bytes read. If you are sending data or commands, the count
variables reflect the number of bytes sent.
Using Interactive Control to Communicate with Devices
Before you begin writing your application, you might want to use the
Interactive Control utility to communicate with your instruments
interactively by typing in commands from the keyboard rather than from an
application. You can use the Interactive Control utility to learn to
communicate with your instruments using the NI-488.2 API. For specific
device communication instructions, refer to the user manual that came with
your instrument. For information about using the Interactive Control utility
and detailed examples, refer to Chapter 6, Interactive Control Utility.