Using HP SICL with HP-IB.pdf

(155 KB) Pobierz
4
Using HP SICL with HP-IB
Using HP SICL with HP-IB
The HP-IB interface (Hewlett-Packard Interface Bus) is Hewlett-Packard’s
implementation of the IEEE 488.1 Bus. Other IEEE 488 versions include
GPIB (General Purpose Interface Bus) and IEEE Bus. GPIB and HP-IB are
both used in the discussions and examples in this chapter. The HP-IB
related SICL functions have the string GPIB embedded in the function
name.
This chapter explains how to use SICL to communicate over HP-IB. In
order to communicate over HP-IB, you must have loaded the HPIB fileset
during the system installation. See the
HP I/O Libraries Installation and
Configuration Guide for HP-UX
for information.
This chapter describes in detail how to open a communications session and
communicate with HP-IB devices, interfaces, or controllers. The example
programs shown in this chapter are also provided in the
/opt/sicl/share/examples
directory on HP-UX 10, or the
/usr/pil/examples
directory on HP-UX 9.
This chapter contains the following sections:
Creating a Communications Session with HP-IB
Communicating with HP-IB Devices
Communicating with HP-IB Interfaces
Communicating with HP-IB Commanders
Summary of HP-IB Specific Functions
70
Chapter 4
Using HP SICL with HP-IB
Creating a Communications Session with HP-IB
Creating a Communications Session
with HP-IB
Once you have determined that your HP-IB system is setup and operating
correctly, you may want to start programming with the SICL functions.
First you must determine what type of communication session you need.
The three types of communications sessions are device, interface, and
commander.
Chapter 4
71
Using HP SICL with HP-IB
Communicating with HP-IB Devices
Communicating with HP-IB Devices
The device session allows you direct access to a device without worrying
about the type of interface to which it is connected. The specifics of the
interface are hidden from the user.
Addressing HP-IB Devices
To create a device session, specify either the interface
symbolic name
or
logical unit
and a particular device’s address in the
addr
parameter of
the
iopen
function. The interface
symbolic name
and
logical
unit
are defined during the system configuration. See the
HP I/O
Libraries Installation and Configuration Guide for HP-UX
for information
on these values.
The following are example HP-IB addresses for device sessions:
hpib,7
hpib,3,2
A device address corresponding to the device at
primary address 7 and symbolic name
hpib
.
A device address corresponding to the device at
primary address 3, secondary address 2, and
symbolic name
hpib
.
A device address corresponding to the device at
primary address 9, secondary address 0, and
symbolic name
hpib
.
hpib,9,0
Note
The above examples use the default
symbolic name
specified during the
system configuration. If you want to change the name listed above, you
must also change the
symbolic name
or
logical unit
specified
during the configuration. The name used in your SICL program must match
the
logical unit
or
symbolic name
specified in the system
configuration. Other possible interface names are
GPIB, gpib, HPIB,
etc.
72
Chapter 4
Using HP SICL with HP-IB
Communicating with HP-IB Devices
SICL supports both primary and secondary addressing on HP-IB interfaces.
Remember that the primary address must be between 0 and 30 and that the
secondary address must be between 0 and 30. The primary and secondary
addresses correspond to the HP-IB primary and secondary addresses.
Note
If you are using an HP-IB Command Module to communicate with VXI
devices, the secondary address must be specified to select a specific
instrument in the cardcage. Secondary addresses of 0, 1, 2, . . .31 correspond
to VXI instruments at logical addresses of 0, 8, 16, . . . 248, respectively.
The following is an example of opening a device session with an HP-IB
device at bus address 16:
INST dmm
dmm = iopen ("hpib,16");
Chapter 4
73
Zgłoś jeśli naruszono regulamin