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

10F. Visual Basic
II. SOFTWARE GUIDES - 10. Driver488/W31
II-238
Personal488 User’s Manual, Rev. 3.0
When the IEEE 488 Event Custom Control has been placed in your application, the following service
routine is made available. The particular subroutine is invoked when the ADC generates an
SRQ
on
“acquisition complete”.
Sub Event4881_Srq ()
‘Clear SRQ condition
rv% = spoll (adc)
‘Reset the buffer pointer of the ADC488
rv% = ioOutput (adc, “B0X”)
‘Get 100 readings from the ADC488
TextWindow.Text = “”
For i% = 1 to 100
rv% = Enter(adc, response)
TextWindow.Text = TextWindow.Text + response
Next i%
End Sub
The sole button on the form opens the pre-configured ADC then initializes it by clearing it. Next, the
IEEE 488 event handling is setup by affiliating the
Handle
property of the
Event4881
control to the
newly opened ADC handle. For the bus event to be captured and sent to the custom control, the ADC
handle must be left open.
Sub Command1_Click ()
‘Now opening a device named ADC
adc = OpenName (“ADC”)
If (adc = -1) Then
MsgBox “Cannot initialize device ADC”
End
End If
To activate this event (
SRQ
), the
SRQ
property of the IEEE controller must be set to
True
. At design-
time, select the IEEE 488 tool icon on your form, then select
SRQ
in the properties area. Set the
SRQ
property to
True
.
Note that upon closing the handle, all event handling associated with this control is disabled. You must
keep the device open during the time in which its events are of interest. That is, with an ADC488, you
would open the device, assign the handle to the Event Custom Control’s
Handle
property, configure
the
adc
with
ioOutput
commands, and then wait for the
SRQ
event to be triggered. The
SRQ
event
handler would read data from the ADC488 and then close the device, allowing other tasks access, and
eliminating the event notification. The data read from the ADC488, is displayed in the Driver488/W31
Custom Control Example window, as shown in the figure.
Data read from the ADC488