Programming
1197
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.
Call viVPrintf(vi, ":SENS" & Ch & ":CORR:COLL:CKIT " & CalKit & vbLf, 0) 'Select the calibration kit.
Call Set_sgm_tbl(vi, Ch) 'Configures the segment table.
Select Case Cells(3, 6) 'Sets the read/write.
Case "Read"
Call Cal_Slot(vi, Ch, 2, Port) 'Full 2-Port Calibration.
Case "Write"
Call viVPrintf(vi, ":SENS" & Ch & ":CORR:COEF:METH:SOLT2 1,2" & vbLf, 0) 'Sets the
calibration type to the full 2-port calibration.
End Select
Call viVPrintf(vi, ":SENS" & Ch & ":SEGM:SWE:POIN?" & vbLf, 0) 'Reads out the total number of the
measurement points of all segments.
Call viVScanf(vi, "%t", Result)
Call Exec_Error_Term(vi, Ch, Val(Result), ErrTerm, Respons, Stimulus) 'Reads the error coefficient.
Call viClose(vi) 'Closes the resource manager session.
Call viClose(defrm) 'Breaks the communication and terminates the VISA system.
End
End Sub
Sub Exec_Error_Term(vi As Long, Ch As String, Nop As Long, ErrTerm As String, Respons As String,
Stimulus As String)
Dim Error_Term_Data As Variant
Dim Freq_Data As Variant
Dim i As Integer, j As Integer