Error function (iberr), Error function (iberr) -8 – National Instruments NI-488.2 User Manual

Page 45

Advertising
background image

Chapter 4

Developing Your NI-488.2 Application

NI-488.2 User Manual

4-8

ni.com

The language header file defines each

Ibsta

status bit. 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 Function (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

.

CMPL

8

100

dev, brd

I/O completed

LOK

7

80

brd

Lockout State

REM

6

40

brd

Remote State

CIC

5

20

brd

Controller-In-Charge

ATN

4

10

brd

Attention is asserted

TACS

3

8

brd

Talker

LACS

2

4

brd

Listener

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

Value

Type

Description

Advertising