Download Print this page

Agilent Technologies E3632A User Manual page 141

Dc power supply
Hide thumbs Also See for E3632A:

Advertisement

Chapter 6 Application Programs
Excel 5.0 Example for Windows 3.1 and GPIB
...continued
If InStr(SCPICmd, "?") Then
errorStatus = viRead(vi, ByVal readbuf, 512, actual)
ReturnString = readbuf
'Strip out any nul's from the response string.
crlfpos = InStr(ReturnString, Chr$(0))
If crlfpos Then
ReturnString = Left(ReturnString, crlfpos - 1)
End If
SendSCPI = ReturnString
End If
Exit Function
VIerrorHandler:
'Display the error message in the txtResponse TextBox
MsgBox " I/O Error: " & Error$()
'Close the device session
errorStatus = viClose(vi)
Exit Function
End Function
Sub OpenPort()
Dim VISAaddr As String
'****************************
'Change the GPIB address here
'****************************
VISAaddr = "5"
errorStatus = viOpenDefaultRM(videfaultRM)
'Open communication to instrument
errorStatus = viOpen(videfaultRM, "GPIB0::" & VISAaddr & "::INSTR",0, 1000, vi)
If errorStatus < VI_SUCCESS Then
Cells(1, 1) = "Unable to Open port"
End If
End Sub
Sub ClosePort()
errorStatus = viClose(vi)
'close the session
errorStatus = viClose(videfaultRM)
End Sub
End of Program
138
'If a query read the response string
'return the remaining string
' end of query to instrument for a response
'open the visa session
' on error give message

Advertisement

loading