beautypg.com

What is a device handle – Measurement Computing Personal488 rev.3.0 User Manual

Page 61

background image

Personal488 for Windows 95/98/Me/NT/2000

04-09-01

Using IEEE 488 5-7

What is a device handle?

In its simplest form, a handle is merely a reference or pointer to a specific device on the IEEE 488 bus.
One might ask why not use the IEEE 488 address instead of handles? Drivers of the past did indeed work
this way, however, when issues such as devices with different EOS terminators or time-out setting arose,
control became difficult. Hence, handles are method of conveying not just an address, but also EOS and
time-out information for each device. In addition, it is valid to have multiple handles for one device. For
example, a device might use EOS terminators for setup commands, but when data is downloaded,
specifically binary, it might be more convenient to have a handle where EOS is set to none.

If you have not already done so, select your device from the devHandle drop down box and press the
OpenName button. For the sake of discussion, we chose our device called Wave.

The Name (devHandle) combo box lists
all the available pre-configured devices.

When the OpenName button is pressed, the function OpenName is actually called. The parameter that
OpenName accepts is a string that represents a name of a pre-configured device. If the string name does
not exist, a handle is not created. For this example, we see that the device Wave is now open and the
function display area shows the actual function call with parameters.

In the function display area, the left-hand number in parenthesis is the value returned by the function call
during execution. Generally, if the command is successfully completed, the number is zero (0) and if an
error occurred it is minus one (–1). Other functions such as Output, Enter and Spoll return more
meaningful values such as the number of characters transferred or the serial poll status byte. Refer to the
API reference section for more detailed meanings of function return values.

A typical communication sequence consists of

opening a device

sending setup commands

reading data

The following screen shots demonstrate this sequence.

Note that opening a device returns a handle that is used in all subsequent calls. The handle is merely an
instrument descriptor containing address, terminator, and time out information.

This manual is related to the following products: