📄 8960demo.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5175
ClientLeft = 60
ClientTop = 345
ClientWidth = 6990
LinkTopic = "Form1"
ScaleHeight = 5175
ScaleWidth = 6990
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtIMEI
Height = 285
Left = 1200
TabIndex = 5
Text = "'001011234567890'"
Top = 3960
Width = 2055
End
Begin VB.TextBox txtResult
Height = 3495
Left = 720
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Text = "8960Demo.frx":0000
Top = 360
Width = 5535
End
Begin VB.CommandButton cmdExit
Caption = "Exit"
Height = 375
Left = 4920
TabIndex = 2
Top = 4440
Width = 1335
End
Begin VB.CommandButton cmdStartTest
Caption = "Start Test"
Height = 375
Left = 2880
TabIndex = 1
Top = 4440
Width = 1335
End
Begin VB.CommandButton cmdOpen
Caption = "Open"
Height = 375
Left = 720
TabIndex = 0
Top = 4440
Width = 1335
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "IMEI"
Height = 195
Left = 720
TabIndex = 6
Top = 3960
Width = 330
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Test Results"
Height = 195
Left = 720
TabIndex = 4
Top = 120
Width = 885
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Example 6: Using subsystem functions (Visual Basic)
'***************************************************************************
'* age1960 Instrument Driver EXAMPLE #6 for Visual Basic
' Copyright (c) 1999-2001 Agilent Technologies
'---------------------------------------------------------------------------
' Example Visual Basic program for E1960A GSM mobile test for 8960
' Series 10 E5515 P&P driver.
' Revision: A.03.00
' This program demonstrates how to communicate with the E1960A
' using the Plug&Play driver to test a GSM mobile phone.
'
' Requires a form named age1960Demo
' a CommandButton named cmdStartTest with visible set to False
' a CommandButton named cmdExit
' a CommandButton named cmdOpen
' a Textbox named txtResult with MultiLine set to True
' and ScrollBars set to 2-Vertical
' Also add the module age1960.bas from the vxipnp/winXX/include
' directory. You may also need to UNcomment out the lines at the
' top of the .bas file if other VISA includes do not specify
' VI_TRUE etc.
'
' Adjust the constants PATH_LOSS, PATH_LOSS_FREQ, CELL_POWER_HIGH and
' CELL_POWER_LOW for your testing needs.
'***************************************************************************
Option Explicit
Dim vi As Long
Private Const INST_ADDRESS = 14
Private Const CELL_POWER_HIGH = -50
Private Const CELL_POWER_LOW = -90
Private Const PATH_LOSS = -15
Private Const PATH_LOSS_FREQ = 896000000#
Private Sub cmdExit_Click()
'------------------------------------------------
' Close the session and exit the program
'------------------------------------------------
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
End Sub
Private Sub cmdOpen_Click()
'------------------------------------------------
' Open the session and preset the test set
'------------------------------------------------
Dim ErrorStatus As Long
Dim DriverRevision As String * 50
Dim InstRevision As String * 50
Dim errorMessage As String * 256
Dim message As String
' Clear the text in the results window
txtResult = ""
' Open the session with instrument at address 14
' with instrument full reset and *IDN? query
ErrorStatus = age1960_init("GPIB0::" & Trim(Str(INST_ADDRESS)), VI_TRUE, VI_TRUE, vi)
If VI_SUCCESS > ErrorStatus Then
If vi <> VI_NULL Then
Call age1960_error_message(vi, ErrorStatus, errorMessage)
message = "Unable to open " & "GPIB0::" & Trim(Str(INST_ADDRESS)) & vbCr
message = message + "age1960_init() returned message: " & errorMessage
MsgBox message
Exit Sub
Else
message = "Unable to open " & "GPIB0::" & Trim(Str(INST_ADDRESS)) & vbCr
message = message + "age1960_init() returned code: " & Str(ErrorStatus)
MsgBox message
Exit Sub
End If
End If
' Clear any error that are in the error query buffer
ErrorStatus = age1960_cmd(vi, "*CLS")
If CheckError(ErrorStatus) = True Then Exit Sub
' Enable instrument error detection
ErrorStatus = age1960_errorQueryDetect(vi, 1)
If CheckError(ErrorStatus) = True Then Exit Sub
' Set a 10s timeout for the driver
ErrorStatus = age1960_timeOut(vi, 20000)
If CheckError(ErrorStatus) = True Then Exit Sub
' Read the driver and instrument revision
ErrorStatus = age1960_revision_query(vi, DriverRevision, InstRevision)
If CheckError(ErrorStatus) = True Then Exit Sub
PrintInfo ("Driver Revision: " & StrEnd(DriverRevision))
PrintInfo ("Instrument Revision: " & StrEnd(InstRevision))
' Turn on the start test key and turn off the open session key
cmdStartTest.Visible = True
cmdOpen.Visible = False
End Sub
Private Sub cmdStartTest_Click()
'------------------------------------------------
' Perform a demo test with the test set
'------------------------------------------------
Dim ErrorStatus As Long
Dim Array1(0 To 3000) As Double ' start the arrays a 0 to be equivalent to
Dim Array2(0 To 50) As Double ' the C example
Dim I As Integer
Dim J As Integer
Dim ReturnString As String * 256
Dim TestChannel As Long
Dim TXLevel As Long
Dim Integrity As Long
Dim MeasFcns(0 To 7) As Integer
Dim MeasFcnDone As Integer
Dim dblResults1 As Double
Dim dblResults2 As Double
Dim dblResults3 As Double
Dim dblResults4 As Double
Dim dblResults5 As Double
Dim dblResults6 As Double
Dim dblResults7 As Double
Dim dblResults8 As Double
Dim dblResults9 As Double
Dim ItemsMeasured1 As Long
Dim ItemsMeasured2 As Long
Dim resArray1(0 To 499) As Double
Dim resArray2(0 To 499) As Double
Dim resArray3(0 To 499) As Long
Dim freqArray(0 To age1960_ARRAY_MAX - 1) As Double
Dim offsetArray(0 To age1960_ARRAY_MAX - 1) As Double
Dim ModSpectrumOffset(0 To 32) As Double
Dim ModSpectrumValue(0 To 32) As Double
Dim SwitchSpectrumOffset(0 To 32) As Double
Dim SwitchSpectrumValue(0 To 32) As Double
Dim PVTTimeOffset(0 To 12) As Double
Dim PowerVsTimeValue(0 To 50) As Double
freqArray(0) = PATH_LOSS_FREQ '
offsetArray(0) = -0.5 'PATH_LOSS 'set amplitude offset for given frequency
' set the mouse pointer for the form to the hour glass
Form1.MousePointer = vbHourglass
'-------------------------------------------------
' Configure the BS Emulator
' Perform an instrument partial preset
ErrorStatus = age1960_partialPreset(vi)
If ErrorStatus < VI_SUCCESS Then
PrintInfo "Failed to partial preset the instrument."
Exit Sub
End If
' Configure the operating mode
ErrorStatus = age1960_operatingMode(vi, age1960_ACELL_MODE)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure the display mode
'ErrorStatus = age1960_cmd(vi, "DISP:MODE FAST")
'If CheckError(ErrorStatus) = True Then Exit Sub
' Configure the cell band
ErrorStatus = age1960_cellBand(vi, age1960_CELL_1, age1960_PGSM_BAND)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure the TCH band
ErrorStatus = age1960_TCHBand(vi, age1960_PGSM_BAND)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure the broadcast channel and do not wait for it to change
ErrorStatus = age1960_BCHARFCN(vi, age1960_CELL_1, 20, age1960_CURRENT_BAND, VI_FALSE)
If CheckError(ErrorStatus) = True Then Exit Sub
' Apply the path loss factor to the instrument for the uplink loss
ErrorStatus = age1960_amplitudeOffset(vi, freqArray(0), offsetArray(0), 1)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure the cell power with a 0 dB difference between downlink
' and uplink loss.
ErrorStatus = age1960_cellPower(vi, age1960_CELL_1, CELL_POWER_HIGH, 0)
If CheckError(ErrorStatus) = True Then Exit Sub
' set the IMSI reported information
' ErrorStatus = age1960_cmd(vi, "CALL:MS:REP:IMSI " & Trim(txtIMEI.Text))
ErrorStatus = age1960_cmd(vi, "CALL:PAG:IMSI " & Trim(txtIMEI.Text))
If CheckError(ErrorStatus) = True Then Exit Sub
'-------------------------------------------------
' Configure the measurements
' Configure TX Power
ErrorStatus = age1960_confTXPower(vi, 5, age1960_TRIG_AUTO, 0, 1, 1)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure Power vs Time
'PVTTimeOffset(0) = -0.000028
'PVTTimeOffset(1) = -0.000018
'PVTTimeOffset(2) = -0.00001
'PVTTimeOffset(3) = 0#
'PVTTimeOffset(4) = 0.0003212
'PVTTimeOffset(5) = 0.0003312
'PVTTimeOffset(6) = 0.0003392
'PVTTimeOffset(7) = 0.0003492
'PVTTimeOffset(8) = 0.0005428
'PVTTimeOffset(9) = 0.0005528
'PVTTimeOffset(10) = 0.0005608
'PVTTimeOffset(11) = 0.0005708
PVTTimeOffset(0) = -0.000018
PVTTimeOffset(1) = -0.00001
PVTTimeOffset(2) = -0.000005
PVTTimeOffset(3) = 0#
PVTTimeOffset(4) = 0.000005
PVTTimeOffset(5) = 0.0001812
PVTTimeOffset(6) = 0.0003622
PVTTimeOffset(7) = 0.0005372
PVTTimeOffset(8) = 0.0005428
PVTTimeOffset(9) = 0.0005478
PVTTimeOffset(10) = 0.0005528
PVTTimeOffset(11) = 0.0005608
ErrorStatus = age1960_confPowerVsTime(vi, 5, age1960_TRIG_AUTO, 0, _
age1960_BSYNC_MID, 12, PVTTimeOffset(0), 5)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure PFER
ErrorStatus = age1960_confPFER(vi, 5, age1960_TRIG_AUTO, 0, _
1, age1960_BSYNC_MID, 5)
If CheckError(ErrorStatus) = True Then Exit Sub
' Configure ORFS
SwitchSpectrumOffset(0) = -400000# ' Switching offsets
SwitchSpectrumOffset(1) = 400000#
SwitchSpectrumOffset(2) = -600000#
SwitchSpectrumOffset(3) = 600000#
SwitchSpectrumOffset(4) = -1200000#
SwitchSpectrumOffset(5) = 1200000#
SwitchSpectrumOffset(6) = -1800000#
SwitchSpectrumOffset(7) = 1800000#
ModSpectrumOffset(0) = -100000 ' modulation offsets
ModSpectrumOffset(1) = 100000#
ModSpectrumOffset(2) = -200000#
ModSpectrumOffset(3) = 200000#
ModSpectrumOffset(4) = -250000#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -