146
Chapter 9
Measurement Applications (Sample Programs)
Sorting Measurement Results Using Comparator
Example 9-14
Sorting Measurement Results Using Comparator
Sub Example14()
'===================================
' Configuration
'===================================
Dim defrm As Long 'Session to Default Resource Manager
Dim Agte4981a As Long 'Session to instrument
Dim TRG_Result As String * 500
Dim BIN_Result As String * 500
Dim OVLD_Result As String * 500
Dim Res As Variant
Dim Finish_pros As String * 1
Dim Nop As Integer, i As Integer
Const TimeOutTime = 30000
On Error GoTo ErrorHandler
'===================================
' Open Instrument
'===================================
ErrorCheck viOpenDefaultRM(defrm)
Call SelectMode(defrm, Agte4981a)
ErrorCheck viSetAttribute(Agte4981a, VI_ATTR_TMO_VALUE,
TimeOutTime)
'===================================
' Setup Start
'===================================
ErrorCheck viVPrintf(Agte4981a, "SYST:PRES;*CLS" + vbLf, 0) '
Preset the E4981A
ErrorCheck viVPrintf(Agte4981a, ":CALC1:FORM CP" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, ":CALC2:FORM D" + vbLf, 0)
ErrorCheck viVPrintf(Agte4981a, ":SOUR:FREQ 1E3" + vbLf, 0)