Chapter 4 Developing Your NI-488.2 Application
NI-488.2 User Manual 4-6 ni.com
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 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 Chapter 5,
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 addition, ibcnt and ibcntl are updated after specific
488.2-style functions in certain error cases. Refer to the NI-488.2 Help
function reference for an explanation of how each function uses the count
variables .
ibcnt is defined to be the type int while ibcntl is the size of type long
int. For all cases, if the sizes of ibcnt and ibcntl are the same, ibcnt
and ibcntl are equal. If the size of ibcnt is smaller than the size
of ibcntl, ibcnt is equal to the low-order bits of ibcntl. For
cross-platform compatibility, all applications should use ibcntl.
DTAS 1 2 brd Device Trigger State
DCAS 0 1 brd Device Clear State
Table 4-1. Status Word Layout (Continued)
Mnemonic
Bit
Pos
Hex
Valu e Type Description