beautypg.com

Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 219

background image

10C. External Device Interfacing

II. SOFTWARE GUIDES - 10. Driver488/W31

II-204

Personal488 User’s Manual, Rev. 3.0

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

IEEE

and

WAVE

. You can configure up to 32 external devices for

each IEEE 488 interface.

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

MakeDevice

. The

MakeDevice

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

already existing Driver488/W31 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/W31 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:

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

adc = MakeDevice(WAVE,"ADC");
if (a == -1) { process error...}
err = BusAddress(adc,14,00);
if (err == -1) { process error...}
term.EOI = FALSE;
term.nChars = 1;
term.termChar[0] = ‘\n’;
err = Term(adc,&term,BOTH);
if (err == -1) { process error...}

scope = MakeDevice(WAVE,"SCOPE");
if (scope == -1) { process error...}
err = BusAddress(scope,12,01);
if (err == -1) { process error...}
term.EOI = TRUE;
term.nChars = 0;
err = Term(scope,&term,BOTH);
if (err == -1) { process error...}

The above example defines the following: An external device named

DMM

(digital multimeter) as

device

16

with bus terminators of carriage return (

\r

), line feed (

\n

), and

EOI

; a second external

device named

ADC

(analog-to-digital converter) as device

14

with bus terminators of carriage return

and line feed (together as

\n

); and a third external device named oscilloscope (

SCOPE

) as device

12

with bus terminators of

EOI

only.

External devices defined in a configuration file are permanent. Their definitions last until they are
explicitly removed or until the configuration file is changed and Driver488/W31 is restarted. Devices
defined after installation are normally temporary. They are forgotten as soon as the program finishes.
The

KeepDevice

command can be used to make these devices permanent. The

RemoveDevice

command removes the definitions of devices even if they are permanent. These commands are
described in further detail in the “Section III: Command Reference” of this manual.