Simulated Eye Diagram

Overview

This sample program demonstrates how to perform simulated eye diagram.

Sample Program in Excel VBA (VISA-COM)

 

Global variables

    Dim rm As VisaComLib.ResourceManager

    Dim ENATDR As VisaComLib.FormattedIO488

    Dim NumDmy As Integer

 

Open

Sub OpenInstrument()

    On Error GoTo errorhandler

    Set rm = New VisaComLib.ResourceManager

    Set ENATDR = New VisaComLib.FormattedIO488

   

    ' TDR address is not necessary to change.

    Set ENATDR.IO = rm.Open("TCPIP0::localhost::inst0::INSTR")

    ENATDR.IO.Timeout = 50000

    

    ' Clear Excel Sheet Cells

    Range("F5:F22").ClearContents

    MsgBox "E5071C-TDR is opened.", vbOKOnly

    

    Exit Sub

errorhandler:

    MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext

End Sub

 

Setup

Sub setup()

    On Error GoTo errorhandler

    With ENATDR

    'Preset the ENA

    .WriteString ":SYST:PRES"

    .WriteString "*OPC?"

    NumDmy = .ReadNumber

    

    'TDR Trigger Hold

    .WriteString ":TRIG:MODE HOLD"

    ' Set DUT Topology to Differential 2-Port

    .WriteString ":CALC:DEV DIF2"

    .WriteString "*OPC?"

    NumDmy = .ReadNumber

    ' Execute Deskew (Deskew)

    MsgBox "[Deskew] Disconnect the cables from DUT to make open condition.", vbOKOnly

    .WriteString ":SENS:CORR:EXT:AUTO:STAN OPEN"

    .WriteString ":SENS:CORR:EXT:AUTO:PORT1 ON"

    .WriteString ":SENS:CORR:EXT:AUTO:PORT2 ON"

    .WriteString ":SENS:CORR:EXT:AUTO:PORT3 ON"

    .WriteString ":SENS:CORR:EXT:AUTO:PORT4 ON"

    .WriteString ":SENS:CORR:EXT:AUTO:IMM"

    .WriteString "*OPC?"

    NumDmy = .ReadNumber

    'Measure DUT Length

    MsgBox "Connect the DUT to the cables.", vbOKOnly

    .WriteString ":SENS:DLEN:AUTO:IMM"

    .WriteString "*OPC?"

    NumDmy = .ReadNumber

       

    'Set Rise Time

    .WriteString ":CALC:TRAC1:TIME:STEP:RTIM:DATA 35E-12"

    'Set Definition

    .WriteString ":CALC:TRAC1:TIME:STEP:RTIM:THR T1_9"

    'Activate Trace 3

    .WriteString ":CALC:ATR:ACT 3"

    .WriteString ":TRIG:SING"

    .WriteString "*OPC?"

    NumDmy = .ReadNumber

    MsgBox "Setup is completed.", vbOKOnly

 

    End With

  Exit Sub

    

errorhandler:

    MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext

End Sub

 

Simulated Eye Diagram

Sub SimEyeDiagram()

Dim EyeResult() As Double

Dim NoR As Integer, i As Integer

On Error GoTo errorhandler

    With ENATDR

        ' Set Bit Pattern Parameters

        ' Set Type to PRBS

        .WriteString ":CALC:EYE:INP:BPAT:TYPE PRBS"

        ' Set Length

        .WriteString ":CALC:EYE:INP:BPAT:LENG 7"

        ' Set Amplitude

        .WriteString ":CALC:EYE:INP:OLEV 200e-3"

        ' Set Data Rate

        .WriteString ":CALC:EYE:INP:RTIM:THR T1_9"

        .WriteString "*OPC?"

         NumDmy = .ReadNumber

        

       ' Execute Draw Eye

        .WriteString ":CALC:EYE:STAT ON"

        .WriteString ":CALC:EYE:EXEC"

        .WriteString "*OPC?"

        NumDmy = .ReadNumber

        

        'Read Eye Result

        .WriteString ":CALC:EYE:RES:DATA?"

        EyeResult() = .ReadList(ASCIIType_R8, ",")

             

        NoR = 18

        i = 0

        Do While i < NoR

        Cells(i + 5, 6) = EyeResult(i)

            i = i + 1

        Loop

        .WriteString "*OPC?"

        NumDmy = .ReadNumber

        MsgBox "Eye Diagram Simulation is completed.", vbOKOnly

   End With

  Exit Sub

  

errorhandler:

    MsgBox Err.Description, vbExclamation, "Error Occurred", Err.HelpFile, Err.HelpContext

  End Sub

 

Close

Sub CloseInstrument()

       ENATDR.IO.Close

End Sub