Device-level calls and bus management, Device-level calls and bus management -11 – National Instruments NI-488.2 User Manual

Page 83

Advertising
background image

Chapter 8

NI-488.2 Programming Techniques

© National Instruments Corporation

8-11

NI-488.2 User Manual

A quick way to convert your application to use per-thread NI-488.2 globals
is to add the following

#define

lines at the top of your C file:

#define ibsta

ThreadIbsta()

#define iberr

ThreadIberr()

#define ibcnt

ThreadIbcnt()

#define ibcntl

ThreadIbcntl()

Note

If you are using

ibnotify

in your application (refer to the

Asynchronous Event

Notification in NI-488.2 Applications

section of this chapter), the

ibnotify

callback

is executed in a separate thread that is created by the NI-488.2 driver. Therefore, if your
application makes NI-488.2 calls from the

ibnotify

callback function and makes

NI-488.2 calls from other places, you must use the

ThreadIbsta

,

ThreadIberr

,

ThreadIbcnt

, and

ThreadIbcntl

functions described in this section, instead of the

per-process NI-488.2 globals.

Device-Level Calls and Bus Management

The device-level traditional NI-488.2 calls are designed to perform all
of the GPIB management for your application. However, the NI-488.2
driver can handle bus management only when the GPIB interface is CIC
(Controller-In-Charge). Only the CIC is able to send command bytes to the
devices on the bus to perform device addressing or other bus management
activities.

If your GPIB interface is configured as the System Controller (default),
it automatically makes itself the CIC by asserting the IFC line the first
time you make a device-level call.

If the current CIC does not pass control, the NI-488.2 driver returns the
ECIC error code to your application. If this happens, you could send
a device-specific command requesting control for the GPIB interface.
Then, use a board-level

ibwait

command to wait for CIC.

Advertising