📄 e1968 driver.bas
字号:
Attribute VB_Name = "e1968_driver"
'Public E1968ID As Integer
'Public HP663xxID As Integer
Public Function GetInstrInterface(ByVal iInstrGPIBAdd As Integer) As Integer
Dim sGPIBHandle As String
sGPIBHandle = "gpib0," & iInstrGPIBAdd
GetInstrInterface = iopen(sGPIBHandle)
End Function
Public Sub Init_E1968(ByVal iGPIBHandle As Integer, ByVal lTimeOut As Long, ByVal bDisplayFast As Boolean)
Dim sCommand As String
Dim argCount As Integer
Dim actual As Long
Dim strres As String * 80 'Fixed-length String
On Error GoTo Error1
Call itimeout(iGPIBHandle, lTimeOut)
'sCommand = "*RST; *CLS; *OPC?" & VBCRLF
sCommand = "*RST; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 0, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
Do
TimeDelay (20)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
If InStr(strres, "1") > 0 Then
Exit Do
End If
Loop
sCommand = "*CLS; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 0, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "SYST:COMM:GPIB:DEB ON; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 0, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
If bDisplayFast = True Then
sCommand = "DISP:MODE FAST; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 0, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
End If
sCommand = "CALL:OPER:MODE CALL; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 0, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:FUNC:CONN:TYPE AUTO; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
Error1:
End Sub
Public Function GetID_E1968(ByVal iGPIBHandle As Integer) As String
Dim strres As String * 80 'Fixed-length String
Dim actual As Long
Dim sCommand As String
Dim argCount
On Error GoTo Error1
GetID_E1968 = ""
' Query device's *IDN? string
'Call iwrite(iGPIBHandle, "*IDN?" + Chr$(10), 6, 1, 0&)
sCommand = "*IDN?" & vbCrLf
argCount = ivprintf(iGPIBHandle, sCommand)
' Read result
Call iread(iGPIBHandle, strres, 80, 0&, actual)
GetID_E1968 = strres
Error1:
End Function
Public Sub LOSSSetting_E1968(ByVal iGPIBHandle As Integer, ByVal sOffsetFreqArray As String, ByVal sOffsetArray As String)
Dim sCommand As String
Dim argCount As Integer
Dim actual As Long
Dim strres As String * 80 'Fixed-length String
On Error GoTo Error1:
sCommand = "SYST:CORR:FREQ " & sOffsetFreqArray & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "SYST:CORR " & sOffsetArray & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
Error1:
End Sub
Public Sub Config_BCH_E1968(ByVal iGPIBHandle As Integer, ByVal sBch_Band As String, ByVal iBch As Integer, ByVal sBch_CellPower As Single)
Dim sCommand As String
Dim argCount As Integer
Dim actual As Long
Dim strres As String * 80 'Fixed-length String
On Error GoTo Error1:
sCommand = "CALL:BAND " & sBch_Band & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:BCH " & iBch & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:POW " & sBch_CellPower & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
Error1:
End Sub
Public Sub Config_TCH_E1968(ByVal iGPIBHandle As Integer, ByVal sTch_Band As String, ByVal iTch As Integer, ByVal iMSTxLevel As Integer)
Dim sCommand As String
Dim argCount As Integer
Dim actual As Long
Dim strres As String * 80 'Fixed-length String
On Error GoTo Error1:
sCommand = "CALL:TCH:BAND " & sTch_Band & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:TCH " & iTch & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:MS:TXL " & iMSTxLevel & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
Error1:
End Sub
Public Sub Config_PDTCH_E1968(ByVal iGPIBHandle As Integer, ByVal sPDTCH_Band As String, ByVal iPDTch As Integer, ByVal sMultiSlot As String)
Dim sCommand As String
Dim argCount As Integer
Dim actual As Long
Dim strres As String * 80 'Fixed-length String
On Error GoTo Error1:
sCommand = "CALL:PDTCH:BAND " & sPDTDH_Band & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH " & iPDTch & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
'------------------------------------------------------------------
sCommand = "CALL:FUNC:DATA:BLER:LLC:FCS CORR; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:FUNC:DATA:BLER:POLL:INT 4; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:FUNC:DATA:FRAM:STAR ABS; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
'-------------------------------------------------------------------
sCommand = "CALL:PDTCH:MSL:CONF " & sMultiSlot & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:CSCH CS4; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:PZER:LEV 25; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:PRED:LEV1 5; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:PRED:LEV2 11; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:PRED:BURS1 PRL1; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:PRED:BURS2 PRL2; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:PRED:BURS1 PRL1; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PDTCH:MS:TXL:BURS 5; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
Error1:
End Sub
Public Sub Config_Measurement_E1968(ByVal iGPIBHandle As Integer, ByVal sPDTCH_Band As String, ByVal iPDTch As Integer, ByVal sMultiSlot As String)
Dim sCommand As String
Dim argCount As Integer
Dim actual As Long
Dim strres As String * 80 'Fixed-length String
Dim SwitchOffset As String
Dim ModOffset As String
Dim PVTOffset As String
On Error GoTo Error1:
'----------- Config ORFS Measurement for both GSM and GPRS ----------------------
sCommand = "SET:ORFS:TIM 20; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
SwitchOffset = ".4MHZ,-.4MHZ,.6MHZ,-.6MHZ,1.2MHZ,-1.2MHZ,1.8MHZ,-1.8MHZ"
ModOffset = ".4MHZ,-.4MHZ,.6MHZ,-.6MHZ,1.2MHZ,-1.2MHZ,1.8MHZ,-1.8MHZ"
sCommand = "SET:ORFS:SWIT:COUN 20; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "SET:ORFS:SWIT:FREQ " & SwitchOffset & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "SET:ORFS:MOD:COUN 10; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "SET:ORFS:MOD:FREQ " & ModOffset & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
'---------------- Config Power vs Time Measurement for both GSM and GPRS ---------------
sCommand = "SET:PVT:TIM 10;COUN 5; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
PVTOffset = "-28us,-10us,321.2us,552.8us,570.8us"
sCommand = "SET:PVT:TIME " & PVTOffset & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
'--------------- Configure Phase & Frequency Error Measurement for GSM and GPRS -------
sCommand = "SET:PFER:COUN 10;TIM 5; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "SET:PFER:SYNC MID; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
'---------- Configure Block Error Rate Measurement for GPRS ----------------------
sCommand = "SET:BLER:TIM 200;COUN 2000; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
Error1:
End Sub
Public Function Start_OriginalCall_E1968(ByVal iGPIBHandle As Integer, ByVal sIMSI As String) As Boolean
Dim sCommand As String
Dim argCount As String
Dim i As Integer
Start_OriginalCall_E1968 = False
On Error GoTo Error1
sCommand = "CALL:PAG:IMSI " & sIMSI & "; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
sCommand = "CALL:PAG:REP OFF; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
i = 0
Do
sCommand = "CALL:ORIG;" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
TimeDelay (3000)
sCommand = "CALL:CONN:STAT?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
If Trim(strres) = "1" Then
Start_OriginalCall_E1968 = True
Exit Do
End If
i = i + 1
Loop Until i < 3
Error1:
End Function
Public Function EndCall_E1968(ByVal iGPIBHandle As Integer) As Boolean
Dim sCommand As String
Dim argCount As String
On Error GoTo Error1
sCommand = "CALL:END; *OPC?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
TimeDelay (10)
Call iread(iGPIBHandle, strres, 80, 0&, actual)
TimeDelay (1000)
sCommand = "CALL:CONN:STAT?" & vbCrLf
'Call iwrite(iGPIBHandle, sCommand, Len(sCommand), 1, 0&)
argCount = ivprintf(iGPIBHandle, sCommand)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -