beautypg.com

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

Page 252

background image

II. SOFTWARE GUIDES - 10. Driver488/W31

10F. Visual Basic

Personal488 User’s Manual, Rev. 3.0

II-237

Note:

This Event table mirrors the Arm Condition table found under the topic “System Controller,
Not Active Controller Mode” in the Sub-Chapter “Operating Modes” of Chapter 9.

To use an IEEE 488 Event Custom Control:

1.

Click on the IEEE 488 tool in the toolbox and insert it on the form.

2.

Enable the properties that specify the events you wish to trap.

3.

Open the Code window for the IEEE 488 Event Custom Control.

4.

For each property you enabled, open the Procedure window that corresponds to the property and
write code enabling the program to perform the actions needed when the IEEE 488 event occurs.
When the IEEE 488 event occurs during program execution, the function associated with that
event will be called.

The upcoming example uses the programs of the ADC488 to issue an IEEE 488

SRQ

when it needs

servicing. The IEEE 488 Event Custom Control will be programmed to trap the

SRQ

and the ADC488

will be serviced.

In every Visual Basic program using Driver488/W31, a file of declarations must be merged into the
program, typically to the

GLOBAL.BAS

file. In the following example, those declarations have been

omitted from the listing for the sake of brevity.

With the associated source files, the following program can be built using the file

EXAMPLE3.MAK

found on the Driver488/W31 disk.

This example has several declarations that will be used later:

Declare Function FindWindow Lib “User” (ByVal data1$, ByVal data2$) As

Integer

Declare Function SendMessage Lib “User” (ByVal winHandle%, ByVal

message%, ByVal wp%, ByVal lp As Long) As Integer

The following declarations are included in the General section of the form, and are assumed through
the remainder of the discussion:

Dim nl As String * 2
Dim mystring As String
Dim substat As IeeeStatus
Dim adc As Integer
Dim response As String * 256
Dim intResp(500) As Integer
Dim voltage As Single
Dim sum As Single
Dim noterm As terms
Dim sample As String * 7

Event

Description

SRQ

The Service Request bus line is asserted.

Peripheral

An addressed status change has occurred and the interface is a Peripheral.

Controller

An addressed status change has occurred and the interface is an Active Controller.

Trigger

The interface has received a device

Trigger

command.

Clear

The interface has received a device

Clear

command.

Talk

An addressed status change has occurred and the interface is a Talker.

Listen

An addressed status change has occurred and the interface is a Listener.

Idle

An addressed status change has occurred and the interface is neither a Talker nor a

Listener.

ByteIn

The interface has received a data byte.

ByteOut

The interface has been configured to output a data byte.

Error

A Driver488/W31 error has occurred.

Change

The interface has changed its addressed state. The Controller/Peripheral or

Talker/Listener/Idle states of the interface have changed.