⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8960demo.frm

📁 通过VB, GPIB协议控制测试仪器, 实现测试自动化, 这个行业的人才有些缺乏, 本人愿意分享
💻 FRM
📖 第 1 页 / 共 2 页
字号:
    ModSpectrumOffset(5) = 250000#
    J = 6
    For I = 4 To 18 Step 2

        ModSpectrumOffset(J) = -I * 100000#

        ModSpectrumOffset(J + 1) = I * 100000#
        J = J + 2
    Next I
      
    ErrorStatus = age1960_confORFS(vi, 5, 5, age1960_TRIG_AUTO, _
                                   0, 8, SwitchSpectrumOffset(0), 22, ModSpectrumOffset(0), 5)
    If CheckError(ErrorStatus) = True Then Exit Sub

    ' Configure BER
    ErrorStatus = age1960_confBER(vi, 10000, age1960_BER_RES_TYPE_II, 5, _
                                      VI_TRUE, VI_TRUE, 0.3, 5)
    If CheckError(ErrorStatus) = True Then Exit Sub


    
    ' Configure IQT
    'ErrorStatus = age1960_confIQTuning(vi, 1, _
    '                     age1960_TRIG_RF_RISE, 0#, _
    '                     age1960_IQ_REF_NEG67K, VI_TRUE, _
    '                     age1960_IQT_SPURFREQ_MIN_1, 5)
    
    'If CheckError(ErrorStatus) = True Then Exit Sub

    ' Configure Dynamic Power
    'ErrorStatus = age1960_confDynPower(vi, 1, 0, 2)
    
    'If CheckError(ErrorStatus) = True Then Exit Sub

'-------------------------------------------------


' Establish the call
    ErrorStatus = age1960_originateCall(vi, age1960_CALL_CONNECTED, 20)
    If CheckError(ErrorStatus) = True Then Exit Sub
           
'
'-------------------------------------------------
' Read the mobile information

    ' read the IMSI reported information
    'ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:IMSI?", Len(ReturnString), ReturnString)

    'If CheckError(ErrorStatus) = True Then Exit Sub
    'PrintInfo ("IMSI: " & StrEnd(ReturnString))


    ' read the IMEI reported information
    ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:IMEI?", Len(ReturnString), ReturnString)
    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("IMEI: " & StrEnd(ReturnString))

    ' read the Revision Level reported information
    ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:REV?", Len(ReturnString), ReturnString)

    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("Revision: " & StrEnd(ReturnString))


    ' read the supported band reported information
    ErrorStatus = age1960_cmdString_Q(vi, "CALL:MS:REP:SBAN?", Len(ReturnString), ReturnString)
    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("Supported Band: " & StrEnd(ReturnString))

    ' read the power class reported information
    ErrorStatus = age1960_cmdReal64_Q(vi, "CALL:MS:REP:PCL?", dblResults1)

    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("Power Class: " & Str(dblResults1))


