Triggering the VNA using SCPI


To understand how to trigger the VNA using SCPI, it is very important to understand the VNA trigger model. Here is a very simple explanation. These three separate functions control VNA triggering:

  1. Trigger:Source - Where the trigger signals originate:

  2. Trigger:Scope - what gets triggered:

  3. Channel settings (Sense<ch>:Sweep:Mode) How many triggers will each channel accept before going into hold.

When controlling the VNA using SCPI, a SINGLE trigger is used to ensure that a complete sweep is taken. This example demonstrates how to Single trigger the VNA using the following two methods:

The SCPI commands in this example are sent over a COM interface using the SCPIStringParser object. You do NOT need a GPIB connection to run this example.

This VBScript (*.vbs) program can be run as a macro in the VNA. To do this, copy the following code into a text editor file such as Notepad and save it on the VNA hard drive as Trigger.vbs. Learn how to setup and run the macro.

 

Measurement setup example:  This section of code can be used at the start of both methods. It sets up:

Sub SampleTrigger()

    '

    '    *** The memory area of the resource manager and the instrument I/O are acquired.

    Set ioMgr = New VisaComLib.ResourceManager

    Set GPIB = New VisaComLib.FormattedIO488

    '*** Open the instrument.

    Set GPIB.IO = ioMgr.Open("GPIB0::16::INSTR")

    GPIB.IO.timeout = 10000

 

    'Preset the analyzer

    GPIB.WriteString "SYST:PReset", True

    GPIB.WriteString ":DISPlay:SPLit 2", True

    'Create one trace on each window

    GPIB.WriteString ":CALCulate1:PARameter:COUNt 1", True

    GPIB.WriteString ":CALCulate2:PARameter:COUNt 1", True

    'Define the parameter for each trace

    GPIB.WriteString ":CALCulate1:MEASure1:PARameter 'S11'", True

    GPIB.WriteString ":CALCulate2:MEASure2:PARameter 'S22'", True

    'set number of points to 10

    GPIB.WriteString "SENS1:SWE:POIN 10", True

    GPIB.WriteString "SENS2:SWE:POIN 10", True

    'Set slow sweep so we can see

    GPIB.WriteString "SENS1:SWE:TIME 2", True

    GPIB.WriteString "SENS2:SWE:TIME 2", True

    '================================

    ' Put both channels in Hold

    GPIB.WriteString "SENS1:SWE:MODE HOLD", True

    GPIB.WriteString "SENS2:SWE:MODE HOLD", True

    '================================

    'Pick Single Send or Single Accept

    resp = MsgBox("Single Send? - Click No for Single Accept", vbYesNo, "VNA Trigger Demo")

    If resp = vbYes Then

        SingleSend

    Else

        SingleAccept

    End If

    

    '*** End procedure

    GPIB.IO.Close

End Sub

 

 

Simple Triggering  The following example sends a continuous stream of trigger signals and each VNA channel is set to ACCEPT only a signal trigger signal, then HOLD.

Sub SingleAccept()

    'PNA sends continuous trigger signals

     GPIB.WriteString "TRIG:SOUR IMMediate", True

    

    'Uncomment the following to set External triggering

    'gpib.writestring"CONT:SIGN BNC1,TILHIGH", true

     AcceptOne

End Sub

 

Sub AcceptOne()

    'The following command makes the channel immediately sweep

     GPIB.WriteString "SENS1:SWE:MODE SINGle", True

     

    '*OPC? allows the measurement to complete before the controller sends another command

     GPIB.WriteString "*OPC?", True

     Dmy = GPIB.ReadNumber

    ' You could do something to ch2 here before sweeping it

     GPIB.WriteString "SENS2:SWE:MODE SINGle;*OPC?", True

     Dmy = GPIB.ReadNumber

    resp = MsgBox("Another trigger?", vbOKCancel, "VNA Trigger Demo")

    If resp = vbOK Then

        AcceptOne

    End If

End Sub

 

 

 

Advanced Trigger This example section performs Single Send triggering. Here, single triggering is accomplished by SENDING one trigger signal from the Trigger source and each channel is setup to accept unlimited trigger signals. See the INIT:IMM command for more details.

Sub SingleSend()

    'Set Source Internal - Manual Triggering

     GPIB.WriteString "TRIG:SOUR MANual", True

    'If using an External trigger source that is capable of

    'sending SINGLE trigger signals, then uncomment the following.

    'This command automatically sets trigger source to External

    '     gpib.writestring"CONT:SIGN BNC1,TILHIGH", true

    'Setup Trigger Scope

    'WHAT gets triggered

    'Pick one using comments

    'Set Channel triggering

    ' gpib.writestring"TRIG:SCOPe CURRent", true

    'Set Global triggering (Default)

     GPIB.WriteString "TRIG:SCOPe ALL", True

    'Set Channel Settings

    'The channels respond to UNLIMITED trigger signals (Default)

     GPIB.WriteString "SENS1:SWE:MODE CONTinuous", True

     GPIB.WriteString "SENS2:SWE:MODE CONTinuous", True

    'To do Point trigger on one or more channels, uncomment the following.

    'Point trigger automatically sets Trig:Scope to Current/Channel

    '     gpib.writestring"SENS1:SWE:TRIG:POINt ON", true

    '     gpib.writestring"SENS2:SWE:TRIG:POINt ON", true

    IntTrig

End Sub

 

Sub IntTrig()

    'If External triggering, replace this Sub with code

    'to single trigger the External Trig Source

    '*OPC? allows the measurement to complete before the controller sends another command

    GPIB.WriteString "INITiate:IMMediate;*OPC?", True

    Dmy = GPIB.ReadNumber

    resp = MsgBox("Another trigger?", vbOKCancel, "VNA Trigger Demo")

    If resp = vbOK Then

        IntTrig

    End If

End Sub

 



Last modified:

2016-05-18

First release