Other topics about Application Programs
The apl_fem.vba shows front end module (FEM) measurement as a sample program of measurement using the E5091A.
If the E5071C does not have 4-port S parameter test set, a runtime error occurs because there are parameters that cannot be measured.
This VBA program cannot control the E5091A-016, the multiport test set.
Object name |
Module type |
Description |
mdlFemMeas |
Standard module |
Performs measurement of FEM |
This program calibrates each channel using the ECal module and then measures the transmission characteristics EGSM:Tx-Antenna (channel 1), EGSM:Antenna-Rx (channel 2), GSM1800:Tx-Antenna (channel 3), and GSM1800:Antenna-Rx (channel 4) of the 6-port dual-band FEM as shown in the below figure.
When you start the program, "Connect A and T1 to ECal Module" is displayed. Connect the cables from A and T1 of the E5091A to the ECal module and then press the OK key to calibrate channel 1. If trouble occurs due to a problem in the connection to the ECal module, an error message is displayed. You can execute calibration again by clicking the Retry button. If you want to abort the program, click the Cancel button. For channels 2 to 4, execute the calibration in the same way.
When calibration is complete, "Set DUT" is displayed. Connect the DUT (FEM) and the E5091A as shown below and click the OK button to start measurement.
FEM |
E5091A |
|
Antenna |
A |
|
EGSM |
Tx |
T1 |
Rx+ |
R1+ |
|
Rx- |
R1- |
|
GSM1800 |
Tx |
T2 |
Rx |
R2+ |
|
Vc1 |
Control Line 1 |
|
Vc2 |
Control Line 2 |
The following figure shows a sample display of the LCD screen after the program exits execution.
Example of display after execution of program in "apl_fem.vba"
The FEM measurement program (object name: mdlFemMeas) is described in detail below. Line numbers are added for description purpose only and do not appear in the actual program source code.
Lines 140 to 330
Set the ports assigned to Port 1 to Port 4 of the E5091A and the control line setting (table below) into the variables.
Channel number |
Port 1 |
Port 2 |
Port 3 |
Port 4 |
Control Lines |
1 |
A |
T1 |
R1+ |
R1- |
0 (00000000) |
2 |
A |
T1 |
R1+ |
R1- |
2 (00000010) |
3 |
A |
T2 |
R2+ |
R2- |
0 (00000000) |
4 |
A |
T2 |
R2+ |
R2- |
1 (00000001) |
Lines 340 to 660
Set the settings required for the measurement conditions in the table below to the variables.
Channel number |
Sweep range |
Number of points |
Number of traces |
Measurement parameter |
|
Start |
Stop |
||||
1 |
400 MHz |
1.4 GHz |
51 |
1 |
S12 |
2 |
880 MHz |
1 GHz
|
101 |
1 |
Sds21 |
3 |
1.34 GHz |
2.34 GHz |
201 |
1 |
S12 |
4 |
1.665 GHz |
2.015 GHz |
101 |
1 |
S31 |
Channel number |
Fixture simulator |
Title |
|
ON/OFF |
Topology |
||
1 |
OFF |
E/span> E/span> |
[EGSM] Tx-Antenna |
2 |
ON |
SE:1, Bal:3,4 |
[EGSM] Antenna-Rx |
3 |
OFF |
E/span> E/span> |
[GSM1800] Antenna-Rx |
4 |
OFF |
E/span> E/span> |
[GSM1800] Tx-Antenna |
Line 710
Puts the instrument into preset state.
Line 720
Allocates the windows to the upper left, upper right, lower left, and lower right.
Lines 740 to 1020
Repeat the following for channels 1 to 4, where Ch is the channel number.
Lines 780 to 810: For the E5091A whose ID is 1, set the port assigned to port 1 to Port1(Ch-1), the port assigned to port 2 to Port2(Ch-1), the Port assigned to port 3 to Port3(Ch-1), and the port assigned to port 4 to Port4(Ch-1).
Line 820: Sets the control line of the E5091A whose ID is 1 to Clines(Ch-1).
Lines 860 to 890: Set the sweep start value to Freq_star(Ch-1), the sweep stop value to Freq_stop(Ch-1), the number of points to Nop(Ch-1), and the number of traces to N_tr(Ch-1).
Lines 910 to 950: If the fixture simulator function is ON (Fsim(Ch-1) is True), these lines set the fixture simulator function to ON, the device type to Dev(Ch-1), the port assignment to Tpl(Ch-1), the balance-unbalance conversion to ON, and the measurement parameter (mix mode S-parameter) to Trc(Ch-1).
Line 970: If the fixture simulator function is OFF (Fsim(i) is False), sets the measurement parameter (S-parameter) to Trc(Ch-1).
Lines 990 to 1010: Set the title label to Ttl(Ch-1), the title display to ON, and the continuous startup mode to ON.
Line 1040
Sets the trigger source to "Bus."
Lines 1050 to 1060
For the E5091A whose ID is 1, set the property display to ON and the control to ON.
Lines 1100 to 1120
Recall the Function procedure: ECal_solt (Lines 1410 to 1770) to execute the calibration of channel 1 with the ECal module (full 2-port calibration of ports A and T1). If the calibration is not completed correctly, these lines abort the program.
Lines 1130 to 1210
Execute the calibration of channels 2 to 4 in the same way.
Line 1260
Displays the message that prompts for connecting a DUT (Device Under Test) and waits for the OK button to be clicked after the connection.
Lines 1280 to 1290
Generate a trigger to start a single sweep and wait until the measurement finishes (1 is read out with the SCPI.IEEE4882.OPC object).
Lines 1310 to 1330
Execute auto scale for trace 1 of channels 1 to 4.
Line 1350
Displays the message asking whether you want to perform measurement again.
Line 1360
If the Yes button is clicked, returns to the DUT connection section.
Line 1460
Clears the error queue.
Lines 1460 to 1480
Display the message that prompts for connecting the Tset_Port of the E5091A to the ECal module and wait for the OK button to be clicked after the connection.
Line 1500
Enables the error handling routine starting from Ecal_Err (lines 1670 to 1740). If a runtime error occurs, the program goes to the error handling routine.
Line 1540
If solt is 1, executes the ECal command that performs 1-port calibration on port Ana_port(0) of channel Ch.
Line 1560
If solt is 2, executes the ECal command that performs full 2-port calibration on port Ana_port of channel Ch.
Line 1580
If solt is 3, executes the ECal command that performs full 3-port calibration on port Ana_port of channel Ch.
Line 1600
If solt is 4, executes the ECal command that performs full 4-port calibration on port Ana_port of channel Ch.
Line 1630
Sets the return value of ECal_solt to 0.
Lines 1670 to 1740
Define a runtime error handler.
Lines 780 to 810: For the E5091A whose ID is 1, these lines set the port assigned to port 1 to Port1(Ch-1), the port assigned to port 2 to Port2(Ch-1), the Port assigned to port 3 to Port3(Ch-1), and the port assigned to port 4 to Port4(Ch-1).
Line 1670: Retrieves the error number and error message from the error queue.
Line 1680: Displays the error message.
Line 1700: When the Retry button is clicked, the program disables the error handler routine and then returns to the connection part and repeats ECal.
Lines 1720 to 1730: When the Cancel button is clicked, the program sets the return value of ECal_solt to the error number and disables the error handler routine.
Measurement of FEM (object name: mdlFemMeas)
10| Sub Main()
20|
30| Dim Port1(3) As String, Port2(3) As String
40| Dim Port3(3) As String, Port4(3) As String
50| Dim Trc(3) As String, Fsim(3) As Boolean, Dev(3) As String
60| Dim Tpl(3) As Variant, Ttl(3) As String, Inp_char As String
70| Dim Freq_star(3) As Double, Freq_stop(3) As Double
80| Dim CLines(3) As Long, Nop(3) As Long, N_tr(3) As Long
90| Dim Ch As Long, Res As Long, Buff As Long, Dmy As Long
100| Dim AnaPort As Variant
110| '
120| ' E5091A Setup
130| '
140| Port1(0) = "A" '[Ch1] Port1: A
150| Port2(0) = "T1" ' Port2: T1
160| Port3(0) = "R1" ' Port3: R1+
170| Port4(0) = "R1" ' Port4: R1-
180| CLines(0) = 0 ' Control Lines: 0
190| Port1(1) = "A" '[Ch2] Port1: A
200| Port2(1) = "T1" ' Port2: T1
210| Port3(1) = "R1" ' Port3: R1+
220| Port4(1) = "R1" ' Port3: R1-
230| CLines(1) = 2 ' Control Lines: 2 (Line1:HIGH)
240| Port1(2) = "A" '[Ch3] Port1: A
250| Port2(2) = "T2" ' Port2: T2
260| Port3(2) = "R2" ' Port3: R2+
270| Port4(2) = "R2" ' Port4: R2- (Dummy)
280| CLines(2) = 0 ' Control Lines: 2 (Line1:HIGH)
290| Port1(3) = "A" '[Ch4] Port1: A
300| Port2(3) = "T2" ' Port2: T2
310| Port3(3) = "R2" ' Port3: R2+
320| Port4(3) = "R2" ' Port4: R2- (Dummy)
330| CLines(3) = 1 ' Control Lines: 1 (Line0:HIGH)
340| '
350| ' Measurement Condition
360| ' [Ch1]
370| Freq_star(0) = 400000000# ' Start frequency : 400 MHz
380| Freq_stop(0) = 1400000000# ' Stop frequency : 1.4 GHz
390| Nop(0) = 51 ' Number of points : 51
400| N_tr(0) = 1 ' Number of traces : 1
410| Fsim(0) = False ' Fixture Simulator : OFF
420| Trc(0) = "S12" ' Meas. parameter : S12
430| Ttl(0) = "[EGSM] Tx-Antenna" ' Title
440| ' [Ch2]
450| Freq_star(1) = 880000000# ' Start frequency : 880 MHz
460| Freq_stop(1) = 1000000000# ' Stop frequency : 1 GHz
470| Nop(1) = 101 ' Number of points : 101
480| N_tr(1) = 1 ' Number of traces : 1
490| Fsim(1) = True ' Fixture Simulator : ON
500| Dev(1) = "SBAL" ' Bal. Device Type : SE-Bal
510| Tpl(1) = Array(1, 3, 4) ' Topology : SE:1, Bal:3-4
520| Trc(1) = "SDS21" ' Meas. parameter : Sds21
530| Ttl(1) = "[EGSM] Antenna-Rx" ' Title
540| ' [Ch3]
550| Freq_star(2) = 1340000000# ' Start frequency : 1.34 GHz
560| Freq_stop(2) = 2340000000# ' Stop frequency : 2.34 GHz
570| Nop(2) = 201 ' Number of points : 201
580| N_tr(2) = 1 ' Number of traces : 1
590| Fsim(2) = False ' Fixture Simulator : OFF
600| Trc(2) = "S12" ' Meas. parameter : S12
610| Ttl(2) = "[GSM1800] Tx-Antenna" ' Title
620| ' [Ch4]
630| Freq_star(3) = 1665000000# ' Start frequency : 1.665 GHz
640| Freq_stop(3) = 2015000000# ' Stop frequency : 2.015 GHz
650| Nop(3) = 101 ' Number of points : 101
660| N_tr(3) = 1 ' Number of traces : 1
670| Fsim(3) = False ' Fixture Simulator : OFF
680| Trc(3) = "S31" ' Meas. parameter : S31
690| Ttl(3) = "[GSM1800] Antenna-Rx" ' Title
700|
710| SCPI.SYSTem.PRESet
720| SCPI.DISPlay.Split = "D12_34"
730|
740| For Ch = 1 To 4
750| '
760| ' E5091A Setup
770| '
780| SCPI.SENSe(Ch).MULTiplexer(1).TSET9.Port1 = Port1(Ch - 1)
790| SCPI.SENSe(Ch).MULTiplexer(1).TSET9.Port2 = Port2(Ch - 1)
800| SCPI.SENSe(Ch).MULTiplexer(1).TSET9.Port3 = Port3(Ch - 1)
810| SCPI.SENSe(Ch).MULTiplexer(1).TSET9.Port4 = Port4(Ch - 1)
820| SCPI.SENSe(Ch).MULTiplexer(1).TSET9.OUTPut.DATA = CLines(Ch - 1)
830| '
840| ' Measurement Condition
850| '
860| SCPI.SENSe(Ch).FREQuency.STARt = Freq_star(Ch - 1)
870| SCPI.SENSe(Ch).FREQuency.STOP = Freq_stop(Ch - 1)
880| SCPI.SENSe(Ch).SWEep.POINts = Nop(Ch - 1)
890| SCPI.CALCulate(Ch).PARameter.Count = N_tr(Ch - 1)
900| If Fsim(Ch - 1) = True Then
910| SCPI.CALCulate(Ch).FSIMulator.STATe = True
920| SCPI.CALCulate(Ch).FSIMulator.BALun.DEVice = Dev(Ch - 1)
930| SCPI.CALCulate(Ch).FSIMulator.BALun.TOPology.SBALanced.PPOR ts = Tpl(Ch - 1)
940| SCPI.CALCulate(Ch).FSIMulator.BALun.PARameter(1).STATe = Tr ue
950| SCPI.CALCulate(Ch).FSIMulator.BALun.PARameter(1).SBALanced. DEFine = Trc(Ch - 1)
960| Else
970| SCPI.CALCulate(Ch).PARameter(1).DEFine = Trc(Ch - 1)
980| End If
990| SCPI.DISPlay.WINDow(Ch).TITLe.DATA = Ttl(Ch - 1)
1000| SCPI.DISPlay.WINDow(Ch).TITLe.STATe = True
1010| SCPI.INITiate(Ch).CONTinuous = True
1020| Next Ch
1030|
1040| SCPI.TRIGger.SEQuence.Source = "BUS"
1050| SCPI.SENSe.MULTiplexer(1).DISPlay.STATe = True
1060| SCPI.SENSe.MULTiplexer(1).STATe = True
1070| '
1080| ' Calibration
1090| '
1100| AnaPort = Array(1, 2)
1110| Res = ECal_Solt(1, 2, AnaPort, "A and T1")
1120| If Res <> 0 Then GoTo Prg_end
1130| AnaPort = Array(1, 3, 4)
1140| Res = ECal_Solt(2, 3, AnaPort, "A, R1+ and R1-")
1150| If Res <> 0 Then GoTo Prg_end
1160| AnaPort = Array(1, 2)
1170| Res = ECal_Solt(3, 2, AnaPort, "A and T2")
1180| If Res <> 0 Then GoTo Prg_end
1190| AnaPort = Array(1, 3)
1200| Res = ECal_Solt(4, 2, AnaPort, "A and R2+")
1210| If Res <> 0 Then GoTo Prg_end
1220| '
1230| ' Measurement
1240| '
1250| Meas_Start:
1260| MsgBox "Connect DUT.", vbOKOnly, "Measurement"
1270|
1280| SCPI.TRIGger.SEQuence.SINGle
1290| Dmy = SCPI.IEEE4882.OPC
1300|
1310| For Ch = 1 To 4
1320| SCPI.DISPlay.WINDow(Ch).TRACe(1).Y.SCALe.AUTO
1330| Next Ch
1340|
1350| Buff = MsgBox("Do you make another measurement?", vbYesNo)
1360| If Buff = vbYes Then GoTo Meas_Start
1370|
1380| Prg_end:
1390| End Sub
1400|
1410| Function ECal_Solt(Ch As Long, Solt As Long, AnaPort As Variant, TsetPort As String) As Long
1420| Dim Err_info As Variant
1430| Dim Buff As Long
1440|
1450| Ecal_start:
1460| SCPI.IEEE4882.CLS
1470|
1480| MsgBox "Connect " + TsetPort + " to ECal Module."
1490|
1500| On Error GoTo Ecal_err
1510|
1520| Select Case Solt
1530| Case 1
1540| SCPI.SENSe(Ch).CORRection.COLLect.ECAL.SOLT1 = AnaPort(0)
1550| Case 2
1560| SCPI.SENSe(Ch).CORRection.COLLect.ECAL.SOLT2 = AnaPort
1570| Case 3
1580| SCPI.SENSe(Ch).CORRection.COLLect.ECAL.SOLT3 = AnaPort
1590| Case 4
1600| SCPI.SENSe(Ch).CORRection.COLLect.ECAL.SOLT4 = AnaPort
1610| End Select
1620|
1630| ECal_Solt = 0
1640| GoTo Ecal_end
1650|
1660| Ecal_err:
1670| Err_info = SCPI.SYSTem.Error
1680| Buff = MsgBox("Error: " + Err_info(1), vbRetryCancel)
1690| If Buff = vbRetry Then
1700| Resume Ecal_start
1710| Else
1720| ECal_Solt = Err_info(0)
1730| Resume Ecal_end
1740| End If
1750|
1760| Ecal_end:
1770| End Function