Programming
1173
Select Case Cells(3, 5)
Case "Response (Open)" 'Perform response calibration (OPEN).
Call Cal_Resp(vi, Ch, "OPEN", Port(1))
Case "Response (Short)" 'Perform response calibration (SHORT).
Call Cal_Resp(vi, Ch, "Short", Port(1))
Case "Response (Thru)" 'Perform response calibration (Thru).
Call Cal_RespThru(vi, Ch, "Thru", Port(1), Port(2))
Case "Full 1 Port" 'Perform 1-port calibration.
Call Cal_Slot(vi, Ch, 1, Port)
Case "Full 2 Port" 'Perform full 2-port calibration.
Call Cal_Slot(vi, Ch, 2, Port)
Case "Full 3 Port" 'Perform full 3-port calibration.
Call Cal_Slot(vi, Ch, 3, Port)
Case "Full 4 Port" 'Perform full 4-port calibration.
Call Cal_Slot(vi, Ch, 4, Port)
End Select
Call viClose(vi) 'Closes the resource manager session.
Call viClose(defrm) 'Breaks the communication and terminates the VISA system.
End 'End
End Sub
Sub Cal_Resp(vi As Long, Ch As String, CalType As String, Port As String)
Dim Dummy As Variant 'Variant to receive the result
Call viVPrintf(vi, ":SENS" & Ch & ":CORR:COLL:METH:" & CalType & " " & Port & vbLf, 0) 'Sets the
calibration type.
MsgBox ("Set " & CalType & " to Port " & Port & ". then click [OK] button") 'Display the message box.
Call viVPrintf(vi, ":SENS" & Ch & ":CORR:COLL:" & CalType & " " & Port & vbLf, 0) 'Measurement the
calibration data.
Call viVQueryf(vi, "*OPC?" & vbLf, "%t", Dummy) 'Reads the *OPC? result.
Call viVPrintf(vi, ":SENS" & Ch & ":CORR:COLL:SAVE" & vbLf, 0) 'Calculating the calibration
coefficients.
Call ErrorCheck(vi) 'Checking the error.