Other topics about TDR Sample Program
2 channel measurement allows you to makes TDR measurement on channel 1 and more customized S-parameter measurement on channel2. This is a program example of the 2 Channel Measurement Example. In 2 channel measurement, you need to setup two logical instrument, E5071C and E5071C-TDR. In this sample program, the E5071C is assigned as ENA and E5071C-TDR is assigned as ENATDR.
The TDR commands should be sent to ENATDR and The E5071C standard commands should be sent to ENA.
Put *OPC? to make sure to finish the process before you change the control from ENA to ENATDR or ENATDR to ENA.
DUT topology setting should be executed at the beginning of sequence, because changing DUT Topology presets the E5071C.
Dim rm As VisaComLib.ResourceManager
Dim ENA As VisaComLib.FormattedIO488
Dim ENATDR As VisaComLib.FormattedIO488
Dim NumDmy As Integer
Sub OpenInstrument()
On Error GoTo errorhandler
Set rm = New VisaComLib.ResourceManager
Set ENA = New VisaComLib.FormattedIO488
Set ENATDR = New VisaComLib.FormattedIO488
' Change the VISA address for your configuration. For example, if using USB interface, an example would be rm.Open("USB0::0x0957::0x0D09::{serial number}::0::INSTR"), if using LAN interface, an example would be rm.Open("TCPIP0::{ip address}::inst0::INSTR"). If using LAN interface, SICL-LAN Server in the E5071C should be turned on.
Set ENA.IO = rm.Open("GPIB0::17::INSTR")
' Set time out time for ENA at 30 second
ENA.IO.Timeout = 30000
' TDR address is not necessary to change.
Set ENATDR.IO = rm.Open("TCPIP0::localhost::inst0::INSTR")
' Set time out time for ENATDR at 70 second
ENATDR.IO.Timeout = 70000
' Clear Excel Sheet Cells
Range("D7:H10010").ClearContents
Range("E4:E4").ClearContents
Range("H4:H4").ClearContents
MsgBox "E5071C and E5071C-TDR are opened.", vbOKOnly
Exit Sub
errorhandler:
MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext
End Sub
Sub Preparation()
On Error GoTo errorhandler
' Note: Must put *OPC? when you change the control between ENA and ENATDR.
With ENA
' ENA- Preset ENA
.WriteString "*RST"
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
With ENATDR
' TDR- Set Diff 2 port as DUT
.WriteString ":CALC:DEV DIF2"
' TDR- Wait Until Topology Setting is finished.
.WriteString "*OPC?"
NumDmy = .ReadNumber
'
' TDR- Trigger Hold
.WriteString ":TRIG:MODE HOLD"
'
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
' ENA- Setup ENA
With ENA
' Allocate channel must be done after TDR DUT Type setting.
.WriteString ":DISP:SPL D12"
'
' ENA- Set Trigger at BUS
.WriteString ":TRIG:SOUR BUS"
' ENA- Set Trigger scope at Active channel only
.WriteString ":TRIG:SCOP ACT"
'
' ENA- Beep Warning OFF
.WriteString ":SYST:BEEP:WARN:STAT OFF"
'
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
MsgBox "Preparation for 2ch is done.", vbOKOnly
Exit Sub
errorhandler:
MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext
End Sub
Sub SetupCh1()
On Error GoTo errorhandler
With ENATDR
'
' TDR- Execute Deskew
FrmDeSkew.Show ' Call DeSkew subroutine in Form
'
' TDR- Execute Auto DUT Length
FrmDUTLength.Show ' Call DUT Length subroutine in From
'
' TDR- Set rise time for Traces 1 and 2
.WriteString ":CALC:TRAC1:TIME:STEP:RTIM:THR T2_8"
.WriteString ":CALC:TRAC1:TIME:STEP:RTIM:DATA 50e-12"
.WriteString ":CALC:TRAC2:TIME:STEP:RTIM:THR T2_8"
.WriteString ":CALC:TRAC2:TIME:STEP:RTIM:DATA 50e-12"
'
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
'
' Advance mode setting (such as Limit Test) for channel 1 (TDR) should be setup through ENA
'
With ENA
' ENA- Limit Test ON
.WriteString ":CALC1:LIM ON"
' ENA- Limit Line On
.WriteString ":CALC1:LIM:DISP ON"
' ENA- Edit Limit Line
.WriteString ":CALC1:LIM:DATA 2,1,0,1e-9,105,105,2,0,1e-9,75,75"
'
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
MsgBox "Setup for Ch1 is done.", vbOKOnly
Exit Sub
errorhandler:
MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext
End Sub
Sub DeSkew()
With ENATDR
' TDR- Execute Descrew
.WriteString ":SENS:CORR:EXT:AUTO:IMM"
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
End Sub
Sub DUTLength()
With ENATDR
' TDR- Execute Auto DUT length
.WriteString ":SENS:DLEN:AUTO:IMM"
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
End Sub
Sub MeasCh1()
On Error GoTo errorhandler
'
Dim TimeData() As Double, Impedance() As Double
Dim Nop As Integer, PassFail As Integer, i As Integer, k As Integer
'
' Making Measurement for TDR (Channel 1)
With ENA
' ENA- Set active channel at channel 1
.WriteString ":DISP:WIND1:ACT"
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
'
With ENATDR
' TDR- Single Trigger
.WriteString ":TRIG:SING"
' TDR- Wait for measurement end
.WriteString "*OPC?"
NumDmy = .ReadNumber
' TDR- Autoscale
.WriteString ":DISP:ATR:SCAL:AUTO"
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
'
' Read TDR data (Channel1) - TDR Data should be read through ENA.
'
With ENA
' Query Number of Test Points
.WriteString ":SENS1:SWE:POIN?"
Nop = .ReadNumber
ReDim TimeData(Nop - 1)
ReDim Impedance(Nop * 2 - 1)
' Get the data for X axis.
.WriteString ":CALC1:SEL:DATA:XAX?"
TimeData() = .ReadList(ASCIIType_R8, ",")
' Select the trace 1.
.WriteString ":CALC1:PAR1:SEL"
' Get the data for Y axis for active trace.
.WriteString ":CALC1:DATA:FDAT?"
Impedance() = .ReadList(ASCIIType_R8, ",")
' Get limit line test result
.WriteString ":CALC1:LIM:FAIL?"
PassFail = .ReadNumber
k = 0
For i = 0 To Nop - 1
Cells(i + 7, 4) = TimeData(i)
Cells(i + 7, 5) = Impedance(k)
k = k + 2
Next i
Cells(4, 5) = PassFail
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
'MsgBox "Measurement for Ch1 is done.", vbOKOnly
Exit Sub
errorhandler:
MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext
End Sub
Sub SetupCh2()
On Error GoTo errorhandler
With ENA
'
' Setup Network measurement(S-Parameter) on channel 2.
'
' ENA- Set Start Frequency
.WriteString ":SENS2:FREQ:STAR 1E9"
' ENA- Set Stop Frequency
.WriteString ":SENS2:FREQ:STOP 3E9"
' ENA- Set IFBW
.WriteString ":SENS2:BAND 1E3"
' ENA- Fixture Simulator ON
.WriteString ":CALC2:FSIM:STAT ON"
' ENA- Set topology at Balance-Balance
.WriteString ":CALC2:FSIM:BAL:DEV BBAL"
' ENA- Assign Phisical Ports
.WriteString ":CALC2:FSIM:BAL:TOP:BBAL 1,2,3,4"
' ENA- Balance-Balance Conversion ON
.WriteString ":CALC2:FSIM:BAL:PAR1:STAT ON"
' ENA- Select Measurement Parameter at Sdd21
.WriteString ":CALC2:FSIM:BAL:PAR1:BBAL SDD21"
'
' ENA- Limit Test ON
.WriteString ":CALC2:LIM ON"
' ENA- Limit Line On
.WriteString ":CALC2:LIM:DISP ON"
' ENA- Edit Limit Table
.WriteString ":CALC2:LIM:DATA 3,2,100e6,1.25e9,-1.5,-5,2,1.25e9,2.5e9,-5,-7.5,2,2.5e9,7.5e9,-7.5,-25"
'
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
FrmEcal.Show
MsgBox "Setup Ch2 is done.", vbOKOnly
Exit Sub
errorhandler:
MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext
End Sub
Sub EcalCalibration()
With ENA
' ENA- 4 Port Ecal
.WriteString ":SENS2:CORR:COLL:ECAL:SOLT4 1,2,3,4"
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
End Sub
Sub MeasCh2()
On Error GoTo errorhandler
Dim FreqData() As Double, InsersionLoss() As Double
Dim Nop As Integer, PassFail As Integer, i As Integer, k As Integer
'
With ENA
' ENA- Set active channel at channel 2
.WriteString ":DISP:WIND2:ACT"
' ENA- Single Trigger
.WriteString ":INIT2;:TRIG:SING"
' ENA- Wait for measurement end
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
'
' Read Newtwork Meaurement (Channel 2) data
'
With ENA
' ENA- Get Number of Points of data
.WriteString ":SENS2:SWE:POIN?"
Nop = .ReadNumber
' Get the data for x-axis (Frequency)
ReDim FreqData(Nop - 1)
.WriteString ":SENS2:FREQ:DATA?"
FreqData() = .ReadList(ASCIIType_R8, ",")
' Select the trace 1.
.WriteString ":CALC2:PAR1:SEL"
' Get the data for Y-axis (Sdd21 - LogMag)
ReDim InsersionLoss(Nop * 2 - 1)
.WriteString ":CALC2:DATA:FDATA?"
InsersionLoss() = .ReadList(ASCIIType_R8, ",")
' Get limit line test result
.WriteString ":CALC2:LIM:FAIL?"
PassFail = .ReadNumber
'
k = 0
For i = 0 To Nop - 1
Cells(i + 7, 7) = FreqData(i)
Cells(i + 7, 8) = InsersionLoss(k)
k = k + 2
Next i
Cells(4, 8) = PassFail
' *OPC? for checking the process finish
.WriteString "*OPC?"
NumDmy = .ReadNumber
End With
Exit Sub
errorhandler:
MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext
End Sub
Sub CloseInstrument()
ENA.IO.Close
ENATDR.IO.Close
MsgBox "E5071C and E5071C-TDR are closed.", vbOKOnly
End Sub