Other topics about Sample Programs
The sample program performs 1-port or 2-port calibration using ECal.
See Calibration for this programming.
Dim ioMgr As VisaComLib.ResourceManager
Dim Ena As VisaComLib.FormattedIO488
Sub ECal_Click()
Dim Ch As String
Dim Port As String
Ch = Cells(5, 5) 'Select channel
Port = Cells(3, 6) 'Select port.
Set ioMgr = New VisaComLib.ResourceManager
Set Ena = New VisaComLib.FormattedIO488
'*** Open the instrument.
Set Ena.IO = ioMgr.Open("GPIB0::17::INSTR")
Ena.IO.timeout = 10000#
Ena.WriteString "*RST", True 'Presets the setting state of the ENA.
Ena.WriteString "*CLS", True 'Clears the all status register.
Select Case Cells(3, 5)
Case "1 Port"
Call ECal_Exe(Ch, 1, Port) 'Perform 1-port calibration.
Case "2 Port"
Call ECal_Exe(Ch, 2, 0) 'Perform full 2-port calibration.
End Select
Ena.IO.Close 'Closes the resource manager session.
End
End Sub
Sub ECal_Exe(Ch As String, NumPort As String, Port As String)
Select Case NumPort
Case 1
MsgBox ("Connect Ecal to Port " & Port & ". then click [OK] button") 'Display the message box.
Ena.WriteString ":SENS" & Ch & ":CORR:COLL:ECAL:SOLT1 " & Port, True 'Execute the 1-port calibration.
Case 2
MsgBox ("Connect Ecal to Ports 1 and 2. then click [OK] button") 'Display the message box.
Ena.WriteString ":SENS" & Ch & ":CORR:COLL:ECAL:SOLT2 1,2", True 'Execute the full 2-port calibration.
End Select
Call ErrorCheck 'Checking the error.
End Sub
Sub ErrorCheck()
Dim Err As Variant, Response
Ena.WriteString ":SYST:ERR?", True 'Reads error message.
Err = Ena.ReadList
If Val(Err(0)) <> 0 Then
Response = MsgBox(Err(1), vbOKOnly) 'Display the message box.
End If
End Sub