'-------------------------------------------------
' Set the cell and MS TX levels for testing

    ' Configure the cell power for Bit Error and Transmitter tests.
        
    ErrorStatus = age1960_cellPower(vi, age1960_CELL_1, CELL_POWER_LOW, 0#)
    If CheckError(ErrorStatus) = True Then Exit Sub

    ErrorStatus = age1960_PowerVsTimePlot_Q(vi, 3000, Integrity, dblResults1, dblResults2, dblResults3, dblResults4, Array1(0))
    If CheckError(ErrorStatus) = True Then Exit Sub


    ' Set the MS TX level.
    ErrorStatus = age1960_MSTXLevel(vi, 7, age1960_CURRENT_BAND, VI_TRUE)
    If CheckError(ErrorStatus) = True Then Exit Sub
    
    
'-------------------------------------------------
' Test the desired channels

    For TestChannel = 1 To 121 Step 60
        PrintInfo ("Present test channel = " & Str(TestChannel))
        ' Set the TCH Channel.
        ErrorStatus = age1960_TCHARFCN(vi, TestChannel, age1960_CURRENT_BAND, VI_TRUE)

        If CheckError(ErrorStatus) = True Then Exit Sub
'-------------------------------------------------
' Read the MS power and auto range the test set

        ' Range the test set and read the TX Power.
        ErrorStatus = age1960_readTXPower_Q(vi, VI_TRUE, Integrity, dblResults1)
        If CheckError(ErrorStatus) = True Then Exit Sub
        PrintInfo ("   Power: " & Str(dblResults1))

'-------------------------------------------------
' Start the desired concurrent measurements


        ' Start concurrent measurements
        MeasFcns(0) = age1960_PVTIME
        MeasFcns(1) = age1960_PFER
        MeasFcns(2) = age1960_ORFS
        MeasFcns(3) = age1960_BER
        ErrorStatus = age1960_initMeasFcns(vi, 4, MeasFcns(0))
        If CheckError(ErrorStatus) = True Then Exit Sub

'-------------------------------------------------
' Fetch the results when they become available

        ' Wait for measurement to complete then fetch the results

        ' Measured results are not printed in this example
        Do
            ErrorStatus = age1960_waitForInitDone_Q(vi, 10, MeasFcnDone)
            If CheckError(ErrorStatus) = True Then Exit Sub

            If MeasFcnDone = age1960_NONEINIT Then Exit Do

            If MeasFcnDone = age1960_PVTIME Then
                ErrorStatus = age1960_fetchPowerVsTime_Q(vi, _
                                      50, Integrity, dblResults1, _
                                      dblResults2, PowerVsTimeValue(0), ItemsMeasured1)

               If CheckError(ErrorStatus) = True Then Exit Sub
                PrintInfo ("   Power vs Time Integrity = " & Str(Integrity))
                PrintInfo ("   Power vs Time Mask Status = " & IIf(dblResults1, "PASS", "FAIL"))
                For I = 0 To ItemsMeasured1 - 1
                    PrintInfo ("   PVT Time Offset:" & Str(PVTTimeOffset(I) * 1000000) & "uS= " & Str(PowerVsTimeValue(I)))
                Next
            End If

            If MeasFcnDone = age1960_PFER Then
                ErrorStatus = age1960_fetchPFER_Q(vi, _
                                      Integrity, dblResults1, dblResults2, dblResults3)
                If CheckError(ErrorStatus) = True Then Exit Sub
                PrintInfo ("   PFER Integrity = " & Str(Integrity))
                PrintInfo ("   RMS Phase Error = " & Str(dblResults1))
                PrintInfo ("   Peak Phase Error = " & Str(dblResults2))
                PrintInfo ("   Frequency Error = " & Str(dblResults3))

            End If

            If MeasFcnDone = age1960_ORFS Then
                ErrorStatus = age1960_fetchORFS_Q(vi, _
                                      8, 22, Integrity, dblResults1, _
                                      dblResults2, SwitchSpectrumValue(0), ModSpectrumValue(0), _
                                      ItemsMeasured1, ItemsMeasured2)
                                      'dblResults2, Array1(0), Array2(0), _'
                If CheckError(ErrorStatus) = True Then Exit Sub
                PrintInfo ("   ORFS Integrity = " & Str(Integrity))
                For I = 0 To ItemsMeasured1 - 1
                    PrintInfo ("   ORFS Switching offset:" & Str(SwitchSpectrumOffset(I) / 1000) & "KHz= " & Str(SwitchSpectrumValue(I)))
                Next
                For I = 0 To ItemsMeasured2 - 1
                    PrintInfo ("   ORFS Mod offset:" & Str(ModSpectrumOffset(I) / 1000) & "KHz= " & Str(ModSpectrumValue(I)))
                Next

            End If

            If MeasFcnDone = age1960_BER Then
                 ErrorStatus = age1960_fetchBER_Q(vi, Integrity, dblResults1, _
                                       dblResults2, dblResults3, dblResults4, _
                                       dblResults5, dblResults6, dblResults7, _
                                       dblResults8, dblResults9)
                If CheckError(ErrorStatus) = True Then Exit Sub
                PrintInfo ("   BER Integrity = " & Str(Integrity))
                PrintInfo ("   Typela BER Rate = " & Str(dblResults2))
                PrintInfo ("   Typelb BER Rate = " & Str(dblResults5))
                PrintInfo ("   TypeII BER Rate = " & Str(dblResults8))
                ErrorStatus = age1960_cmd(vi, "INIT:BERR:OFF")
            End If

        Loop

    Next TestChannel
'-------------------------------------------------
    ' read the SACCH information
    ErrorStatus = age1960_SACCHReport_Q(vi, VI_TRUE, 3, dblResults1, dblResults2, _
                                        dblResults3, dblResults4)
    If CheckError(ErrorStatus) = True Then Exit Sub

    ' Reset the the cell power to a high level.
    ErrorStatus = age1960_cellPower(vi, age1960_CELL_1, CELL_POWER_HIGH, 0)

    If CheckError(ErrorStatus) = True Then Exit Sub

    PrintInfo ("SACCH RX Level: " & Str(dblResults1))
    PrintInfo ("SACCH RX QUAL: " & Str(dblResults3))
    PrintInfo ("SACCH TX Level: " & Str(dblResults2))
    PrintInfo ("SACCH Timing Advance: " & Str(dblResults4))

'-------------------------------------------------
    ' measure the mobile TX power at the different TX level settings.
    For TXLevel = 4 To 15
        ' Set the moble to the desired TX level

        ErrorStatus = age1960_MSTXLevel(vi, TXLevel, age1960_CURRENT_BAND, VI_TRUE)
        If CheckError(ErrorStatus) = True Then Exit Sub

        ' Range the test set and read the TX Power.
        ErrorStatus = age1960_readTXPower_Q(vi, VI_TRUE, Integrity, dblResults1)

        If CheckError(ErrorStatus) = True Then Exit Sub
        PrintInfo ("Power @ level " & Str(TXLevel) & ": " & Str(dblResults1))
    Next TXLevel

' Read IQ Tuning results.
    ErrorStatus = age1960_readIQTuning_Q(vi, _
                                age1960_IQ_ARRAY_MAX, _
                                ItemsMeasured1, _
                                dblResults1, _
                                dblResults2, _
                                resArray1(0), _
                                resArray2(0), _
                                ItemsMeasured2)
    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("IQT Integrity : " & Str(ItemsMeasured1))
    PrintInfo ("IQT Spur Level : " & Str(dblResults2))


' Read Dynamic Power results.
' First turn all measurements off since dyn power will turn
' off all measurements and flag an warning. Turning them off will
' prevent getting the warning.

    ErrorStatus = age1960_cmd(vi, "INIT:PVT:OFF")

    ErrorStatus = age1960_cmd(vi, "INIT:PFER:OFF")
    ErrorStatus = age1960_cmd(vi, "INIT:IQT:OFF")
    ErrorStatus = age1960_cmd(vi, "INIT:ORFS:OFF")
    ErrorStatus = age1960_cmd(vi, "INIT:AAUD:OFF")
    ErrorStatus = age1960_cmd(vi, "INIT:TXP:OFF")

    ErrorStatus = age1960_cmd(vi, "INIT:BERR:OFF")

    ErrorStatus = age1960_readDynPower_Q(vi, _
                            age1960_ARRAY_MAX, _
                            resArray3(0), _
                            resArray1(0), _
                            ItemsMeasured1)
    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("Dyn Power Integrity : " & Str(resArray3(0)))
    PrintInfo ("Dyn Power Level : " & Str(resArray1(0)))


'-------------------------------------------------

' End the call
    ErrorStatus = age1960_endCall(vi, VI_FALSE)
    If CheckError(ErrorStatus) = True Then Exit Sub
    PrintInfo ("Testing complete")
    
    ' set the mouse pointer for the form back to the default

    Form1.MousePointer = vbDefault

End Sub


Private Sub PrintInfo(Info As String)
'------------------------------------------------
' Print information to a text box.
'------------------------------------------------

    txtResult.Visible = False

    txtResult = txtResult.Text + Info & vbCrLf
    txtResult.Visible = True
    'pull the scroll bar to the last text entered
    txtResult.SelStart = Len(txtResult.Text)
    DoEvents

End Sub

Private Function StrEnd(LongStr As String) As String

'------------------------------------------------
' Strip any null characters from the end of string
'------------------------------------------------

    If InStr(LongStr, Chr(0)) = 0 Then
        StrEnd = LongStr

    Else
        StrEnd = Left(LongStr, Val(InStr(LongStr, Chr(0))) - 1)
    End If

End Function

Function CheckError(ErrorStatus As Long) As Boolean
'------------------------------------------------
' Check for driver errors.
' If an error occurred reset the insturment and return True

' else return False.
'------------------------------------------------

    Dim errorMessage As String * 256
    
    If VI_SUCCESS > ErrorStatus Then
        ' Query the error

        Call age1960_error_message(vi, ErrorStatus, errorMessage)
        
        ' set the mouse pointer for the form back to the default
        Form1.MousePointer = vbDefault
        
        ' Display the error
        MsgBox "Instrument Error: " & Str$(ErrorStatus) & " " & errorMessage

        ' Send a device clear - to ensure communication with the instrument */
        Call age1960_dcl(vi)    ' don't need the error status this time
        ' reset the instrument

        Call age1960_reset(vi) ' don't need the error status this time
        CheckError = True
        Exit Function
    End If
    CheckError = False
End Function
 
Private Sub Form_Terminate()
'------------------------------------------------
' Close the session since the program is being terminated

'------------------------------------------------
   
   Call age1960_close(vi)  ' don't need the error status this time, if the
                      ' session has not been opened this would return

                      ' an error, but we don't care since we are terminating

End Sub



'Agilent Technologies E1960 Instrument Driver Help

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -