Sample Program

Other topics about Sample Programs

Overview

In this test, 2 tests - 1 single ended and 1 differential tests are performed with deskew error correction.

Number of tests - 2 tests, where Test 1: T33 and Test 2: Tdd11.

Sample Program in Excel VBA

Option Explicit

Dim rm As VisaComLib.ResourceManager

Dim TW As VisaComLib.FormattedIO488

 

Sub Test_Wizard_Program2()

Dim NumDmy As Integer

Dim i As Integer

Dim Result As Integer

Dim CompleteResult As Integer

On Error GoTo errorhandler

Set rm = New VisaComLib.ResourceManager

Set TW = New VisaComLib.FormattedIO488

'Set timeout

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

TW.IO.Timeout = 10000

'Clear Excel Sheet Cells

Range("B8:B9").ClearContents

'Select New Test - System Preset

'Comment this line if past Error Correction is reused.

TW.WriteString ":SYST:PRES", True

'Set DUT Topology - for both tests

'Comment this line if past Error Correction is reused.

TW.WriteString ":SYST:TOP:SWIT 1", True 'Set Switch at Port 1 only

TW.WriteString ":SYST:TOP:DEV D1", True 'Set DIFF1P & SE1P

'Perform Error Correction for both test - Deskew

MsgBox ("Connect the switch and cables on both Ports. Remove all DUT (if any) from both ports"), vbInformation

'The following 3 lines are not necessary.

'CORR:EXT:AUTO:IMM will automatically change the Error Correction method to Deskew.

'Comment this line if past Error Correction is reused.

TW.WriteString ":SENS:CORR:PORT1:METH DESK", True

TW.WriteString ":SENS:CORR:PORT2:METH DESK", True

TW.WriteString ":SENS:CORR:PORT3:METH DESK", True

'Perform Deskew calibration for all the 3 ports.

TW.WriteString ":SENS:CORR:EXT:AUTO:IMM", True

'Setup Test Sequence

'Turn ON the Fail sign

TW.WriteString ":SYST:SEQ:FSIG ON", True

'Setup Edit Measurement

'Test 1

'Set measurement type & parameter

TW.WriteString ":CALC:TRAC:PAR ""TDD11""", True

'Set DUT Length to 880 ps - Setting DUT length is only applicable to Time Domain.

TW.WriteString ":CALC:DLEN:DATA 880E-12", True

'Set Limit Type to Absolute Limit

TW.WriteString ":CALC:TRAC:LIM:MODE ABS", True

'Set Limit Beginning value to 35% & End value to 70%

TW.WriteString ":CALC:TRAC:LIM:RAT:BEG 35", True

TW.WriteString ":CALC:TRAC:LIM:RAT:END 70", True

'Set limit target value to 100 ohm

TW.WriteString ":CALC:TRAC:LIM:TARG 100", True

'Set tolerance ratio to 20%

TW.WriteString ":CALC:TRAC:LIM:TOL:RAT 20", True

'Test 2

'Add new test list

TW.WriteString ":SENS:LIST:DEF", True

'Select test list 2

TW.WriteString ":SENS:LIST:SEL 2", True

'Set measurement type & parameter

TW.WriteString ":CALC:TRAC:PAR ""T33""", True

'Set DUT Length to 880 ps - Setting DUT length is only applicable to Time Domain.

TW.WriteString ":CALC:DLEN:DATA 880E-12", True

'Set Limit Type to Absolute Limit

TW.WriteString ":CALC:TRAC:LIM:MODE ABS", True

'Set Limit Beginning value to 35% & End value to 50%

TW.WriteString ":CALC:TRAC:LIM:RAT:BEG 35", True

TW.WriteString ":CALC:TRAC:LIM:RAT:END 50", True

'Set tolerance to 50 ohm

TW.WriteString ":CALC:TRAC:LIM:TARG 50", True

'Set tolerance ratio to 10%

TW.WriteString ":CALC:TRAC:LIM:TOL:RAT 10", True

'Perform Measurement

'Instruction to perform measurement connection.

MsgBox ("Connect Port 1 (Port 1 on the Switch) to J9 | Port 2 to J10 | Port 3 (Port 2 on the Switch) to J2"), vbInformation

For i = 1 To 2

    TW.WriteString ":SENS:LIST:SEL 1", True  'Select First Test List

    'Make single trigger

    TW.WriteString ":TRIG:SING", True

    'Wait till measurement is completed

    TW.WriteString "*OPC?", True

    NumDmy = TW.ReadNumber

    'Check if test condition failed (or passed?), for Test 1. Fail returns 1.

    TW.WriteString ":CALC:TRAC:LIM:FAIL?"

    Result = TW.ReadNumber

    If Result = 1 Then

        Range("B8:B8").Value = "Fail"

    Else

        Range("B8:B8").Value = "Pass"

    End If

    'Store trace data

    TW.WriteString ":MMEM:STOR:FDAT ""C:\work\Test1_" & i & ".csv""", True

       

    TW.WriteString ":SENS:LIST:SEL 2", True

    TW.WriteString ":TRIG:SING", True

    TW.WriteString "*OPC?", True

    NumDmy = TW.ReadNumber

    'Check if test condition failed (or passed?), for Test 2. Fail returns 1.

    TW.WriteString ":CALC:TRAC:LIM:FAIL?"

    Result = TW.ReadNumber

    If Result = 1 Then

        Range("B8:B8").Value = "Fail"

    Else

        Range("B8:B8").Value = "Pass"

    End If

    'Store trace data

    TW.WriteString ":MMEM:STOR:FDAT ""C:\work\Test2_" & i & ".csv""", True

    'Checking overall pass/fail status of current test sequence

    TW.WriteString ":SENS:LIST:RES?", True

    CompleteResult = TW.ReadNumber

    If CompleteResult = 1 Then

        Range("B9:B9").Value = "Pass"

    Else

        Range("B9:B9").Value = "Fail"

    End If

    'Store test result of current instance.

    TW.WriteString ":MMEM:STOR:RES ""C:\work\TW" & i & ".csv""", True

Next i

    

Exit Sub

errorhandler:

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

End Sub