beautypg.com

Confirming communications, Setting up event handling – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 176

background image

II. SOFTWARE GUIDES - 9. Driver488/SUB

9F. QuickBASIC

Personal488 User’s Manual, Rev. 3.0

II-161

Driver488/SUB, to clone a new device called

ADC

using the

MakeDevice

command. Lastly, the IEEE

bus address

14

is assigned to the

ADC

.

adc% = ioOpenName% (“ADC”)
IF (adc% = 1) THEN

response$ = SPACES (256)
rv% = ioGetError% (ieee%, response$)
dev% =ioOpenName% (“DEVIEEE”)
adc% = ioMakeDevice% (dev%,”ADC”)
rv% = ioBusAddress% (adc%,14,-1)

END IF

If other devices were needed for the application at hand, they could either be defined in the startup
configuration for Driver488/SUB or they could be created on the fly from the application:

adc2% = ioMakeDevice% (adc%,”ADC2”) ;

/*Clone a new device */

rv% = ioBusAddress% (adc2%,10,-1) ;

// Set the bus address

The new device

ADC2

is configured to reside at a different bus address so that the two devices may be

distinguished. There is one other important difference between

ADC

and

ADC2

at this point.

ADC2

is a

temporary device; that is, as soon as the creating application closes,

ADC2

ceases to exist. If our intent

was to create a device that could be accessed after this application ends, we must tell Driver488/SUB
this:

rv%=ioKeepDevice% (adc2%) ;

After executing the above statement,

ADC2

is marked as being permanent; that is, the device will not be

removed when the creating application exists. If we later wish to remove the device, however, we can
do so explicitly:

rv%=ioRemoveDevice% (adc2) ;

Confirming Communications

With or without an open device handle, the application can, if desired, confirm communication with
Driver488/SUB via the

Hello

function:

The function also fills in a string from which information can be extracted if it is desirable to display
facts about the driver in use:

Setting Up Event Handling

If the event notification mechanism of Driver488/SUB is to be used, it should normally be set up
during application initialization and left in place until application shutdown. No special action is
required if event notification is not needed for the particular application. First, the

ONPEN GOSUB

and

PEN ON

functions establish the notification path by specifying the function to be called:

ON PEN GOSUB isr
PEN ON
rv% = ioLightPen% (ieee%, 1)

Either during initialization or at some appropriate later point in the application, specific event types
may be

Arm

ed or

Disarm

ed for use in the event system. Individual event types may be turned on and

off at will freely through the life of the application. In this case, we

Arm

to request notification of

IEEE 488 bus service requests:

rv% = ioArm% (ieee%, acSRQ)

To cease recognizing bus service requests, we might

Disarm

just the one class of events:

rv% = ioDisarm% (ieee%, acSRQ) ;

Or, to completely disable event notifications:

response$ = SPACES (256)
rv% = ioHello% (ieee%,response$)
PRINT response$