EasyManua.ls Logo

National Instruments NI-488.2 NI-488.2 User Manual

National Instruments NI-488.2 NI-488.2
134 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #83 background imageLoading...
Page #83 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.

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the National Instruments NI-488.2 NI-488.2 and is the answer not in the manual?

National Instruments NI-488.2 NI-488.2 Specifications

General IconGeneral
Operating SystemsWindows, Linux, macOS
Programming LanguagesC, C++, Python, LabVIEW
InterfaceGPIB
Supported StandardsIEEE 488.2
FunctionalityGPIB instrument control, data acquisition, and analysis

Summary

Chapter 1 Introduction

Setting Up and Configuring Your System

Describes how to set up and configure your GPIB system.

Chapter 2 Measurement & Automation Explorer (Windows)

Troubleshoot NI-488.2 Problems

Instructions for using the NI-488.2 Troubleshooting Utility.

Chapter 3 GPIB Explorer (Mac OS X and Linux)

Chapter 4 Developing Your NI-488.2 Application

Interactive Instrument Control

Using the Interactive Control utility for instrument communication.

Choosing How to Use the NI-488.2 API

Guidance on selecting between traditional and multi-device NI-488.2 API calls.

Checking Status with Global Variables

Explains how to use global status variables (ibsta, iberr, etc.).

Chapter 5 Debugging Your Application

NI Spy

Introduction to NI Spy utility for monitoring NI-488.2 calls.

Global Status Variables

Details on global status variables (ibsta, iberr, ibcnt, ibcntl).

NI-488.2 Error Codes

Explanation of error variable (iberr) and error codes.

Chapter 6 NI Spy Utility

Chapter 7 Interactive Control Utility

Chapter 8 NI-488.2 Programming Techniques

High-Speed Data Transfers (HS488)

Describes the HS488 protocol for high-speed GPIB data transfer.

Enabling HS488

Instructions on how to enable the HS488 feature for GPIB interfaces.

Asynchronous Event Notification in NI-488.2 Applications

Using ibnotify for asynchronous notification of GPIB events.

Appendix C Error Codes and Solutions

GPIB Error Codes

Lists and describes GPIB error codes and their meanings.

EDVR (0)

Explains the EDVR error and provides solutions for accessing issues.