E4990A Help
270
Sub IEventHandler_HandleEvent( _
ByVal Ana As VisaComLib.IEventManager, _
ByVal SRQevent As VisaComLib.IEvent, _
ByVal userHandle As Long)
' Once the SRQ is detected, then get the data
Call ReadData
End Sub
Sub UserForm_Initialize()
' Instrument I/O declarlation
Set ioMgr = New VisaComLib.ResourceManager
Set Ana = New VisaComLib.FormattedIO488
' Open the instrument. Set the GPIB address
' You can change VISA address
Set Ana.IO = ioMgr.Open("GPIB0::17::INSTR")
' TimeOut time should be greater than the measurement time.
Ana.IO.timeout = 100000
' SRQ declarlation
Set SRQ = Ana.IO
SRQ.InstallHandler EVENT_SERVICE_REQ, Me
SRQ.EnableEvent EVENT_SERVICE_REQ, EVENT_HNDLR
' Clears the operation status event register and the status byte register.
Ana.WriteString "*CLS", True
' Aborts the trigger and sets the trigger source to the bus trigger.
Ana.WriteString ":TRIG:SOUR BUS", True
Ana.WriteString ":INIT:CONT ON", True
Ana.WriteString ":ABOR", True
' Sets the positive transition filter to 0 and the negative transition filter to 1 so that the operation status
event register at bit 4 is set to 1 only when the
' operation status condition register at bit 4 is changed from 1 to 0.
Ana.WriteString ":STAT:OPER:PTR 0", True