Chapter 2

Programming Examples

Using This Chapter

This chapter provides examples and descriptions of the most common operations using the HP E1418A. Use this chapter to gain an overview of how to program the module, and to obtain programming hints. The examples shown in this chapter are in ANSI C and use SCPI commands to control the module. The SCPI commands are described in detail in Chapter 3 of this manual. SCPI usage conventions and syntax rules are described beginning on page 60.

This chapter is divided into the following sections:

Querying Module Identification and Configuration . . . . . . . . . Page 40

APPLy Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 45

Error Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 47

SOURce Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 50

Setting the Output Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 52

Controlling the Output Relay. . . . . . . . . . . . . . . . . . . . . . . . . Page 53

Triggering. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 54

Using *OPC? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Page 56

Combining Output Channels . . . . . . . . . . . . . . . . . . . . . . . . . Page 57

Program Examples Example programs in ANSI C format are included on the driver CD supplied with the HP E1418A. Most examples in this chapter are included. The examples are ASCII files with the *.c extension.

Note The int data type is system dependent. These examples were developed on a system where int is a 16-bit integer. Other systems may define int to be a different width.

In the examples, the HP VISA Transition Library is used for I/O operations with the VXIbus. An HP command module (HP E1405/E1406) is used and controlled via HP-IB.

To use the HP VISA Transition Library (abbreviated as VTL), include the visa.h header file.

#include visa.h

Chapter 2

Programming Examples 39

Page 39
Image 39
HP E1418A manual Programming Examples