beautypg.com

Confirming communications, Ieee 488 event custom control – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 251

background image

10F. Visual Basic

II. SOFTWARE GUIDES - 10. Driver488/W31

II-236

Personal488 User’s Manual, Rev. 3.0

always available within Driver488/W31, is used to clone a new device called

ADC

using the

MakeDevice

command.

GetError

is then called to clear the internal error registered within

Driver488/W31. Lastly, the IEEE bus address

14

is assigned to the

ADC

.

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

adc2% = MakeDevice(adc, “ADC2")
rv% = BusAddress(adc2, 10, -1)

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
were to create a device that could be accessed after this application ends, we must tell Driver488/W31
this:

rv%=KeepDevice (adc2)

After executing the above statement,

ADC2

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

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

rv%=RemoveDevice (adc2)

Confirming Communications

With or without an open device handle, the application can, if desired, confirm communication with
Driver488/W31 via the Hello function:

rv% = Hello(ieee%, response)
mystring = “”

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.

IEEE 488 Event Custom Control

The IEEE 488 Event Custom Control feature of Driver488/W31 allows a Visual Basic program to
respond to IEEE 488 bus events. This feature is represented by a tool icon in the toolbox containing
“488” within a double arrow which appears when the

IOTEVENT.VBX

file is included in the Project

window. To begin this program from the VB File menu, select the tool icon and then select

IOTEVENT.VBX

.

The IEEE 488 Event Custom Control has properties that correspond to IEEE 488
bus events that can be enabled or disabled. If an IEEE 488 Event Custom Control
property is enabled, the Visual Basic program will call a user written function
associated with the specified event when the event occurs. The IEEE 488 Event
Custom Control
has two other properties: the

Handle

property and the

CtrlName

property. The

Handle

property specifies the device that the events describe. The

CtrlName

property stores space for the name of an application text box. For more

information on

CtrlName

, refer to the topic “Dynamic Data Exchange (DDE)”

found later in this Sub-Chapter.

The IEEE 488 bus events that Driver488/W31 supports are shown in the following table:

IEEE 488 Event
Custom Control

Icon