beautypg.com

Configuration of named devices – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 158

background image

II. SOFTWARE GUIDES - 9. Driver488/SUB

9C. External Device Interfacing

Personal488 User’s Manual, Rev. 3.0

II-143

Driver488/SUB communicates directly with I/O adapters such as an IEEE 488 interface board or a
serial (RS-232C) port. More than one I/O adapter may reside on a single plug-in board. For example,
an RS-232C board often contains two or four functionally separate I/O adapters, one for each port. The
IEEE 488 interface board contains the IEEE 488 I/O adapter.

I/O adapters connect to external devices such as digitizers, multimeters, plotters, and oscilloscopes
(IEEE 488 interface); and serial devices such as printers, plotters, and modems (serial RS-232C port).
Driver488/SUB allows direct control of both IEEE 488 external devices and other external devices
such as an RS-232C plotter.

Driver488/SUB is controlled by sending data and commands and receiving responses and status by
subroutine calls. This method is the only Application Program Interface, API, available to connect the
application (user’s) program to Driver488/SUB.

Subroutine Calls

The subroutine API is a library of subroutines linked to the application program that are invoked like
any other subroutines in that programming language. Once invoked, these routines can control
Driver488/SUB.

Configuration of Named Devices

Named devices provide a method to maintain a permanent record of an external device’s configuration
that does not change between application programs. Once the configuration of a particular external
device is established, its Driver488/SUB configuration for that device will remain the same until the
next time you reconfigure it or unload and reload the driver. The external devices supported by
Driver488/SUB are: IEEE 488 external devices and serial external devices.

External devices are most easily configured at installation. For Driver488/SUB, the device names,
terminators, timeout period, and bus addresses may be entered into a configuration file which contains
the device configuration information. This configuration file is automatically read during driver load to
install the configured named devices. The application program can then refer to the external device by
name and have all of the configuration information automatically set.

Every device to be accessed by Driver488/SUB must have a valid device name. Driver488/SUB comes
with several device and interface names preconfigured for use. Among those already configured for the
GP488B board, for example, are:

IEEE

and

DEV

. You can configure up to 32 external devices for each

IEEE 488 interface.

DEV

can be used to create other devices.

It is also possible to configure new named devices by using the Driver488/SUB command

MakeDevice

. The

MakeDevice

command creates a temporary device that is an identical copy of an

already existing Driver488/SUB device. The new device has default configuration settings identical to
those of the existing device. The new device can then be reconfigured by calling the proper functions,
such as

BusAddress

,

IntLevel

, and

TimeOut

. When Driver488/SUB is closed, the new device is

forgotten unless the

KeepDevice

command is used to make it permanent.

The following code illustrates how the subroutine API version of the

MakeDevice

command could be

used to configure several new named devices. Using the C language subroutine interface, three named
devices can be configured as follows:

dev = OpenName (“dev”)
dmm = MakeDevice (dev, “DMM”);
if (dmm == -1) {process error . . .}
err = BusAddress (dmm, 16, NOADDRESS);
if (err == -1) {process error . . . }
term.EOI = TRUE;
term.nChars = 2;
term.termChar [0] = ‘\r’;
term.termChar [1] = ‘\n’;
err=Term (dmm, &term, BOTH);
if (err == -1 {process error . . . }