E5071C
1182
ECal
• Overview
• Sample Program in Excel VBA
• Sample Program in HT Basic
Other topics about Sample Programs
Overview
The sample program performs 1-port or 2-port calibration using ECal.
See Calibration for this programming.
Sample Program in Excel VBA
Sub ECal_Click()
Dim defrm As Long 'Session to Default Resource Manager
Dim vi As Long 'Session to instrument
Dim Ch As String
Dim CalKit As Integer
Dim Port(4) As String
Const TimeOutTime = 40000 'timeout time.
Ch = Cells(5, 5) 'Select channel
Port(1) = Cells(3, 6) 'Sets the select port 1.
Port(2) = Cells(3, 7) 'Sets the select port 2.
Port(3) = Cells(3, 8) 'Sets the select port 3.
Port(4) = Cells(3, 9) 'Sets the select port 4.
Call viOpenDefaultRM(defrm) 'Initializes the VISA system.
Call viOpen(defrm, "GPIB0::17::INSTR", 0, 0, vi) 'Opens the session to the specified instrument.
Call viSetAttribute(vi, VI_ATTR_TMO_VALUE, TimeOutTime) 'The state of an attribute for the
specified session.
Call viVPrintf(vi, "*RST" & vbLf, 0) 'Presets the setting state of the ENA.
Call viVPrintf(vi, "*CLS" & vbLf, 0) 'Clears the all status register.
Select Case Cells(3, 5)
Case "1 Port"
Call ECal(vi, Ch, 1, Port) 'Perform 1-port calibration.
Case "2 Port"
Call ECal(vi, Ch, 2, Port) 'Perform full 2-port calibration.