Calibration Procedures 3
Keysight E3633A and E3634A Service Guide 93
Private Function CheckError(Error As Long, Message As String) As Boolean
If Error < VI_SUCCESS Then
ActiveCell.Value = Message
CheckError = False 'Exit Calibration
Else
CheckError = True
End If
End Function
Private Function ClosePort()
Dim Error As Long
Error = viClose(power)
Error = viClose(id_power)
Error = viClose(DMM)
Error = viClose(id_DMM)
End Function
Private Function EnableOVPandOCP(bEnable As Boolean)
If bEnable Then
SendSCPI power, "Volt:Prot:Stat On"
SendSCPI power, "Curr:Prot:Stat On"
Else
SendSCPI power, "Volt:Prot:Stat Off"
SendSCPI power, "Curr:Prot:Stat Off"
End If
End Function
'This routine send a SCPI command string to the GPIB port.
'If the command contains a question mark, the response is read, and returned
Private Function SendSCPI(device As Long, command As String) As String
Dim commandString As String
Dim ReturnString As String
Dim crlfpos As Integer
Dim ReadBuffer As String * 512
Dim actual As Long
Dim Error As Long
commandString = command & Chr$(10)
Error = viWrite(device, ByVal commandString, Len(commandString), actual)
If InStr(commandString, "?") Then
Error = viRead(device, ByVal ReadBuffer, 512, actual)
ReturnString = ReadBuffer
crlfpos = InStr(ReturnString, Chr$(0))
If crlfpos Then
ReturnString = Left(ReturnString, crlfpos - 2)
End If
SendSCPI = ReturnString
End If
End Function
Private Function delay(delay_time As Single)
'This routine is used to create delays
Dim Finish As Single
Finish = Timer + delay_time
Do
Loop Until Finish <= Timer
End Function
Continued on next page