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:
Trigger:Source - Where the trigger signals originate:
Internal Continuous
Internal Manual (Single)
External - a trigger source that is connected to the VNA rear panel.
Trigger:Scope - what gets triggered:
Global - each signal triggers all channels in turn.
Channel - each signal triggers ONE channel.
Channel settings (Sense<ch>:Sweep:Mode) How many triggers will each channel accept before going into hold.
HOLD - channel will not trigger.
CONTinuous - channel triggers indefinitely.
GROups - channel accepts the number of triggers specified with the last SENS:SWE:GRO:COUN <num>.
SINGle - channel accepts ONE trigger, then goes to HOLD.
Point trigger SENS1:SWE:TRIG:POINt
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:
Simplest Triggering
This method uses the default Trigger Source = Internal to send a stream of trigger signals.
The channel is configured to ACCEPT only a single trigger signal, then HOLD (Sense<ch>:Sweep:Mode SINGle). This is the ONLY required command.
This method can also be used when an External trigger source sends a continuous stream of trigger signals.
Advanced Triggering
This method SENDS a single trigger from the Source, which can be from either Internal (using INIT:IMM) or External triggering.
Each channel is configured to accept an unlimited number of triggers. This method is the only way to perform point triggering.
When you require some channels to accept continuous triggers and other channels to accept single triggers, see INIT:IMM Advanced to learn how.
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:
S11 traces on two channels
10 data points
Sweep time of 2 seconds - this is slow enough to allow us to watch as each trace is triggered.
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.
This example can be used to configure External triggering where the trigger source sends a continuous stream of trigger signals. Configure the type of trigger signal that the VNA responds to using the CONTrol:SIGNal command. The command in this example sets the VNA to respond to HIGH TTL signals at the rear-panel BNC1 trigger IN connector. This command also automatically sets Trigger Source to External Trigger.
The TRIG SCOPE (Global or Channel) setting is NOT necessary with a continuous stream of trigger signals. The example program directly controls when each channel is triggered.
Point triggering can NOT be used with a continuous stream of trigger signals because in point triggering the channel will accept as many triggers as necessary to complete ONE full sweep. Use the single SEND example for point triggering.
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.
Using this method, it is possible to change Trigger:Scope to Global or Channel. Set trigger scope to channel if there is some code to execute between channel measurements. Similarly, this method can be used to set Point triggering. Use this method if there is some code to execute between data point measurements.
In addition, this method can also be used to perform External triggering if the external trigger source is capable of SENDING single triggers. See the CONTrol:SIGNal command to set the type of signal to which the VNA will respond.
If the external source can only send a continuous stream of trigger signals, then the Single Accept section must be used.
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 |