﻿;-----------------------------------------------------------------------------
; AIM-TTI TGF4000 Function Generators
;
; Revision 0.5 	19 Feb 2022		Inital release
;          0.9  10 Apr 2022     Add sweep, burst and modulation
;                               Add buffering when values are written 
;          0.91 10 Jul 2022     Remove tabulator prefix for items in the 
;                               :update: dialog
;                               Add notes text
;          0.92 17 Jul 2022     Reset device upon connection
;                               Increase frequency precission to 15 digits
;                               Change device name to Aim TTi ...
;
; Problems and known Bugs:
; - TGF4000 device
;   The FTG4000 series does not support the read back of programmed values (!), so
;   in general the correct state of the instrument cannot be detected. The 
;   corresponding COMMAND? operations - except for a few cases - are not supported.
;   Since this is very unique in the industry, I contacted AIM-TTi but got no 
;   support or response so far (the motiviation seems to be very limited).
;   The current workaround is like this: All SCPI commands got a wrapper, which
;   store the programmed values in an dedicated variable. The readback returns then
;   the variable contents instead of the value from the instrument. This works 
;   as long the "factory reset" button in the Setup window or the *RST command 
;   is applied at the beginning of the session which synchronizes the host and 
;   device to a well known state.
;   Practically you can live with this solution, but of corse there exists
;   corner cases where the replicated system state on the host no longer supports
;   the behaviour of the instrumnt (e.g. error cases, duty/width setting on the
;   display of the pulse waveform when switching frequency/periode, ...)
;-  TGF4000 device
;   A more sophisticated solution would be to use the LRN? command, which 
;   transfers the device state to the host, analyze it and fill out all variables.
;   But since Windows 10 the LRN? command does no longer work (the instrument 
;   hangs and needs to be shut off to recover from that situation)
;-----------------------------------------------------------------------------

#author   PL (template from MikeLud)


;------------------------------------------------------------
; Devices
;------------------------------------------------------------

#metadef
#idString THURLBY THANDAR, TGF4042
#name     Aim TTi TGF4042
#handle   TGF4042
#port     com 5025 LXI GPIP

#sections
#replaceText MaxFrequency 40M
#replaceText MinPeriod 25.000n
#replaceText MinSlopeTime 8n
#replaceText MinPulseWidth 20n

#metadef
#idString THURLBY THANDAR, TGF4082
#name     Aim TTi TGF4082
#handle   TGF4082
#port     com 5025 LXI GPIP

#sections
#replaceText MaxFrequency 80M
#replaceText MinPeriod 12.500n
#replaceText MinSlopeTime 8n
#replaceText MinPulseWidth 20n

#metadef
#idString THURLBY THANDAR, TGF4162
#name     Aim TTi TGF4162
#handle   TGF4162
#port     com 5025 LXI GPIP

#sections    ExtendedFunctions
#replaceText MaxFrequency 160M
#replaceText MinPeriod 6.250n
#replaceText MinSlopeTime 2.5n
#replaceText MinPulseWidth 5n

#metadef
#idString THURLBY THANDAR, TGF4242
#name     Aim TTi TGF4242
#handle   TGF4242
#port     com 5025 LXI GPIP

#sections    ExtendedFunctions
#replaceText MaxFrequency 240M
#replaceText MinPeriod 4.167n
#replaceText MinSlopeTime 2.5n
#replaceText MinPulseWidth 5n

#meta
#idString THURLBY THANDAR, TGF4162
#name     Aim TTi TGF4162
#handle   TGF4162
#port     com 5025 LXI GPIP

#driver SCPIx


;------------------------------------------------------------------------------------
; Emulation Layer
;------------------------------------------------------------------------------------

; The TGF4000 devices do not allow the read back of programmed values (!). A wrapper 
; ia needed, in order to store programmed values for read back. The command names are
; taken from the Tektronix 33600 series, so some degree of SCPI compability is
; additioally provided (the counter itself is not supported by Tektronix).

;-- Default State --------------------------------------------------------------------------

; Global/Counter
#scpiCmd RCNT none
:setvar: counteron=0;countertype=0;countercplng=0;

#scpiCmd ROUT none
:setvar: outputsync="OFF";outputsyncmode="OFF";outputsyncsour="MAINOUT";outputfreqcoup="OFF";outputvoltcoup="OFF";outputcoup="OFF";outputtracking="OFF";


; Output 1
#scpiCmd R1A none
:setvar: chan1output=0;chan1outputinvert=0;chan1amplrng="AUTO";chan1phase=0.0;chan1zload=50.0;

#scpiCmd R1B none
:setvar: chan1freq=10000.0;chan1pulsfreq=10000.0;chan1freq=10000.0;chan1pulsfreq=10000.0;chan1prbsfreq=10000.0;

#scpiCmd R1C none
:setvar: chan1ampl=1.0;chan1dcoffs=0.0;chan1lolvl=-0.5;chan1hilvl=0.5;

#scpiCmd R1D none 
:setvar: chan1sqrsymm=50.0;chan1rmpsymm=50.0;chan1pulswid=(1/10000.0)/2;chan1pulsrise=0.000000010;chan1pulsfall=0.000000010;chan1pulsdly=0.0;

#scpiCmd R1E none 
:setvar: chan1bst=0;chan1bsttrgsrc="INT";chan1bsttrgpol="POS";chan1bstper=0.005;chan1bstcount=1;chan1bstphase=0;

#scpiCmd R1F none 
:setvar: chan1swp=0;chan1swpmode="CONT";chan1swptrgsrc="INT";chan1swptype="LINUP";

#scpiCmd R1G none 
:setvar: chan1swpper=0.005;chan1swpbegfreq=1000.0;chan1swpendfreq=10000.0;chan1swptime=0.5;chan1swptrgpol="POS";

#scpiCmd R1H none 
:setvar: chan1mod=0;chan1modamshape="SINE";chan1modfmshape="SINE";chan1modpmshape="SINE";chan1modpwmshape="SINE";

#scpiCmd R1I none 
:setvar: chan1modsumshape="SINE";chan1modamsrc="INT";chan1modfmsrc="INT";chan1modpmsrc="INT";

#scpiCmd R1J none 
:setvar: chan1modpwmsrc="INT";chan1modsumsrc="INT";chan1modasksrc="INT";chan1modfsksrc="INT";chan1modbpsksrc="INT";

#scpiCmd R1K none 
:setvar: chan1modamfreq=1000.0;chan1modfmfreq=1000.0;chan1modpmfreq=1000.0;chan1modpwmfreq=1000.0;chan1modsumfreq=1000.0;

#scpiCmd R1L none 
:setvar: chan1modamdepth=50.0;chan1modfmdev=2000.0;chan1modpmdev=180.0;chan1modpwmdev=50.0;chan1modsumlevel=50.0;

#scpiCmd R1M none 
:setvar:  chan1modhopampl=0.500;chan1modhopfreq=5000.0;chan1modbpskphase=180.0;chan1modaskrate=1000.0;chan1modfskrate=1000.0;

#scpiCmd R1N none 
:setvar: chan1modbpskrate=1000.0;chan1modaskpol="POS";chan1modfskpol="POS";chan1modbpskpol="POS";


; Output 2
#scpiCmd R2A none
:setvar: chan2output=0;chan2outputinvert=0;chan2amplrng="AUTO";chan2phase=0.0;chan2zload=50.0;

#scpiCmd R1B none
:setvar: chan2freq=10000.0;chan2pulsfreq=10000.0;chan2freq=10000.0;chan2pulsfreq=10000.0;chan2prbsfreq=10000.0;

#scpiCmd R2C none
:setvar: chan2ampl=1.0;chan2dcoffs=0.0;chan2lolvl=-0.5;chan2hilvl=0.5;

#scpiCmd R2D none 
:setvar: chan2sqrsymm=50.0;chan2rmpsymm=50.0;chan2pulswid=(1/10000.0)/2;chan2pulsrise=0.000000010;chan2pulsfall=0.000000010;chan2pulsdly=0.0;

#scpiCmd R2E none 
:setvar: chan2bst=0;chan2bsttrgsrc="INT";chan2bsttrgpol="POS";chan2bstper=0.005;chan2bstcount=1;chan2bstphase=0;

#scpiCmd R2F none 
:setvar: chan2swp=0;chan2swpmode="CONT";chan2swptrgsrc="INT";chan2swptype="LINUP";

#scpiCmd R2G none 
:setvar: chan2swpper=0.005;chan2swpbegfreq=1000.0;chan2swpendfreq=10000.0;chan2swptime=0.5;chan2swptrgpol="POS";

#scpiCmd R2H none 
:setvar: chan2mod=0;chan2modamshape="SINE";chan2modfmshape="SINE";chan2modpmshape="SINE";chan2modpwmshape="SINE";

#scpiCmd R2I none 
:setvar: chan2modsumshape="SINE";chan2modamsrc="INT";chan2modfmsrc="INT";chan2modpmsrc="INT";

#scpiCmd R2J none 
:setvar: chan2modpwmsrc="INT";chan2modsumsrc="INT";chan2modasksrc="INT";chan2modfsksrc="INT";chan2modbpsksrc="INT";

#scpiCmd R2K none 
:setvar: chan2modamfreq=1000.0;chan2modfmfreq=1000.0;chan2modpmfreq=1000.0;chan2modpwmfreq=1000.0;chan2modsumfreq=1000.0;

#scpiCmd R2L none 
:setvar: chan2modamdepth=50.0;chan2modfmdev=2000.0;chan2modpmdev=180.0;chan2modpwmdev=50.0;chan2modsumlevel=50.0;

#scpiCmd R2M none 
:setvar:  chan2modhopampl=0.500;chan2modhopfreq=5000.0;chan2modbpskphase=180.0;chan2modaskrate=1000.0;chan2modfskrate=1000.0;

#scpiCmd R2N none 
:setvar: chan2modbpskrate=1000.0;chan2modaskpol="POS";chan2modfskpol="POS";chan2modbpskpol="POS";



;-- Counter --------------------------------------------------------------------------

#scpiCmd COUNT:STAT CNTRSWT (getElement("OFF ON",value))
:setvar: counteron=inputValue
#scpiCmd COUNT:STAT? none?
:readmath: varExists("counteron")?counteron:(0)

#scpiCmd COUNT:MODE CNTRTYPE (value)
:setvar: countertype=inputValue
#scpiCmd COUNT:MODE? none?
:readmath: varExists("countertype")?countertype:(0)

#scpiCmd COUNT:COUP CNTRCPLNG (value)
:setvar: countercplng=inputValue
#scpiCmd COUNT:COUP? none?
:readmath: varExists("countercplng")?countercplng:(0)


;-- System --------------------------------------------------------------------------

; System
#scpiCmd SYST:ERR? EER?
#scpiCmd SYST:BEEP BEEP

; Clock
#scpiCmd ROSC:SOUR? CLKSRC?
#scpiCmd ROSC:SOUR CLKSRC (value)


;-- Output --------------------------------------------------------------------------

; Sync
#scpiCmd OUTP:SYNC CHN 1; SYNCOUT (value)
:setvar: outputsync=inputValue
#scpiCmd OUTP:SYNC? none?
:readmath: varExists("outputsync")?(outputsync):("OFF")

#scpiCmd OUTP:SYNC:MODE CHN 1; SYNCTYPE (value)
:setvar: outputsyncmode=inputValue
#scpiCmd OUTP:SYNC:MODE? none?
:readmath: varExists("outputsyncmode")?(outputsyncmode):("OFF")

#scpiCmd OUTP:SYNC:SOUR CHN 1; CHN2CONFIG (value)
:setvar: outputsyncsour=inputValue
#scpiCmd OUTP:SYNC:SOUR? none?
:readmath: varExists("outputsyncsour")?(outputsyncsour):("MAINOUT")

#scpiCmd PHAS:SYNC ALIGN

; Coupling
#scpiCmd FREQ:COUP CHN 1; FRQCPLSWT (value)
:setvar: outputfreqcoup=inputValue
#scpiCmd FREQ:COUP? none?
:readmath: varExists("outputfreqcoup")?(outputfreqcoup):("OFF")

#scpiCmd VOLT:COUP CHN 1; AMPLCPLNG (value)
:setvar: outputvoltcoup=inputValue
#scpiCmd VOLT:COUP? none?
:readmath: varExists("outputvoltcoup")?(outputvoltcoup):("OFF")

#scpiCmd OUTP:COUP CHN 1; OUTPUTCPLNG (value)
:setvar: outputcoup=inputValue
#scpiCmd OUTP:COUP? none?
:readmath: varExists("outputcoup")?(outputcoup):("OFF")

#scpiCmd TRACK CHN 1; TRACKING (value)
:setvar: outputtracking=inputValue
#scpiCmd TRACK? none?
:readmath: varExists("outputtracking")?(outputtracking):("OFF")


;-- Arbitrary -----------------------------------------------------------------------

#scpiCmd FUNC:ARB:FILT ARBFILTER (value)

#scpiCmd FUNC:ARB:BAL:OFFS ARBDCOFFS (value)


;-- Channel 1 -----------------------------------------------------------------------

; Menu
#scpiCmd SOUR1:MENU none
:setvar: chan1menu=inputValue
#scpiCmd SOUR1:MENU? none?
:readmath: varExists("chan1menu")?(chan1menu):(0)

#scpiCmd SOUR1:MENU:LEVEL none
:setvar: chan1menulevel=inputValue
#scpiCmd SOUR1:MENU:LEVEL? none?
:readmath: varExists("chan1menulevel")?(chan1menulevel):(0)

#scpiCmd SOUR1:MENU:PERIOD none
:setvar: chan1menuperiod=inputValue
#scpiCmd SOUR1:MENU:PERIOD? none?
:readmath: varExists("chan1menuperiod")?(chan1menuperiod):(0)

#scpiCmd SOUR1:MENU:WIDTH none
:setvar: chan1menuwidth=inputValue
#scpiCmd SOUR1:MENU:WIDTH? none?
:readmath: varExists("chan1menuwidth")?(chan1menuwidth):(0)

; Output
#scpiCmd OUTP1 CHN 1; OUTPUT (getElement("OFF ON",value))
:setvar: chan1output=inputValue
#scpiCmd OUTP1? none?
:readmath: varExists("chan1output")?chan1output:(0)

#scpiCmd OUTP1:POL CHN 1;OUTPUT (getElement("NORMAL INVERT",value))
:setvar: chan1outputinvert=inputValue
#scpiCmd OUTP1:POL? none?
:readmath: varExists("chan1outputinvert")?chan1outputinvert:(0)

#scpiCmd SOUR1:VOLT:RANGE:AUTO CHN 1; AMPLRNG (value)
:setvar: chan1amplrng=inputValue
#scpiCmd SOUR1:VOLT:RANGE:AUTO? none?
:readmath: varExists("chan1amplrng")?(chan1amplrng):("AUTO")

#scpiCmd SOUR1:PHASE CHN 1; PHASE (value)
:setvar: chan1phase=inputValue
#scpiCmd SOUR1:PHASE? none?
:readmath: varExists("chan1phase")?(chan1phase):(0.0)

#scpiCmd OUTP1:LOAD CHN 1; ZLOAD (value)
:setvar: chan1zload=inputValue
#scpiCmd OUTP1:LOAD? none?
:readmath: varExists("chan1zload")?(chan1zload):(50.0)


; Wave
#scpiCmd SOUR1:FUNC CHN 1; (inList(value,"DC SINC HAVERSINE CARDIAC EXPRISE LOGRISE EXPFALL LOGFALL GAUSSIAN LORENTZ DLORENTZ ARB1 ARB2 ARB3 ARB4")?"WAVE ARB; ARBLOAD":"WAVE") (value)
:setvar: chan1wave=inputValue
#scpiCmd SOUR1:FUNC? none?
:readmath: varExists("chan1wave")?chan1wave:"SINE"

; Frequency
#scpiCmd SOUR1:FREQ CHN 1; FREQ (value)
:setvar: chan1freq=inputValue
#scpiCmd SOUR1:FREQ? none?
:readmath: varExists("chan1freq")?chan1freq:(10000.0)

#scpiCmd SOUR1:FUNC:PULS:FREQ CHN 1; PULSFreq (value)
:setvar: chan1pulsfreq=inputValue
#scpiCmd SOUR1:FUNC:PULS:FREQ? none?
:readmath: varExists("chan1pulsfreq")?chan1pulsfreq:(10000.0)

#scpiCmd SOUR1:PER CHN 1; PER (value)
:setvar: chan1freq=1/inputValue
#scpiCmd SOUR1:PER? none?
:readmath: varExists("chan1freq")?(1/chan1freq):(1.0/10000.0)

#scpiCmd SOUR1:FUNC:PULS:PER CHN 1; PULSPER (value)
:setvar: chan1pulsfreq=1/inputValue
#scpiCmd SOUR1:FUNC:PULS:PER? none?
:readmath: varExists("chan1pulsfreq")?(1/chan1pulsfreq):(1.0/10000.0)

#scpiCmd SOUR1:FUNC:PRBS:BRAT CHN 1; PRBSBitRate (value)
:setvar: chan1prbsfreq=inputValue
#scpiCmd SOUR1:FUNC:PRBS:BRAT? none?
:readmath: varExists("chan1prbsfreq")?(chan1prbsfreq):(10000.0)

; Amplitude
#scpiCmd SOUR1:VOLT CHN 1; AMPL (value)
:setvar: chan1ampl=inputValue
#scpiCmd SOUR1:VOLT? none?
:readmath: varExists("chan1ampl")?chan1ampl:(1.0)
#scpiCmd SOUR1:VOLT:SETHI none
:setvar: chan1ampl=inputValue-(varExists("chan1lolvl")?chan1lolvl:-0.5);
#scpiCmd SOUR1:VOLT:SETLO none
:setvar: chan1ampl=(varExists("chan1hilvl")?chan1hilvl:0.5)-inputValue;

#scpiCmd SOUR1:VOLT:OFFS CHN 1; DCOFFS (value)
:setvar: chan1dcoffs=inputValue
#scpiCmd SOUR1:VOLT:OFFS? none?
:readmath: varExists("chan1dcoffs")?chan1dcoffs:(0.0)
#scpiCmd SOUR1:VOLT:OFFS:SETHI none
:setvar: chan1dcoffs=(inputValue+(varExists("chan1lolvl")?chan1lolvl:-0.5))/2;
#scpiCmd SOUR1:VOLT:OFFS:SETLO none
:setvar: chan1dcoffs=((varExists("chan1hilvl")?chan1hilvl:0.5)+inputValue)/2;

#scpiCmd SOUR1:VOLT:LOW CHN 1; LOLVL (value)
:setvar: chan1lolvl=inputValue
#scpiCmd SOUR1:VOLT:LOW? none?
:readmath: varExists("chan1lolvl")?chan1lolvl:(-0.5)
#scpiCmd SOUR1:VOLT:LOW:SETA none
:setvar: chan1lolvl=(varExists("chan1dcoffs")?chan1dcoffs:0)-inputValue/2;
#scpiCmd SOUR1:VOLT:LOW:SETO none
:setvar: chan1lolvl=inputValue-(varExists("chan1ampl")?chan1ampl:1)/2;

#scpiCmd SOUR1:VOLT:HIGH CHN 1; HILVL (value)
:setvar: chan1hilvl=inputValue
#scpiCmd SOUR1:VOLT:HIGH? none?
:readmath: varExists("chan1hilvl")?chan1hilvl:(0.5)
#scpiCmd SOUR1:VOLT:HIGH:SETA none
:setvar: chan1hilvl=(varExists("chan1dcoffs")?chan1dcoffs:0)+inputValue/2; 
#scpiCmd SOUR1:VOLT:HIGH:SETO none
:setvar: chan1hilvl=inputValue+(varExists("chan1ampl")?chan1ampl:1)/2; 

; Square
#scpiCmd SOUR1:FUNC:SQU:SYMM CHN 1; SQRSYMM (value)
:setvar: chan1sqrsymm=inputValue
#scpiCmd SOUR1:FUNC:SQU:SYMM? none?
:readmath: varExists("chan1sqrsymm")?(chan1sqrsymm):(50.0)

; Ramp
#scpiCmd SOUR1:FUNC:RAMP:SYMM CHN 1; RMPSYMM (value)
:setvar: chan1rmpsymm=inputValue
#scpiCmd SOUR1:FUNC:RAMP:SYMM? none?
:readmath: varExists("chan1rmpsymm")?(chan1rmpsymm):(50.0)

; Pulse
#scpiCmd SOUR1:FUNC:PULS:DCYC CHN 1; PULSSYMM (value)
:setvar: chan1pulswid=(1/(varExists("chan1pulsfreq")?chan1pulsfreq:(10000.0)))*(inputValue/100)
#scpiCmd SOUR1:FUNC:PULS:DCYC? none?
:readmath: (varExists("chan1pulswid")?(chan1pulswid):((1/10000.0)/2))/(1/(varExists("chan1pulsfreq")?chan1pulsfreq:(10000.0)))*100

#scpiCmd SOUR1:FUNC:PULS:WIDT CHN 1; PULSWID (value)
:setvar: chan1pulswid=inputValue
#scpiCmd SOUR1:FUNC:PULS:WIDT? none?
:readmath: varExists("chan1pulswid")?(chan1pulswid):((1/10000.0)/2)

#scpiCmd SOUR1:FUNC:PULS:TRAN:LEAD CHN 1; PULSRISE (value)
:setvar: chan1pulsrise=inputValue
#scpiCmd SOUR1:FUNC:PULS:TRAN:LEAD? none?
:readmath: varExists("chan1pulsrise")?(chan1pulsrise):(0.000000010)

#scpiCmd SOUR1:FUNC:PULS:TRAN:TRA CHN 1; PULSFALL (value)
:setvar: chan1pulsfall=inputValue
#scpiCmd SOUR1:FUNC:PULS:TRAN:TRA? none?
:readmath: varExists("chan1pulsfall")?(chan1pulsfall):(0.000000010)

#scpiCmd SOUR1:FUNC:PULS:DEL CHN 1; PULSDLY (value)
:setvar: chan1pulsdly=inputValue
#scpiCmd SOUR1:FUNC:PULS:DEL? none?
:readmath: varExists("chan1pulsdly")?(chan1pulsdly):(0.0)

; Burst
#scpiCmd SOUR1:BURS:MODE CHN 1; BST (value)
:setvar: chan1bst=inputValue
#scpiCmd SOUR1:BURS:MODE? none?
:readmath: varExists("chan1bst")?(chan1bst):(0)

#scpiCmd SOUR1:BURS:TRIG:SOUR CHN 1; BSTTRGSRC (value)
:setvar: chan1bsttrgsrc=inputValue
#scpiCmd SOUR1:BURS:TRIG:SOUR? none?
:readmath: varExists("chan1bsttrgsrc")?(chan1bsttrgsrc):("INT")

#scpiCmd SOUR1:BURS:GATE:POL CHN 1; BSTTRGPOL (value)
:setvar: chan1bsttrgpol=inputValue
#scpiCmd SOUR1:BURS:GATE:POL? none?
:readmath: varExists("chan1bsttrgpol")?(chan1bsttrgpol):("POS")

#scpiCmd SOUR1:BURS:INT:PER CHN 1; BSTPER (value)
:setvar: chan1bstper=inputValue
#scpiCmd SOUR1:BURS:INT:PER? none?
:readmath: varExists("chan1bstper")?(chan1bstper):(0.005)

#scpiCmd SOUR1:BURS:NCYC CHN 1; BSTCOUNT (value)
:setvar: chan1bstcount=inputValue
#scpiCmd SOUR1:BURS:NCYC? none?
:readmath: varExists("chan1bstcount")?(chan1bstcount):(1)

#scpiCmd SOUR1:BURS:PHASE CHN 1; BSTPHASE (value)
:setvar: chan1bstphase=inputValue
#scpiCmd SOUR1:BURS:PHASE? none?
:readmath: varExists("chan1bstphase")?(chan1bstphase):(0)

; Sweep
#scpiCmd SOUR1:SWE:STAT CHN 1; SWP (value)
:setvar: chan1swp=inputValue
#scpiCmd SOUR1:SWE:STAT? none?
:readmath: varExists("chan1swp")?(chan1swp):(0)

#scpiCmd SOUR1:SWE:TRIG:SOUR CHN 1; BSTTRGSRC (value)
:setvar: chan1swptrgsrc=inputValue
#scpiCmd SOUR1:SWE:TRIG:SOUR? none?
:readmath: varExists("chan1swptrgsrc")?(chan1swptrgsrc):("INT")

#scpiCmd SOUR1:SWE:MODE CHN 1; SWPMODE (value)
:setvar: chan1swpmode=inputValue
#scpiCmd SOUR1:SWE:MODE? none?
:readmath: varExists("chan1swpmode")?(chan1swpmode):("CONT")

#scpiCmd SOUR1:SWE:SPAC CHN 1; SWPTYPE (value)
:setvar: chan1swptype=inputValue
#scpiCmd SOUR1:SWE:SPAC? none?
:readmath: varExists("chan1swptype")?(chan1swptype):("LINUP")

#scpiCmd SOUR1:SWE:INT:PER CHN 1; SWPTRGPER (value)
:setvar: chan1swpper=inputValue
#scpiCmd SOUR1:SWE:INT:PER? none?
:readmath: varExists("chan1swpper")?(chan1swpper):(0.005)

#scpiCmd SOUR1:SWE:GATE:POL CHN 1; SWPTRGPOL (value)
:setvar: chan1swptrgpol=inputValue
#scpiCmd SOUR1:SWE:GATE:POL? none?
:readmath: varExists("chan1swptrgpol")?(chan1swptrgpol):("POS")

#scpiCmd SOUR1:SWE:FREQ:START CHN 1; SWPBEGFREQ (value)
:setvar: chan1swpbegfreq=inputValue
#scpiCmd SOUR1:SWE:FREQ:START? none?
:readmath: varExists("chan1swpbegfreq")?(chan1swpbegfreq):(1000.0)

#scpiCmd SOUR1:SWE:FREQ:STOP CHN 1; SWPENDFREQ (value)
:setvar: chan1swpendfreq=inputValue
#scpiCmd SOUR1:SWE:FREQ:STOP? none?
:readmath: varExists("chan1swpendfreq")?(chan1swpendfreq):(10000.0)

#scpiCmd SOUR1:SWE:TIME CHN 1; SWPTIME (value)
:setvar: chan1swptime=inputValue
#scpiCmd SOUR1:SWE:TIME? none?
:readmath: varExists("chan1swptime")?(chan1swptime):(0.5)

; Modulation
#scpiCmd SOUR1:MOD CHN 1; MOD (value)
:setvar: chan1mod=inputValue
#scpiCmd SOUR1:MOD? none?
:readmath: varExists("chan1mod")?(chan1mod):(0)

#scpiCmd SOUR1:AM:INT:FUNC CHN 1; MODAMSHAPE (value)
:setvar: chan1modamshape=inputValue
#scpiCmd SOUR1:AM:INT:FUNC? none?
:readmath: varExists("chan1modamshape")?(chan1modamshape):("SINE")

#scpiCmd SOUR1:FM:INT:FUNC CHN 1; MODFMSHAPE (value)
:setvar: chan1modfmshape=inputValue
#scpiCmd SOUR1:FM:INT:FUNC? none?
:readmath: varExists("chan1modfmshape")?(chan1modfmshape):("SINE")

#scpiCmd SOUR1:PM:INT:FUNC CHN 1; MODPMSHAPE (value)
:setvar: chan1modpmshape=inputValue
#scpiCmd SOUR1:PM:INT:FUNC? none?
:readmath: varExists("chan1modpmshape")?(chan1modpmshape):("SINE")

#scpiCmd SOUR1:PWM:INT:FUNC CHN 1; MODPWMSHAPE (value)
:setvar: chan1modpwmshape=inputValue
#scpiCmd SOUR1:PWM:INT:FUNC? none?
:readmath: varExists("chan1modpwmshape")?(chan1modpwmshape):("SINE")

#scpiCmd SOUR1:SUM:INT:FUNC CHN 1; MODSUMSHAPE (value)
:setvar: chan1modsumshape=inputValue
#scpiCmd SOUR1:SUM:INT:FUNC? none?
:readmath: varExists("chan1modsumshape")?(chan1modsumshape):("SINE")


#scpiCmd SOUR1:AM:SOUR CHN 1; MODAMSRC (value)
:setvar: chan1modamsrc=inputValue
#scpiCmd SOUR1:AM:SOUR? none?
:readmath: varExists("chan1modamsrc")?(chan1modamsrc):("INT")

#scpiCmd SOUR1:FM:SOUR CHN 1; MODFMSRC (value)
:setvar: chan1modfmsrc=inputValue
#scpiCmd SOUR1:FM:SOUR? none?
:readmath: varExists("chan1modfmsrc")?(chan1modfmsrc):("INT")

#scpiCmd SOUR1:PM:SOUR CHN 1; MODPMSRC (value)
:setvar: chan1modpmsrc=inputValue
#scpiCmd SOUR1:PM:SOUR? none?
:readmath: varExists("chan1modpmsrc")?(chan1modpmsrc):("INT")

#scpiCmd SOUR1:PWM:SOUR CHN 1; MODPWMSRC (value)
:setvar: chan1modpwmsrc=inputValue
#scpiCmd SOUR1:PWM:SOUR? none?
:readmath: varExists("chan1modpwmsrc")?(chan1modpwmsrc):("INT")

#scpiCmd SOUR1:SUM:SOUR CHN 1; MODSUMSRC (value)
:setvar: chan1modsumsrc=inputValue
#scpiCmd SOUR1:SUM:SOUR? none?
:readmath: varExists("chan1modsumsrc")?(chan1modsumsrc):("INT")

#scpiCmd SOUR1:ASK:SOUR CHN 1; MODASKSRC (value)
:setvar: chan1modasksrc=inputValue
#scpiCmd SOUR1:ASK:SOUR? none?
:readmath: varExists("chan1modasksrc")?(chan1modasksrc):("INT")

#scpiCmd SOUR1:FSK:SOUR CHN 1; MODFSKSRC (value)
:setvar: chan1modfsksrc=inputValue
#scpiCmd SOUR1:FSK:SOUR? none?
:readmath: varExists("chan1modfsksrc")?(chan1modfsksrc):("INT")

#scpiCmd SOUR1:BPSK:SOUR CHN 1; MODBPSKSRC (value)
:setvar: chan1modbpsksrc=inputValue
#scpiCmd SOUR1:BPSK:SOUR? none?
:readmath: varExists("chan1modbpsksrc")?(chan1modbpsksrc):("INT")


#scpiCmd SOUR1:AM:FREQ CHN 1; MODAMFREQ (value)
:setvar: chan1modamfreq=inputValue
#scpiCmd SOUR1:AM:FREQ? none?
:readmath: varExists("chan1modamfreq")?(chan1modamfreq):(1000.0)

#scpiCmd SOUR1:FM:FREQ CHN 1; MODFMFREQ (value)
:setvar: chan1modfmfreq=inputValue
#scpiCmd SOUR1:FM:FREQ? none?
:readmath: varExists("chan1modfmfreq")?(chan1modfmfreq):(1000.0)

#scpiCmd SOUR1:PM:FREQ CHN 1; MODPMFREQ (value)
:setvar: chan1modpmfreq=inputValue
#scpiCmd SOUR1:PM:FREQ? none?
:readmath: varExists("chan1modpmfreq")?(chan1modpmfreq):(1000.0)

#scpiCmd SOUR1:PWM:FREQ CHN 1; MODPWMFREQ (value)
:setvar: chan1modpwmfreq=inputValue
#scpiCmd SOUR1:PWM:FREQ? none?
:readmath: varExists("chan1modpwmfreq")?(chan1modpwmfreq):(1000.0)

#scpiCmd SOUR1:SUM:FREQ CHN 1; MODSUMFREQ (value)
:setvar: chan1modsumfreq=inputValue
#scpiCmd SOUR1:SUM:FREQ? none?
:readmath: varExists("chan1modsumfreq")?(chan1modsumfreq):(1000.0)


#scpiCmd SOUR1:AM:DEPTH CHN 1; MODAMDEPTH (value)
:setvar: chan1modamdepth=inputValue
#scpiCmd SOUR1:AM:DEPTH? none?
:readmath: varExists("chan1modamdepth")?(chan1modamdepth):(50.0)

#scpiCmd SOUR1:FM:DEV CHN 1; MODFMDEV (value)
:setvar: chan1modfmdev=inputValue
#scpiCmd SOUR1:FM:DEV? none?
:readmath: varExists("chan1modfmdev")?(chan1modfmdev):(2000.0)

#scpiCmd SOUR1:PM:DEV CHN 1; MODPMDEV (value)
:setvar: chan1modpmdev=inputValue
#scpiCmd SOUR1:PM:DEV? none?
:readmath: varExists("chan1modpmdev")?(chan1modpmdev):(180.0)

#scpiCmd SOUR1:PWM:DEV CHN 1; MODPWMDEV (value)
:setvar: chan1modpwmdev=inputValue
#scpiCmd SOUR1:PWM:DEV? none?
:readmath: varExists("chan1modpwmdev")?(chan1modpwmdev):(50.0)

#scpiCmd SOUR1:SUM:AMPL CHN 1; MODSUMLEVEL (value)
:setvar: chan1modsumlevel=inputValue
#scpiCmd SOUR1:SUM:AMPL? none?
:readmath: varExists("chan1modsumlevel")?(chan1modsumlevel):(50.0)


#scpiCmd SOUR1:ASK:AMPL CHN 1; MODHOPAMPL (value)
:setvar: chan1modhopampl=inputValue
#scpiCmd SOUR1:ASK:AMPL? none?
:readmath: varExists("chan1modhopampl")?(chan1modhopampl):(0.500)

#scpiCmd SOUR1:FSK:FREQ CHN 1; MODHOPFREQ (value)
:setvar: chan1modhopfreq=inputValue
#scpiCmd SOUR1:FSK:FREQ? none?
:readmath: varExists("chan1modhopfreq")?(chan1modhopfreq):(5000.0)

#scpiCmd SOUR1:BPSK:PHASE CHN 1; MODBPSKPHASE (value)
:setvar: chan1modbpskphase=inputValue
#scpiCmd SOUR1:BPSK:PHASE? none?
:readmath: varExists("chan1modbpskphase")?(chan1modbpskphase):(180.0)


#scpiCmd SOUR1:ASK:INT:RATE CHN 1; MODASKRATE (value)
:setvar: chan1modaskrate=inputValue
#scpiCmd SOUR1:ASK:INT:RATE? none?
:readmath: varExists("chan1modaskrate")?(chan1modaskrate):(1000.0)

#scpiCmd SOUR1:FSK:INT:RATE CHN 1; MODFSKRATE (value)
:setvar: chan1modfskrate=inputValue
#scpiCmd SOUR1:FSK:INT:RATE? none?
:readmath: varExists("chan1modfskrate")?(chan1modfskrate):(1000.0)

#scpiCmd SOUR1:BPSK:INT:RATE CHN 1; MODBPSKRATE (value)
:setvar: chan1modbpskrate=inputValue
#scpiCmd SOUR1:BPSK:INT:RATE? none?
:readmath: varExists("chan1modbpskrate")?(chan1modbpskrate):(1000.0)


#scpiCmd SOUR1:ASK:POL CHN 1; MODPOLASK (value)
:setvar: chan1modaskpol=inputValue
#scpiCmd SOUR1:ASK:POL? none?
:readmath: varExists("chan1modaskpol")?(chan1modaskpol):("POS")

#scpiCmd SOUR1:FSK:POL CHN 1; MODPOLFSK (value)
:setvar: chan1modfskpol=inputValue
#scpiCmd SOUR1:FSK:POL? none?
:readmath: varExists("chan1modfskpol")?(chan1modfskpol):("POS")

#scpiCmd SOUR1:BPSK:POL CHN 1; MODPOLBPSK (value)
:setvar: chan1modbpskpol=inputValue
#scpiCmd SOUR1:BPSK:POL? none?
:readmath: varExists("chan1modbpskpol")?(chan1modbpskpol):("POS")


;-- Channel 2 -----------------------------------------------------------------------

; Menu
#scpiCmd SOUR2:MENU none
:setvar: chan2menu=inputValue
#scpiCmd SOUR2:MENU? none?
:readmath: varExists("chan2menu")?(chan2menu):(0)

#scpiCmd SOUR2:MENU:LEVEL none
:setvar: chan2menulevel=inputValue
#scpiCmd SOUR2:MENU:LEVEL? none?
:readmath: varExists("chan2menulevel")?(chan2menulevel):(0)

#scpiCmd SOUR2:MENU:PERIOD none
:setvar: chan2menuperiod=inputValue
#scpiCmd SOUR2:MENU:PERIOD? none?
:readmath: varExists("chan2menuperiod")?(chan2menuperiod):(0)

#scpiCmd SOUR2:MENU:WIDTH none
:setvar: chan2menuwidth=inputValue
#scpiCmd SOUR2:MENU:WIDTH? none?
:readmath: varExists("chan2menuwidth")?(chan2menuwidth):(0)

; Output
#scpiCmd OUTP2 CHN 2; OUTPUT (getElement("OFF ON",value))
:setvar: chan2output=inputValue
#scpiCmd OUTP2? none?
:readmath: varExists("chan2output")?chan2output:(0)

#scpiCmd OUTP2:POL CHN 2;OUTPUT (getElement("NORMAL INVERT",value))
:setvar: chan2outputinvert=inputValue
#scpiCmd OUTP2:POL? none?
:readmath: varExists("chan2outputinvert")?chan2outputinvert:(0)

#scpiCmd SOUR2:VOLT:RANGE:AUTO CHN 2; AMPLRNG (value)
:setvar: chan2amplrng=inputValue
#scpiCmd SOUR2:VOLT:RANGE:AUTO? none?
:readmath: varExists("chan2amplrng")?(chan2amplrng):("AUTO")

#scpiCmd SOUR2:PHASE CHN 2; PHASE (value)
:setvar: chan2phase=inputValue
#scpiCmd SOUR2:PHASE? none?
:readmath: varExists("chan2phase")?(chan2phase):(0.0)

#scpiCmd OUTP2:LOAD CHN 2; ZLOAD (value)
:setvar: chan2zload=inputValue
#scpiCmd OUTP2:LOAD? none?
:readmath: varExists("chan2zload")?(chan2zload):(50.0)


; Wave
#scpiCmd SOUR2:FUNC CHN 2; (inList(value,"DC SINC HAVERSINE CARDIAC EXPRISE LOGRISE EXPFALL LOGFALL GAUSSIAN LORENTZ DLORENTZ ARB1 ARB2 ARB3 ARB4")?"WAVE ARB; ARBLOAD":"WAVE") (value)
:setvar: chan2wave=inputValue
#scpiCmd SOUR2:FUNC? none?
:readmath: varExists("chan2wave")?chan2wave:"SINE"

; Frequency
#scpiCmd SOUR2:FREQ CHN 2; FREQ (value)
:setvar: chan2freq=inputValue
#scpiCmd SOUR2:FREQ? none?
:readmath: varExists("chan2freq")?chan2freq:(10000.0)

#scpiCmd SOUR2:FUNC:PULS:FREQ CHN 2; PULSFreq (value)
:setvar: chan2pulsfreq=inputValue
#scpiCmd SOUR2:FUNC:PULS:FREQ? none?
:readmath: varExists("chan2pulsfreq")?chan2pulsfreq:(10000.0)

#scpiCmd SOUR2:PER CHN 2; PER (value)
:setvar: chan2freq=1/inputValue
#scpiCmd SOUR2:PER? none?
:readmath: varExists("chan2freq")?(1/chan2freq):(1.0/10000.0)

#scpiCmd SOUR2:FUNC:PULS:PER CHN 2; PULSPER (value)
:setvar: chan2pulsfreq=1/inputValue
#scpiCmd SOUR2:FUNC:PULS:PER? none?
:readmath: varExists("chan2pulsfreq")?(1/chan2pulsfreq):(1.0/10000.0)

#scpiCmd SOUR2:FUNC:PRBS:BRAT CHN 2; PRBSBitRate (value)
:setvar: chan2prbsfreq=inputValue
#scpiCmd SOUR2:FUNC:PRBS:BRAT? none?
:readmath: varExists("chan2prbsfreq")?(chan2prbsfreq):(10000.0)

; Amplitude
#scpiCmd SOUR2:VOLT CHN 2; AMPL (value)
:setvar: chan2ampl=inputValue
#scpiCmd SOUR2:VOLT? none?
:readmath: varExists("chan2ampl")?chan2ampl:(1.0)
#scpiCmd SOUR2:VOLT:SETHI none
:setvar: chan2ampl=inputValue-(varExists("chan2lolvl")?chan2lolvl:-0.5);
#scpiCmd SOUR2:VOLT:SETLO none
:setvar: chan2ampl=(varExists("chan2hilvl")?chan2hilvl:0.5)-inputValue;

#scpiCmd SOUR2:VOLT:OFFS CHN 2; DCOFFS (value)
:setvar: chan2dcoffs=inputValue
#scpiCmd SOUR2:VOLT:OFFS? none?
:readmath: varExists("chan2dcoffs")?chan2dcoffs:(0.0)
#scpiCmd SOUR2:VOLT:OFFS:SETHI none
:setvar: chan2dcoffs=(inputValue+(varExists("chan2lolvl")?chan2lolvl:-0.5))/2;
#scpiCmd SOUR2:VOLT:OFFS:SETLO none
:setvar: chan2dcoffs=((varExists("chan2hilvl")?chan2hilvl:0.5)+inputValue)/2;

#scpiCmd SOUR2:VOLT:LOW CHN 2; LOLVL (value)
:setvar: chan2lolvl=inputValue
#scpiCmd SOUR2:VOLT:LOW? none?
:readmath: varExists("chan2lolvl")?chan2lolvl:(-0.5)
#scpiCmd SOUR2:VOLT:LOW:SETA none
:setvar: chan2lolvl=(varExists("chan2dcoffs")?chan2dcoffs:0)-inputValue/2;
#scpiCmd SOUR2:VOLT:LOW:SETO none
:setvar: chan2lolvl=inputValue-(varExists("chan2ampl")?chan2ampl:1)/2;

#scpiCmd SOUR2:VOLT:HIGH CHN 2; HILVL (value)
:setvar: chan2hilvl=inputValue
#scpiCmd SOUR2:VOLT:HIGH? none?
:readmath: varExists("chan2hilvl")?chan2hilvl:(0.5)
#scpiCmd SOUR2:VOLT:HIGH:SETA none
:setvar: chan2hilvl=(varExists("chan2dcoffs")?chan2dcoffs:0)+inputValue/2; 
#scpiCmd SOUR2:VOLT:HIGH:SETO none
:setvar: chan2hilvl=inputValue+(varExists("chan2ampl")?chan2ampl:1)/2; 

; Square
#scpiCmd SOUR2:FUNC:SQU:SYMM CHN 2; SQRSYMM (value)
:setvar: chan2sqrsymm=inputValue
#scpiCmd SOUR2:FUNC:SQU:SYMM? none?
:readmath: varExists("chan2sqrsymm")?(chan2sqrsymm):(50.0)

; Ramp
#scpiCmd SOUR2:FUNC:RAMP:SYMM CHN 2; RMPSYMM (value)
:setvar: chan2rmpsymm=inputValue
#scpiCmd SOUR2:FUNC:RAMP:SYMM? none?
:readmath: varExists("chan2rmpsymm")?(chan2rmpsymm):(50.0)

; Pulse
#scpiCmd SOUR2:FUNC:PULS:DCYC CHN 2; PULSSYMM (value)
:setvar: chan2pulswid=(1/(varExists("chan2pulsfreq")?chan2pulsfreq:(10000.0)))*(inputValue/100)
#scpiCmd SOUR2:FUNC:PULS:DCYC? none?
:readmath: (varExists("chan2pulswid")?(chan2pulswid):((1/10000.0)/2))/(1/(varExists("chan2pulsfreq")?chan2pulsfreq:(10000.0)))*100

#scpiCmd SOUR2:FUNC:PULS:WIDT CHN 2; PULSWID (value)
:setvar: chan2pulswid=inputValue
#scpiCmd SOUR2:FUNC:PULS:WIDT? none?
:readmath: varExists("chan2pulswid")?(chan2pulswid):((1/10000.0)/2)

#scpiCmd SOUR2:FUNC:PULS:TRAN:LEAD CHN 2; PULSRISE (value)
:setvar: chan2pulsrise=inputValue
#scpiCmd SOUR2:FUNC:PULS:TRAN:LEAD? none?
:readmath: varExists("chan2pulsrise")?(chan2pulsrise):(0.000000010)

#scpiCmd SOUR2:FUNC:PULS:TRAN:TRA CHN 2; PULSFALL (value)
:setvar: chan2pulsfall=inputValue
#scpiCmd SOUR2:FUNC:PULS:TRAN:TRA? none?
:readmath: varExists("chan2pulsfall")?(chan2pulsfall):(0.000000010)

#scpiCmd SOUR2:FUNC:PULS:DEL CHN 2; PULSDLY (value)
:setvar: chan2pulsdly=inputValue
#scpiCmd SOUR2:FUNC:PULS:DEL? none?
:readmath: varExists("chan2pulsdly")?(chan2pulsdly):(0.0)

; Burst
#scpiCmd SOUR2:BURS:MODE CHN 2; BST (value)
:setvar: chan2bst=inputValue
#scpiCmd SOUR2:BURS:MODE? none?
:readmath: varExists("chan2bst")?(chan2bst):(0)

#scpiCmd SOUR2:BURS:TRIG:SOUR CHN 2; BSTTRGSRC (value)
:setvar: chan2bsttrgsrc=inputValue
#scpiCmd SOUR2:BURS:TRIG:SOUR? none?
:readmath: varExists("chan2bsttrgsrc")?(chan2bsttrgsrc):("INT")

#scpiCmd SOUR2:BURS:GATE:POL CHN 2; BSTTRGPOL (value)
:setvar: chan2bsttrgpol=inputValue
#scpiCmd SOUR2:BURS:GATE:POL? none?
:readmath: varExists("chan2bsttrgpol")?(chan2bsttrgpol):("POS")

#scpiCmd SOUR2:BURS:INT:PER CHN 2; BSTPER (value)
:setvar: chan2bstper=inputValue
#scpiCmd SOUR2:BURS:INT:PER? none?
:readmath: varExists("chan2bstper")?(chan2bstper):(0.005)

#scpiCmd SOUR2:BURS:NCYC CHN 2; BSTCOUNT (value)
:setvar: chan2bstcount=inputValue
#scpiCmd SOUR2:BURS:NCYC? none?
:readmath: varExists("chan2bstcount")?(chan2bstcount):(1)

#scpiCmd SOUR2:BURS:PHASE CHN 2; BSTPHASE (value)
:setvar: chan2bstphase=inputValue
#scpiCmd SOUR2:BURS:PHASE? none?
:readmath: varExists("chan2bstphase")?(chan2bstphase):(0)

; Sweep
#scpiCmd SOUR2:SWE:STAT CHN 2; SWP (value)
:setvar: chan2swp=inputValue
#scpiCmd SOUR2:SWE:STAT? none?
:readmath: varExists("chan2swp")?(chan2swp):(0)

#scpiCmd SOUR2:SWE:TRIG:SOUR CHN 2; BSTTRGSRC (value)
:setvar: chan2swptrgsrc=inputValue
#scpiCmd SOUR2:SWE:TRIG:SOUR? none?
:readmath: varExists("chan2swptrgsrc")?(chan2swptrgsrc):("INT")

#scpiCmd SOUR2:SWE:MODE CHN 2; SWPMODE (value)
:setvar: chan2swpmode=inputValue
#scpiCmd SOUR2:SWE:MODE? none?
:readmath: varExists("chan2swpmode")?(chan2swpmode):("CONT")

#scpiCmd SOUR2:SWE:SPAC CHN 2; SWPTYPE (value)
:setvar: chan2swptype=inputValue
#scpiCmd SOUR2:SWE:SPAC? none?
:readmath: varExists("chan2swptype")?(chan2swptype):("LINUP")

#scpiCmd SOUR2:SWE:INT:PER CHN 2; SWPTRGPER (value)
:setvar: chan2swpper=inputValue
#scpiCmd SOUR2:SWE:INT:PER? none?
:readmath: varExists("chan2swpper")?(chan2swpper):(0.005)

#scpiCmd SOUR2:SWE:GATE:POL CHN 2; SWPTRGPOL (value)
:setvar: chan2swptrgpol=inputValue
#scpiCmd SOUR2:SWE:GATE:POL? none?
:readmath: varExists("chan2swptrgpol")?(chan2swptrgpol):("POS")

#scpiCmd SOUR2:SWE:FREQ:START CHN 2; SWPBEGFREQ (value)
:setvar: chan2swpbegfreq=inputValue
#scpiCmd SOUR2:SWE:FREQ:START? none?
:readmath: varExists("chan2swpbegfreq")?(chan2swpbegfreq):(1000.0)

#scpiCmd SOUR2:SWE:FREQ:STOP CHN 2; SWPENDFREQ (value)
:setvar: chan2swpendfreq=inputValue
#scpiCmd SOUR2:SWE:FREQ:STOP? none?
:readmath: varExists("chan2swpendfreq")?(chan2swpendfreq):(10000.0)

#scpiCmd SOUR2:SWE:TIME CHN 2; SWPTIME (value)
:setvar: chan2swptime=inputValue
#scpiCmd SOUR2:SWE:TIME? none?
:readmath: varExists("chan2swptime")?(chan2swptime):(0.5)

; Modulation
#scpiCmd SOUR2:MOD CHN 2; MOD (value)
:setvar: chan2mod=inputValue
#scpiCmd SOUR2:MOD? none?
:readmath: varExists("chan2mod")?(chan2mod):(0)

#scpiCmd SOUR2:AM:INT:FUNC CHN 2; MODAMSHAPE (value)
:setvar: chan2modamshape=inputValue
#scpiCmd SOUR2:AM:INT:FUNC? none?
:readmath: varExists("chan2modamshape")?(chan2modamshape):("SINE")

#scpiCmd SOUR2:FM:INT:FUNC CHN 2; MODFMSHAPE (value)
:setvar: chan2modfmshape=inputValue
#scpiCmd SOUR2:FM:INT:FUNC? none?
:readmath: varExists("chan2modfmshape")?(chan2modfmshape):("SINE")

#scpiCmd SOUR2:PM:INT:FUNC CHN 2; MODPMSHAPE (value)
:setvar: chan2modpmshape=inputValue
#scpiCmd SOUR2:PM:INT:FUNC? none?
:readmath: varExists("chan2modpmshape")?(chan2modpmshape):("SINE")

#scpiCmd SOUR2:PWM:INT:FUNC CHN 2; MODPWMSHAPE (value)
:setvar: chan2modpwmshape=inputValue
#scpiCmd SOUR2:PWM:INT:FUNC? none?
:readmath: varExists("chan2modpwmshape")?(chan2modpwmshape):("SINE")

#scpiCmd SOUR2:SUM:INT:FUNC CHN 2; MODSUMSHAPE (value)
:setvar: chan2modsumshape=inputValue
#scpiCmd SOUR2:SUM:INT:FUNC? none?
:readmath: varExists("chan2modsumshape")?(chan2modsumshape):("SINE")


#scpiCmd SOUR2:AM:SOUR CHN 2; MODAMSRC (value)
:setvar: chan2modamsrc=inputValue
#scpiCmd SOUR2:AM:SOUR? none?
:readmath: varExists("chan2modamsrc")?(chan2modamsrc):("INT")

#scpiCmd SOUR2:FM:SOUR CHN 2; MODFMSRC (value)
:setvar: chan2modfmsrc=inputValue
#scpiCmd SOUR2:FM:SOUR? none?
:readmath: varExists("chan2modfmsrc")?(chan2modfmsrc):("INT")

#scpiCmd SOUR2:PM:SOUR CHN 2; MODPMSRC (value)
:setvar: chan2modpmsrc=inputValue
#scpiCmd SOUR2:PM:SOUR? none?
:readmath: varExists("chan2modpmsrc")?(chan2modpmsrc):("INT")

#scpiCmd SOUR2:PWM:SOUR CHN 2; MODPWMSRC (value)
:setvar: chan2modpwmsrc=inputValue
#scpiCmd SOUR2:PWM:SOUR? none?
:readmath: varExists("chan2modpwmsrc")?(chan2modpwmsrc):("INT")

#scpiCmd SOUR2:SUM:SOUR CHN 2; MODSUMSRC (value)
:setvar: chan2modsumsrc=inputValue
#scpiCmd SOUR2:SUM:SOUR? none?
:readmath: varExists("chan2modsumsrc")?(chan2modsumsrc):("INT")

#scpiCmd SOUR2:ASK:SOUR CHN 2; MODASKSRC (value)
:setvar: chan2modasksrc=inputValue
#scpiCmd SOUR2:ASK:SOUR? none?
:readmath: varExists("chan2modasksrc")?(chan2modasksrc):("INT")

#scpiCmd SOUR2:FSK:SOUR CHN 2; MODFSKSRC (value)
:setvar: chan2modfsksrc=inputValue
#scpiCmd SOUR2:FSK:SOUR? none?
:readmath: varExists("chan2modfsksrc")?(chan2modfsksrc):("INT")

#scpiCmd SOUR2:BPSK:SOUR CHN 2; MODBPSKSRC (value)
:setvar: chan2modbpsksrc=inputValue
#scpiCmd SOUR2:BPSK:SOUR? none?
:readmath: varExists("chan2modbpsksrc")?(chan2modbpsksrc):("INT")


#scpiCmd SOUR2:AM:FREQ CHN 2; MODAMFREQ (value)
:setvar: chan2modamfreq=inputValue
#scpiCmd SOUR2:AM:FREQ? none?
:readmath: varExists("chan2modamfreq")?(chan2modamfreq):(1000.0)

#scpiCmd SOUR2:FM:FREQ CHN 2; MODFMFREQ (value)
:setvar: chan2modfmfreq=inputValue
#scpiCmd SOUR2:FM:FREQ? none?
:readmath: varExists("chan2modfmfreq")?(chan2modfmfreq):(1000.0)

#scpiCmd SOUR2:PM:FREQ CHN 2; MODPMFREQ (value)
:setvar: chan2modpmfreq=inputValue
#scpiCmd SOUR2:PM:FREQ? none?
:readmath: varExists("chan2modpmfreq")?(chan2modpmfreq):(1000.0)

#scpiCmd SOUR2:PWM:FREQ CHN 2; MODPWMFREQ (value)
:setvar: chan2modpwmfreq=inputValue
#scpiCmd SOUR2:PWM:FREQ? none?
:readmath: varExists("chan2modpwmfreq")?(chan2modpwmfreq):(1000.0)

#scpiCmd SOUR2:SUM:FREQ CHN 2; MODSUMFREQ (value)
:setvar: chan2modsumfreq=inputValue
#scpiCmd SOUR2:SUM:FREQ? none?
:readmath: varExists("chan2modsumfreq")?(chan2modsumfreq):(1000.0)


#scpiCmd SOUR2:AM:DEPTH CHN 2; MODAMDEPTH (value)
:setvar: chan2modamdepth=inputValue
#scpiCmd SOUR2:AM:DEPTH? none?
:readmath: varExists("chan2modamdepth")?(chan2modamdepth):(50.0)

#scpiCmd SOUR2:FM:DEV CHN 2; MODFMDEV (value)
:setvar: chan2modfmdev=inputValue
#scpiCmd SOUR2:FM:DEV? none?
:readmath: varExists("chan2modfmdev")?(chan2modfmdev):(2000.0)

#scpiCmd SOUR2:PM:DEV CHN 2; MODPMDEV (value)
:setvar: chan2modpmdev=inputValue
#scpiCmd SOUR2:PM:DEV? none?
:readmath: varExists("chan2modpmdev")?(chan2modpmdev):(180.0)

#scpiCmd SOUR2:PWM:DEV CHN 2; MODPWMDEV (value)
:setvar: chan2modpwmdev=inputValue
#scpiCmd SOUR2:PWM:DEV? none?
:readmath: varExists("chan2modpwmdev")?(chan2modpwmdev):(50.0)

#scpiCmd SOUR2:SUM:AMPL CHN 2; MODSUMLEVEL (value)
:setvar: chan2modsumlevel=inputValue
#scpiCmd SOUR2:SUM:AMPL? none?
:readmath: varExists("chan2modsumlevel")?(chan2modsumlevel):(50.0)


#scpiCmd SOUR2:ASK:AMPL CHN 2; MODHOPAMPL (value)
:setvar: chan2modhopampl=inputValue
#scpiCmd SOUR2:ASK:AMPL? none?
:readmath: varExists("chan2modhopampl")?(chan2modhopampl):(0.500)

#scpiCmd SOUR2:FSK:FREQ CHN 2; MODHOPFREQ (value)
:setvar: chan2modhopfreq=inputValue
#scpiCmd SOUR2:FSK:FREQ? none?
:readmath: varExists("chan2modhopfreq")?(chan2modhopfreq):(5000.0)

#scpiCmd SOUR2:BPSK:PHASE CHN 2; MODBPSKPHASE (value)
:setvar: chan2modbpskphase=inputValue
#scpiCmd SOUR2:BPSK:PHASE? none?
:readmath: varExists("chan2modbpskphase")?(chan2modbpskphase):(180.0)


#scpiCmd SOUR2:ASK:INT:RATE CHN 2; MODASKRATE (value)
:setvar: chan2modaskrate=inputValue
#scpiCmd SOUR2:ASK:INT:RATE? none?
:readmath: varExists("chan2modaskrate")?(chan2modaskrate):(1000.0)

#scpiCmd SOUR2:FSK:INT:RATE CHN 2; MODFSKRATE (value)
:setvar: chan2modfskrate=inputValue
#scpiCmd SOUR2:FSK:INT:RATE? none?
:readmath: varExists("chan2modfskrate")?(chan2modfskrate):(1000.0)

#scpiCmd SOUR2:BPSK:INT:RATE CHN 2; MODBPSKRATE (value)
:setvar: chan2modbpskrate=inputValue
#scpiCmd SOUR2:BPSK:INT:RATE? none?
:readmath: varExists("chan2modbpskrate")?(chan2modbpskrate):(1000.0)


#scpiCmd SOUR2:ASK:POL CHN 2; MODPOLASK (value)
:setvar: chan2modaskpol=inputValue
#scpiCmd SOUR2:ASK:POL? none?
:readmath: varExists("chan2modaskpol")?(chan2modaskpol):("POS")

#scpiCmd SOUR2:FSK:POL CHN 2; MODPOLFSK (value)
:setvar: chan2modfskpol=inputValue
#scpiCmd SOUR2:FSK:POL? none?
:readmath: varExists("chan2modfskpol")?(chan2modfskpol):("POS")

#scpiCmd SOUR2:BPSK:POL CHN 2; MODPOLBPSK (value)
:setvar: chan2modbpskpol=inputValue
#scpiCmd SOUR2:BPSK:POL? none?
:readmath: varExists("chan2modbpskpol")?(chan2modbpskpol):("POS")


;------------------------------------------------------------
; Low-Level Interface
;------------------------------------------------------------

;Accept this delay when reading values (seconds)
#readingDelay 3

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6)
#value Frequency Hz SI AC_Frequency, DC_Frequency
#value Period s SI AC_Period, DC_Period
#value DutyCycle % SI AC_Duty, DC_Duty
#value PosWidth s SI AC_Pos, DC_Pos
#value NegWidth s SI AC_Neg, DC_Neg

; How to poll for data, this is used for table and #values ?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.
; This is a single line command
#askValues CNTRVAL?

; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
#askValuesReadFormat u

; Switch meter to this mode during start, leave empty to avoid any switching
#initialMode 

; String to ask about actual meter mode, 
#askMode COUNT:MODE?

; Initial commands to meter when establishing connection
#initCmd SOUR1:MENU SWEEP; SOUR2:MENU SWEEP; *RST

; Final command to meter before breaking connection
#finalCmd CHN 1;OUTPUT OFF;CHN 2;OUTPUT OFF; CHN 1; LOCAL

; Command when Outputs Off button is pressed
#outputOff OUTP1 0; OUTP2 0


;------------------------------------------------------------------------------------
; Modes
;------------------------------------------------------------------------------------

; Strings to configure device in different modes
; First parameter must match a #value (4 parameter) and second parameter must match what #askMode returns
; First parameter is also used in shortcut menu

#cmdModeLayout 2 5

#cmdMode AC_Frequency FREQUENCY  
COUNT:STAT 1;COUNT:COUP AC; COUNT:MODE FREQUENCY

#cmdMode DC_Frequency FREQUENCY  
COUNT:STAT 1;COUNT:COUP DC; COUNT:MODE FREQUENCY

#cmdMode AC_Period PERIOD     
COUNT:STAT 1;COUNT:COUP AC; COUNT:MODE PERIOD

#cmdMode DC_Period PERIOD     
COUNT:STAT 1;COUNT:COUP DC; COUNT:MODE PERIOD

#cmdMode AC_Duty DUTY         
COUNT:STAT 1;COUNT:COUP AC; COUNT:MODE DUTY

#cmdMode DC_Duty DUTY         
COUNT:STAT 1;COUNT:COUP DC; COUNT:MODE DUTY

#cmdMode AC_Pos WIDTH    
COUNT:STAT 1;COUNT:COUP AC; COUNT:MODE WIDTH

#cmdMode DC_Pos WIDTH    
COUNT:STAT 1;COUNT:COUP DC; COUNT:MODE WIDTH

#cmdMode AC_Neg NWIDTH   
COUNT:STAT 1;COUNT:COUP AC; COUNT:MODE NWIDTH

#cmdMode DC_Neg NWIDTH   
COUNT:STAT 1;COUNT:COUP DC; COUNT:MODE NWIDTH


;------------------------------------------------------------------------------------
; Interface
;------------------------------------------------------------------------------------

; Channel 1/2
#interfaceType ARB ARB:2

#interface setWaveform      CHN (channel);WAVE (value)
#interface setFrequency     CHN (channel);FREQ (value);PULSFreq (value)
#interface setPeriod        CHN (channel);PER (value);PULSPer (value)
#interface setAmplitude     CHN (channel);AMPL (value)
#interface setHigh          CHN (channel);HILVL (value)
#interface setLow           CHN (channel);LOLVL (value)
#interface setOffset        CHN (channel);DCOFFS (value)
;
#interface setPulseWidth    CHN (channel);PULSWID (value)
#interface setPulseDuty     CHN (channel);PULSSYMM (value)
#interface setPulseSlope    CHN (channel);PULSEDGE (value)
#interface setPulseRiseTime CHN (channel);PULSRISE (value)
#interface setPulseFallTime CHN (channel);PULSFALL (value)
#interface setPulseDelay    CHN (channel);PULSDLY (value)
;
#interface setPRBSBitrate   CHN (channel);PRBSBITRATE (value)
;
#interface setBurstMode     CHN (channel);BST (value)
#interface setBurstPeriod   CHN (channel);BSTPER (value)
#interface setBurstSlope    CHN (channel);BSTTRGPOL (value)
#interface setBurstCount    CHN (channel);BSTCOUNT (value)
#interface setBurstPhase    CHN (channel);BSTPHASE (value)
#interface setBurstTrigger  CHN (channel);BSTTRGSRC (value)
;
#interface setOn            CHN (channel);OUTPUT (getElement("OFF ON",value))
#interface setLoad          CHN (channel);ZLOAD (value)
#interface setPhase         CHN (channel);PHASE (value)

; Counter
#interface setOnCounter      CNTRSwt (getElement("OFF ON",value," "))
#interface setCounterSource  COUNT:COUP (value)  
#interface getCounter        CNTRVal?
:readmath: getMatch(value, "( |^)[-+.0-9]+")

; Config
#interface setTrigger           *TRG
#interface setClockExternal     CLKSRC (getElement("INT EXT",value))
#interface setCouplingAmplitude AMPLCPLNG (getElement("OFF ON",value))
#interface setCouplingFrequency FRQCPLSWT (getElement("OFF ON",value))
#interface setCouplingOutput    OUTPUTCPLNG (getElement("OFF ON",value))
#interface setCouplingTracking  TRACKING (value)                        

#interface readCounter 0


;------------------------------------------------------------------------------------
; Output 1
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Waveform Output_1
:read:   SOUR1:FUNC?
:write:  SOUR1:FUNC (value)
:string:
Sine      SINE
Square    SQUARE
Ramp      RAMP
Triangle  TRIANG
Pulse     PULSE
Noise     NOISE
#metaSection ExtendedFunctions
PRBS7     PRBSPN7
PRBS9     PRBSPN9
PRBS11    PRBSPN11
PRBS15    PRBSPN15
PRBS20    PRBSPN20
PRBS23    PRBSPN23
PRBS29    PRBSPN29
PRBS31    PRBSPN31
#metaSection
DC        DC
Sinc      SINC
HaverSine HAVERSINE 
Cardiac   CARDIAC 
Exp._Rise EXPRISE
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
Gaussian  GAUSSIAN 
Lorenz    LORENTZ 
D-Lorenz  DLORENTZ 
UserArb_1 ARB1 
UserArb_2 ARB2 
UserArb_3 ARB3 
UserArb_4 ARB4


#cmdSetup separator - Output_1
:color:(235,235,00)
3 100 Solid

#cmdSetup number Frequency Output_1
:read:    SOUR1:FREQ?
:write:   SOUR1:FREQ #
:update:  Period
:visible: !inList(Output_1.Waveform, "PULSE NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC") && !Output_1.Frequency_vs.Period
:textwidth: 12
:format:  SI15
:tip:     MaxFrequency is only possible in Sine mode.
Hz 0.0001 MaxFrequency

#cmdSetup number Frequency_ Output_1
:read:    SOUR1:FUNC:PULS:FREQ?
:write:   SOUR1:FUNC:PULS:FREQ #
:update:  Period_
:visible: !inList(Output_1.Waveform, "NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC")&&Output_1.Waveform=="PULSE"  && !Output_1.Frequency_vs.Period
:textwidth: 12
:format:  SI15
:tip:     MaxFrequency is only possible in Sine mode.
Hz 1u MaxFrequency

#cmdSetup number Period Output_1
:read:    SOUR1:PER?
:write:   SOUR1:PER #
:visible: !inList(Output_1.Waveform, "PULSE NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC") && Output_1.Frequency_vs.Period
:update:  Frequency
:textwidth: 12
:format:  SI12
:tip:     MinPeriod is only possible in sine mode.
s MinPeriod 10G

#cmdSetup number Period_ Output_1
:read:    SOUR1:FUNC:PULS:PER?
:write:   SOUR1:FUNC:PULS:PER #
:visible: !inList(Output_1.Waveform, "NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC") && Output_1.Waveform=="PULSE" && Output_1.Frequency_vs.Period
:update:  Frequency_
:textwidth: 12
:format:  SI12
:tip:     MinPeriod is only possible in sine mode.
s MinPeriod 10G

#cmdSetup number Bit_Rate Output_1
:read:    SOUR1:FUNC:PRBS:BRAT?
:write:   SOUR1:FUNC:PRBS:BRAT #
:visible: inList(Output_1.Waveform, "PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31")
:textwidth: 8
:tip:     PRBS bit rate
bit/s 0 100M

#cmdSetup number Amplitude Output_1
:read:    SOUR1:VOLT?
:write:   SOUR1:VOLT (value); SOUR1:VOLT:HIGH:SETA (value); SOUR1:VOLT:LOW:SETA (value)
:visible: !Output_1.Amplitude_vs.Level
:update:  High Low
:textwidth: 8
:tip:     Amplitude + offset must be within ±10V.
Vpp 20m 20

#cmdSetup number Offset Output_1
:read:    SOUR1:VOLT:OFFS?
:write:   SOUR1:VOLT:OFFS (value); SOUR1:VOLT:HIGH:SETO (value); SOUR1:VOLT:LOW:SETO (value)
:visible: !Output_1.Amplitude_vs.Level
:update:  High Low
:textwidth: 8
:tip:     Amplitude + offset must be within ±10V.
V -10 10

#cmdSetup number High Output_1
:read:    SOUR1:VOLT:HIGH?
:write:   SOUR1:VOLT:HIGH (value); SOUR1:VOLT:SETHI (value); SOUR1:VOLT:OFFS:SETHI (value)
:visible: Output_1.Amplitude_vs.Level
:update:  Amplitude Offset
:textwidth: 8
:tip:     Must be > Low Level. Limits depend on load Z.
V -10 10

#cmdSetup number Low Output_1
:read:    SOUR1:VOLT:LOW?
:write:   SOUR1:VOLT:LOW (value); SOUR1:VOLT:SETLO (value); SOUR1:VOLT:OFFS:SETLO (value)
:visible: Output_1.Amplitude_vs.Level
:update:  Amplitude Offset
:textwidth: 8
:tip:     Must be < High Level. Limits depend on load Z.
V -10 10

#cmdSetup separator - Output_1
1 100 Empty

#cmdSetup number Duty Output_1
:read:    SOUR1:FUNC:SQU:SYMM?
:write:   SOUR1:FUNC:SQU:SYMM #
:visible: inList(Output_1.Waveform, "SQUARE")
:tip:     Duty cycle is used for square
% 0.001 99.999

#cmdSetup number Duty Output_1
:read:    SOUR1:FUNC:RAMP:SYMM?
:write:   SOUR1:FUNC:RAMP:SYMM #
:visible: inList(Output_1.Waveform, "RAMP")
:tip:     Duty cycle is used for ramp
% 0 100

#cmdSetup number Duty_ Output_1
:read:    SOUR1:FUNC:PULS:DCYC?
:write:   SOUR1:FUNC:PULS:DCYC #
:visible: inList(Output_1.Waveform, "PULSE") && !Output_1.Duty_vs.Width
:update:  Width
:tip:     Duty cycle is used for pulse
% 0.1 99.9

#cmdSetup number Width Output_1
:read:    SOUR1:FUNC:PULS:WIDT?
:write:   SOUR1:FUNC:PULS:WIDT #
:visible: inList(Output_1.Waveform, "PULSE") && Output_1.Duty_vs.Width
:update:  Duty_
:textwidth: 8
:tip:     Pulse Width
s MinPulseWidth 999

#cmdSetup number Rise Output_1
:read:    SOUR1:FUNC:PULS:TRAN:LEAD?
:write:   SOUR1:FUNC:PULS:TRAN:LEAD #
:visible: inList(Output_1.Waveform, "PULSE")
:textwidth: 8
:tip:     Pulse Rising edge, up to 0.625 x pulse width
s MinSlopeTime 799

#cmdSetup number Fall Output_1
:read:    SOUR1:FUNC:PULS:TRAN:TRA?
:write:   SOUR1:FUNC:PULS:TRAN:TRA #
:visible: inList(Output_1.Waveform, "PULSE")
:textwidth: 8
:tip:     Pulse Falling edge, up to 0.625 x pulse width
s MinSlopeTime 799

#cmdSetup number Delay Output_1
:read:    SOUR1:FUNC:PULS:DEL?
:write:   SOUR1:FUNC:PULS:DEL #
:visible: inList(Output_1.Waveform, "PULSE")
:textwidth: 8
:tip:     Pulse delay
s 0 999


#cmdSetup separator - Output_1
1 100 Empty

#cmdSetup checkbox Output Output_1
:read:    OUTP1:POL?
:write:   OUTP1:POL (value)
:tip:     Invert Output.
Inverted 0 1

#cmdSetup separator - Output_1
:color:   (235,235,00)
3 100 Solid

#cmdSetup numberInt Load Output_1
:read:    OUTP1:LOAD?
:write:   OUTP1:LOAD #
:emptyvalue: 0
:emptywrite: OUTP1:LOAD OPEN
:textwidth: 8
:tip: Calibrates Amplitude settings to match the actual load
Ω 1 10k

#cmdSetup number Phase Output_1
:read:    SOUR1:PHASE?
:write:   SOUR1:PHASE #
:textwidth: 8
:tip:     Set the waveform phase offset
° -360 360

#cmdSetup comboboxHot Range Output_1
:read:    SOUR1:VOLT:RANGE:AUTO?
:write:   SOUR1:VOLT:RANGE:AUTO #
:string:
Attn_Auto AUTO
Attn_Hold HOLD


#cmdSetup separator - Output_1
1 100 Empty

#cmdSetup Info Entry Output_1

#cmdSetup separator - Output_1
:color:   (235,235,00)
3 100 Solid

#cmdSetup checkbox Frequency_vs Output_1
:read:    SOUR1:MENU:PERIOD?
:write:   SOUR1:MENU:PERIOD #
:update:  Frequency Period Frequency_ Period_
:visible: !inList(Output_1.Waveform, "NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC")
Period 0 1

#cmdSetup checkbox Amplitude_vs Output_1
:read:    SOUR1:MENU:LEVEL?
:write:   SOUR1:MENU:LEVEL #
:update:  Amplitude Offset High Low
Level 0 1

#cmdSetup checkbox Duty_vs Output_1
:read:    SOUR1:MENU:WIDTH?
:write:   SOUR1:MENU:WIDTH #
:update:  Duty Width_
:visible: inList(Output_1.Waveform, "PULSE")
Width 0 1


;------------------------------------------------------------------------------------
; Output 2
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Waveform Output_2
:read:   SOUR2:FUNC?
:write:  SOUR2:FUNC (value)
:string:
Sine      SINE
Square    SQUARE
Ramp      RAMP
Triangle  TRIANG
Pulse     PULSE
Noise     NOISE
#metaSection ExtendedFunctions
PRBS7     PRBSPN7
PRBS9     PRBSPN9
PRBS11    PRBSPN11
PRBS15    PRBSPN15
PRBS20    PRBSPN20
PRBS23    PRBSPN23
PRBS29    PRBSPN29
PRBS31    PRBSPN31
#metaSection
DC        DC
Sinc      SINC
HaverSine HAVERSINE 
Cardiac   CARDIAC 
Exp._Rise EXPRISE
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
Gaussian  GAUSSIAN 
Lorenz    LORENTZ 
D-Lorenz  DLORENTZ 
UserArb_1 ARB1 
UserArb_2 ARB2 
UserArb_3 ARB3 
UserArb_4 ARB4


#cmdSetup separator - Output_2
:color: (0,255,75)
3 100 Solid

#cmdSetup number Frequency Output_2
:read:    SOUR2:FREQ?
:write:   SOUR2:FREQ #
:update:  Period
:visible: !inList(Output_2.Waveform, "PULSE NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC") && !Output_2.Frequency_vs.Period
:textwidth: 12
:format:  SI15
:tip:     MaxFrequency is only possible in Sine mode.
Hz 0.0001 MaxFrequency

#cmdSetup number Frequency_ Output_2
:read:    SOUR2:FUNC:PULS:FREQ?
:write:   SOUR2:FUNC:PULS:FREQ #
:update:  Period_
:visible: !inList(Output_2.Waveform, "NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC")&&Output_2.Waveform=="PULSE"  && !Output_2.Frequency_vs.Period
:textwidth: 12
:format:  SI15
:tip:     MaxFrequency is only possible in Sine mode.
Hz 1u MaxFrequency

#cmdSetup number Period Output_2
:read:    SOUR2:PER?
:write:   SOUR2:PER #
:visible: !inList(Output_2.Waveform, "PULSE NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC") && Output_2.Frequency_vs.Period
:update:  Frequency
:textwidth: 12
:format:  SI12
:tip:     MinPeriod is only possible in sine mode.
s MinPeriod 10G

#cmdSetup number Period_ Output_2
:read:    SOUR2:FUNC:PULS:PER?
:write:   SOUR2:FUNC:PULS:PER #
:visible: !inList(Output_2.Waveform, "NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC") && Output_2.Waveform=="PULSE" && Output_2.Frequency_vs.Period
:update:  Frequency_
:textwidth: 12
:format:  SI12
:tip:     MinPeriod is only possible in sine mode.
s MinPeriod 10G

#cmdSetup number Bit_Rate Output_2
:read:    SOUR2:FUNC:PRBS:BRAT?
:write:   SOUR2:FUNC:PRBS:BRAT #
:visible: inList(Output_2.Waveform, "PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31")
:textwidth: 8
:tip:     PRBS bit rate
bit/s 0 100M

#cmdSetup number Amplitude Output_2
:read:    SOUR2:VOLT?
:write:   SOUR2:VOLT (value); SOUR2:VOLT:HIGH:SETA (value); SOUR2:VOLT:LOW:SETA (value)
:visible: !Output_2.Amplitude_vs.Level
:update:  High Low
:textwidth: 8
:tip:     Amplitude + offset must be within ±10V.
Vpp 20m 20

#cmdSetup number Offset Output_2
:read:    SOUR2:VOLT:OFFS?
:write:   SOUR2:VOLT:OFFS (value); SOUR2:VOLT:HIGH:SETO (value); SOUR2:VOLT:LOW:SETO (value)
:visible: !Output_2.Amplitude_vs.Level
:update:  High Low
:textwidth: 8
:tip:     Amplitude + offset must be within ±10V.
V -10 10

#cmdSetup number High Output_2
:read:    SOUR2:VOLT:HIGH?
:write:   SOUR2:VOLT:HIGH (value); SOUR2:VOLT:SETHI (value); SOUR2:VOLT:OFFS:SETHI (value)
:visible: Output_2.Amplitude_vs.Level
:update:  Output_2.Amplitude Output_2.Offset
:textwidth: 8
:tip:     Must be > Low Level. Limits depend on load Z.
V -10 10

#cmdSetup number Low Output_2
:read:    SOUR2:VOLT:LOW?
:write:   SOUR2:VOLT:LOW (value); SOUR2:VOLT:SETLO (value); SOUR2:VOLT:OFFS:SETLO (value)
:visible: Output_2.Amplitude_vs.Level
:update:  Output_2.Amplitude Output_2.Offset
:textwidth: 8
:tip:     Must be < High Level. Limits depend on load Z.
V -10 10

#cmdSetup separator - Output_2
1 100 Empty

#cmdSetup number Duty Output_2
:read:    SOUR2:FUNC:SQU:SYMM?
:write:   SOUR2:FUNC:SQU:SYMM #
:visible: inList(Output_2.Waveform, "SQUARE")
:tip:     Duty cycle is used for square
% 0.001 99.999

#cmdSetup number Duty Output_2
:read:    SOUR2:FUNC:RAMP:SYMM?
:write:   SOUR2:FUNC:RAMP:SYMM #
:visible: inList(Output_2.Waveform, "RAMP")
:tip:     Duty cycle is used for ramp
% 0 100

#cmdSetup number Duty_ Output_2
:read:    SOUR2:FUNC:PULS:DCYC?
:write:   SOUR2:FUNC:PULS:DCYC #
:visible: inList(Output_2.Waveform, "PULSE") && !Output_2.Duty_vs.Width
:update:  Width
:tip:     Duty cycle is used for pulse
% 0.1 99.9

#cmdSetup number Width Output_2
:read:    SOUR2:FUNC:PULS:WIDT?
:write:   SOUR2:FUNC:PULS:WIDT #
:visible: inList(Output_2.Waveform, "PULSE") && Output_2.Duty_vs.Width
:update:  Duty_
:textwidth: 8
:tip: Pulse Width
s MinPulseWidth 999

#cmdSetup number Rise Output_2
:read:    SOUR2:FUNC:PULS:TRAN:LEAD?
:write:   SOUR2:FUNC:PULS:TRAN:LEAD #
:visible: inList(Output_2.Waveform, "PULSE")
:textwidth: 8
:tip:     Pulse Rising edge, up to 0.625 x pulse width
s MinSlopeTime 799

#cmdSetup number Fall Output_2
:read:    SOUR2:FUNC:PULS:TRAN:TRA?
:write:   SOUR2:FUNC:PULS:TRAN:TRA #
:visible: inList(Output_2.Waveform, "PULSE")
:textwidth: 8
:tip:     Pulse Falling edge, up to 0.625 x pulse width
s MinSlopeTime 799

#cmdSetup number Delay Output_2
:read:    SOUR2:FUNC:PULS:DEL?
:write:   SOUR2:FUNC:PULS:DEL #
:visible: inList(Output_2.Waveform, "PULSE")
:textwidth: 8
:tip:     Pulse delay
s 0 999


#cmdSetup separator - Output_2
1 100 Empty

#cmdSetup checkbox Output Output_2
:read:    OUTP2:POL?
:write:   OUTP2:POL (value)
:tip:     Invert Output.
Inverted 0 1

#cmdSetup separator - Output_2
:color:   (0,255,75)
3 100 Solid

#cmdSetup numberInt Load Output_2
:read:    OUTP2:LOAD?
:write:   OUTP2:LOAD #
:emptyvalue: 0
:emptywrite: OUTP2:LOAD OPEN
:textwidth: 8
:tip:     Calibrates Amplitude settings to match the actual load
Ω 1 10k

#cmdSetup number Phase Output_2
:read:    SOUR2:PHASE?
:write:   SOUR2:PHASE #
:textwidth: 8
:tip:     Set the waveform phase offset
° -360 360

#cmdSetup comboboxHot Range Output_2
:read:    SOUR2:VOLT:RANGE:AUTO?
:write:   SOUR2:VOLT:RANGE:AUTO #
:string:
Attn_Auto AUTO
Attn_Hold HOLD


#cmdSetup separator - Output_2
1 100 Empty

#cmdSetup Info Entry Output_2

#cmdSetup separator - Output_2
:color:   (0,255,75)
3 100 Solid

#cmdSetup checkbox Frequency_vs Output_2
:read:    SOUR2:MENU:PERIOD?
:write:   SOUR2:MENU:PERIOD #
:update:  Frequency Period Frequency_ Period_
:visible: !inList(Output_2.Waveform, "NOISE PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31 DC")
Period 0 1

#cmdSetup checkbox Amplitude_vs Output_2
:read:    SOUR2:MENU:LEVEL?
:write:   SOUR2:MENU:LEVEL #
:update:  Amplitude Offset High Low
Level 0 1

#cmdSetup checkbox Duty_vs Output_2
:read:    SOUR2:MENU:WIDTH?
:write:   SOUR2:MENU:WIDTH #
:update:  Duty Width_
:visible: inList(Output_2.Waveform, "PULSE")
Width 0 1


;------------------------------------------------------------------------------------
; Set 1 
;------------------------------------------------------------------------------------

#cmdSetup radio Mode Set_1
:read:  SOUR1:MENU?
:write: SOUR1:MENU #
:string:
Sweep   SWEEP
Burst   BURST
Mod     MOD

#cmdSetup separator - Set_1
:color: (235,235,00)
3 100 Solid


;------------------------------------------------------------------------------------
; Set 1 - Burst
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Burst Set_1
:read:    SOUR1:BURS:MODE?
:write:   SOUR1:BURS:MODE #
:visible: Set_1.Mode=="BURST"
:string:
Off OFF
Gated GATED
Triggered_Cycles NCYC
Triggered_Infinite INFINITE

#cmdSetup comboboxHot Burst_Source Set_1
:read:    SOUR1:BURS:TRIG:SOUR?
:write:   SOUR1:BURS:TRIG:SOUR #
:visible: Set_1.Mode=="BURST"
:string: 
Internal_Trigger INT
External_Trigger EXT
Manual_Trigger MAN

#cmdSetup comboboxHot Burst_Slope Set_1
:read:    SOUR1:BURS:GATE:POL?
:write:   SOUR1:BURS:GATE:POL #
:visible: Set_1.Mode=="BURST" && Set_1.Burst_Source=="EXT"
:string:
Positive POS
Negative NEG

#cmdSetup number Burst_Period Set_1
:read:    SOUR1:BURS:INT:PER?
:write:   SOUR1:BURS:INT:PER #
:visible: Set_1.Mode=="BURST" && Set_1.Burst_Source=="INT"
:textwidth: 8
s 20n 500

#cmdSetup numberInt Count Set_1
:read:    SOUR1:BURS:NCYC?
:write:   SOUR1:BURS:NCYC #
:visible: Set_1.Mode=="BURST" && Set_1.Burst=="NCYC"
:textwidth: 8
_ 1 2M

#cmdSetup number Phase Set_1
:read:    SOUR1:BURS:PHASE?
:write:   SOUR1:BURS:PHASE #
:visible: Set_1.Mode=="BURST"
:textwidth: 8
° 0 360


;------------------------------------------------------------------------------------
; Set 1 - Sweep
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Sweep Set_1
:read:    SOUR1:SWE:STAT?
:write:   SOUR1:SWE:STAT #
:visible: Set_1.Mode=="SWEEP"
:string:
Off OFF
On  ON

#cmdSetup comboboxHot Sweep_Mode Set_1
:read:    SOUR1:SWE:MODE?
:write:   SOUR1:SWE:MODE #
:visible: Set_1.Mode=="SWEEP"
:string:
:update:  Set_1.Sweep_Source
Continues CONT
Trigger   TRIG

#cmdSetup comboboxHot Sweep_Source Set_1
:read:    SOUR1:SWE:TRIG:SOUR?
:write:   SOUR1:SWE:TRIG:SOUR #
:visible: Set_1.Mode=="SWEEP" && Set_1.Sweep_Mode=="TRIG"
:string:
Internal_Trigger INT
External_Trigger EXT
Manual_Trigger   MAN

#cmdSetup comboboxHot Sweep_Slope Set_1
:read:    SOUR1:SWE:GATE:POL?
:write:   SOUR1:SWE:GATE:POL #
:visible: Set_1.Mode=="SWEEP"  && Set_1.Sweep_Mode=="TRIG" && Set_1.Sweep_Source=="EXT"
:string:
Positive POS
Negative NEG

#cmdSetup number Sweep_Period Set_1
:read:    SOUR1:SWE:INT:PER?
:write:   SOUR1:SWE:INT:PER #
:visible: Set_1.Mode=="SWEEP"  && Set_1.Sweep_Mode=="TRIG" && Set_1.Sweep_Source=="INT"
:textwidth: 8
s 20n 500

#cmdSetup comboboxHot Type Set_1
:read:    SOUR1:SWE:SPAC?
:write:   SOUR1:SWE:SPAC #
:visible: Set_1.Mode=="SWEEP"
:string:
Linear_up        LINUP
Linear_down      LINDN
Logarithmic_up   LOGUP
Logarithmic_down LOGDN

#cmdSetup number Start Set_1
:read:    SOUR1:SWE:FREQ:START?
:write:   SOUR1:SWE:FREQ:START #
:visible: Set_1.Mode=="SWEEP"
:textwidth: 8
Hz 0 MaxFrequency

#cmdSetup number Stop Set_1
:read:    SOUR1:SWE:FREQ:STOP?
:write:   SOUR1:SWE:FREQ:STOP #
:visible: Set_1.Mode=="SWEEP"
:textwidth: 8
Hz 0 MaxFrequency

#cmdSetup number Time Set_1
:read:    SOUR1:SWE:TIME?
:write:   SOUR1:SWE:TIME #
:visible: Set_1.Mode=="SWEEP"
:textwidth: 8
Hz 1u 500


;------------------------------------------------------------------------------------
; Set 1 - Modudulation
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Modulation Set_1
:read:    SOUR1:MOD?
:write:   SOUR1:MOD #
:visible: Set_1.Mode=="MOD"
:update:  Set_1.AM_Shape
:string:
Off OFF
AM AM
AMSC AMSC
FM FM
PM PM
ASK ASK
FSK FSK
BPSK BPSK
PWM PWM
#metaSection ExtendedFunctions
SUM SUM
#metaSection

; AM
#cmdSetup comboboxHot AM_Source Set_1
:read:    SOUR1:AM:SOUR?
:write:   SOUR1:AM:SOUR # 
:visible: Set_1.Mode=="MOD" && (Set_1.Modulation=="AM" || Set_1.Modulation=="AMSC")
:string:
Internal INT
External EXT

#cmdSetup comboboxHot AM_Shape Set_1
:read:    SOUR1:AM:INT:FUNC?
:write:   SOUR1:AM:INT:FUNC #
:visible: Set_1.Mode=="MOD" && (Set_1.Modulation=="AM" || Set_1.Modulation=="AMSC") && Set_1.AM_Source=="INT"
:string:
Sine      SINE 
Square    SQUARE
Ramp_up   RAMPUP
Ramp_down RAMPDN
Triangle  TRIANG
Noise     NOISE
#metaSection ExtendedFunctions
PRBSPN7   PRBSPN7
PRBSPN9   PRBSPN9
PRBSPN11  PRBSPN11
PRBSPN15  PRBSPN15
PRBSPN20  PRBSPN20
PRBSPN23  PRBSPN23
PRBSPN29  PRBSPN29
PRBSPN31  PRBSPN31
#metaSection
DC        DC
Sinc      SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac   CARDIAC 
Gaussian  GAUSSIAN 
Lorenz    LORENTZ 
D-Lorenz  DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number AM_Frequency Set_1
:read:    SOUR1:AM:FREQ?
:write:   SOUR1:AM:FREQ #
:visible: Set_1.Mode=="MOD" && (Set_1.Modulation=="AM" || Set_1.Modulation=="AMSC") && Set_1.AM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number AM_Depth Set_1
:read:    SOUR1:AM:DEPTH?
:write:   SOUR1:AM:DEPTH #
:visible: Set_1.Mode=="MOD" && (Set_1.Modulation=="AM" || Set_1.Modulation=="AMSC") 
:textwidth: 8
% 0 100

; FM
#cmdSetup comboboxHot FM_Source Set_1
:read:    SOUR1:FM:SOUR?
:write:   SOUR1:FM:SOUR # 
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot FM_Shape Set_1
:read:    SOUR1:FM:INT:FUNC?
:write:   SOUR1:FM:INT:FUNC #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FM" && Set_1.FM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number FM_Frequency Set_1
:read:    SOUR1:FM:FREQ?
:write:   SOUR1:FM:FREQ #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FM" && Set_1.FM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number FM_Deviation Set_1
:read:    SOUR1:FM:DEV?
:write:   SOUR1:FM:DEV #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FM" 
:textwidth: 8
Hz 0 160M

; PM
#cmdSetup comboboxHot PM_Source Set_1
:read:    SOUR1:PM:SOUR?
:write:   SOUR1:PM:SOUR # 
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot PM_Shape Set_1
:read:    SOUR1:PM:INT:FUNC?
:write:   SOUR1:PM:INT:FUNC #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PM" && Set_1.PM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number PM_Frequency Set_1
:read:    SOUR1:PM:FREQ?
:write:   SOUR1:PM:FREQ #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PM" && Set_1.PM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number PM_Deviation Set_1
:read:    SOUR1:PM:DEV?
:write:   SOUR1:PM:DEV #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PM" 
:textwidth: 8
° -360 +360

; PWM
#cmdSetup comboboxHot PWM_Source Set_1
:read:    SOUR1:PWM:SOUR?
:write:   SOUR1:PWM:SOUR #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PWM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot PWM_Shape Set_1
:read:    SOUR1:PWM:INT:FUNC?
:write:   SOUR1:PWM:INT:FUNC #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PWM" && Set_1.PWM_Source=="INT"
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number PWM_Frequency Set_1
:read:    SOUR1:PWM:FREQ?
:write:   SOUR1:PWM:FREQ #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PWM" && Set_1.PWM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number PWM_Deviation Set_1
:read:    SOUR1:PWM:DEV?
:write:   SOUR1:PWM:DEV #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="PWM" 
:textwidth: 8
% 0 100


; SUM
#cmdSetup comboboxHot SUM_Source Set_1
:read:    SOUR1:SUM:SOUR?
:write:   SOUR1:SUM:SOUR # 
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="SUM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot SUM_Shape Set_1
:read:    SOUR1:SUM:INT:FUNC?
:write:   SOUR1:SUM:INT:FUNC #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="SUM" && Set_1.SUM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number SUM_Frequency Set_1
:read:    SOUR1:SUM:FREQ?
:write:   SOUR1:SUM:FREQ #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="SUM" && Set_1.SUM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number SUM_Level Set_1
:read:    SOUR1:SUM:AMPL?
:write:   SOUR1:SUM:AMPL #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="SUM" 
:textwidth: 8
% 0 100

; ASK
#cmdSetup comboboxHot ASK_Source Set_1
:read:    SOUR1:ASK:SOUR?
:write:   SOUR1:ASK:SOUR #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="ASK"
:string: 
Internal INT
External EXT

#cmdSetup number ASK_Rate Set_1
:read:    SOUR1:ASK:INT:RATE?
:write:   SOUR1:ASK:INT:RATE #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="ASK" && Set_1.ASK_Source=="INT"
:textwidth: 8
Hz 2m 10M

#cmdSetup number ASK_Hop Set_1
:read:    SOUR1:ASK:AMPL?
:write:   SOUR1:ASK:AMPL #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="ASK" 
:textwidth: 8
Vpp 0 20

#cmdSetup comboboxHot ASK_Polarity Set_1
:read:    SOUR1:ASK:POL?
:write:   SOUR1:ASK:POL #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="ASK"
:string:
Positive POS
Negative NEG


; FSK
#cmdSetup comboboxHot FSK_Source Set_1
:read:    SOUR1:FSK:SOUR?
:write:   SOUR1:FSK:SOUR #
:string: 
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FSK"
Internal INT
External EXT

#cmdSetup number FSK_Rate Set_1
:read:    SOUR1:FSK:INT:RATE?
:write:   SOUR1:FSK:INT:RATE #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FSK" && Set_1.FSK_Source=="INT"
:textwidth: 8
Hz 2m 10M

#cmdSetup number FSK_Hop Set_1
:read:    SOUR1:FSK:FREQ?
:write:   SOUR1:FSK:FREQ #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FSK" 
:textwidth: 8
Hz 1u 160M

#cmdSetup comboboxHot FSK_Polarity Set_1
:read:    SOUR1:FSK:POL?
:write:   SOUR1:FSK:POL #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="FSK"
:string:
Positive POS
Negative NEG


; BPSK
#cmdSetup comboboxHot BPSK_Source Set_1
:read:    SOUR1:BPSK:SOUR?
:write:   SOUR1:BPSK:SOUR #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="BPSK"
:string: 
Internal INT
External EXT

#cmdSetup number BPSK_Rate Set_1
:read:    SOUR1:BPSK:INT:RATE?
:write:   SOUR1:BPSK:INT:RATE #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="BPSK" && Set_1.BPSK_Source=="INT"
:textwidth: 8
Hz 2m 10M

#cmdSetup number BPSK_Hop Set_1
:read:    SOUR1:BPSK:PHASE?
:write:   SOUR1:BPSK:PHASE #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="BPSK" 
:textwidth: 8
° -360 360

#cmdSetup comboboxHot BPSK_Polarity Set_1
:read:    SOUR1:BPSK:POL?
:write:   SOUR1:BPSK:POL #
:visible: Set_1.Mode=="MOD" && Set_1.Modulation=="BPSK"
:string:
Positive POS
Negative NEG

;------------------------------------------------------------------------------------

#cmdSetup separator - Set_1
:color:   (235,235,00)
3 100 Solid


;------------------------------------------------------------------------------------
; Set 2
;------------------------------------------------------------------------------------

#cmdSetup radio Mode Set_2
:read:  SOUR2:MENU?
:write: SOUR2:MENU #
:string:
Sweep SWEEP
Burst BURST
Mod   MOD

#cmdSetup separator - Set_2
:color:   (0,255,75)
3 100 Solid


;------------------------------------------------------------------------------------
; Set 2 - Burst
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Burst Set_2
:read:    SOUR2:BURS:MODE?
:write:   SOUR2:BURS:MODE #
:visible: Set_2.Mode=="BURST"
:string:
Off                OFF
Gated              GATED
Triggered_Cycles   NCYC
Triggered_Infinite INFINITE

#cmdSetup comboboxHot Burst_Source Set_2
:read:    SOUR2:BURS:TRIG:SOUR?
:write:   SOUR2:BURS:TRIG:SOUR #
:visible: Set_2.Mode=="BURST"
:string: 
Internal_Trigger INT
External_Trigger EXT
Manual_Trigger   MAN

#cmdSetup comboboxHot Burst_Slope Set_2
:read:    SOUR2:BURS:GATE:POL?
:write:   SOUR2:BURS:GATE:POL #
:visible: Set_2.Mode=="BURST" && Set_2.Burst_Source=="EXT"
:string:
Positive POS
Negative NEG

#cmdSetup number Burst_Period Set_2
:read:    SOUR2:BURS:INT:PER?
:write:   SOUR2:BURS:INT:PER #
:visible: Set_2.Mode=="BURST" && Set_2.Burst_Source=="INT"
:textwidth: 8
s 20n 500

#cmdSetup numberInt Count Set_2
:read:    SOUR2:BURS:NCYC?
:write:   SOUR2:BURS:NCYC #
:visible: Set_2.Mode=="BURST" && Set_2.Burst=="NCYC"
:textwidth: 8
_ 1 2M

#cmdSetup number Phase Set_2
:read:    SOUR2:BURS:PHASE?
:write:   SOUR2:BURS:PHASE #
:visible: Set_2.Mode=="BURST"
:textwidth: 8
° 0 360


;------------------------------------------------------------------------------------
; Set 2 - Sweep
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Sweep Set_2
:read:    SOUR2:SWE:STAT?
:write:   SOUR2:SWE:STAT #
:visible: Set_2.Mode=="SWEEP"
:string:
Off OFF
On ON

#cmdSetup comboboxHot Sweep_Mode Set_2
:read:    SOUR2:SWE:MODE?
:write:   SOUR2:SWE:MODE #
:visible: Set_2.Mode=="SWEEP"
:string:
:update:  Set_2.Sweep_Source
Continues CONT
Trigger   TRIG

#cmdSetup comboboxHot Sweep_Source Set_2
:read:    SOUR2:SWE:TRIG:SOUR?
:write:   SOUR2:SWE:TRIG:SOUR #
:visible: Set_2.Mode=="SWEEP" && Set_2.Sweep_Mode=="TRIG"
:string:
Internal_Trigger INT
External_Trigger EXT
Manual_Trigger   MAN

#cmdSetup comboboxHot Sweep_Slope Set_2
:read:    SOUR2:SWE:GATE:POL?
:write:   SOUR2:SWE:GATE:POL #
:visible: Set_2.Mode=="SWEEP"  && Set_2.Sweep_Mode=="TRIG" && Set_2.Sweep_Source=="EXT"
:string:
Positive POS
Negative NEG

#cmdSetup number Sweep_Period Set_2
:read:    SOUR2:SWE:INT:PER?
:write:   SOUR2:SWE:INT:PER #
:visible: Set_2.Mode=="SWEEP"  && Set_2.Sweep_Mode=="TRIG" && Set_2.Sweep_Source=="INT"
:textwidth: 8
s 20n 500

#cmdSetup comboboxHot Type Set_2
:read:    SOUR2:SWE:SPAC?
:write:   SOUR2:SWE:SPAC #
:visible: Set_2.Mode=="SWEEP"
:string:
Linear_up        LINUP
Linear_down      LINDN
Logarithmic_up   LOGUP
Logarithmic_down LOGDN

#cmdSetup number Start Set_2
:read:    SOUR2:SWE:FREQ:START?
:write:   SOUR2:SWE:FREQ:START #
:visible: Set_2.Mode=="SWEEP"
:textwidth: 8
Hz 0 MaxFrequency

#cmdSetup number Stop Set_2
:read:    SOUR2:SWE:FREQ:STOP?
:write:   SOUR2:SWE:FREQ:STOP #
:visible: Set_2.Mode=="SWEEP"
:textwidth: 8
Hz 0 MaxFrequency

#cmdSetup number Time Set_2
:read:    SOUR2:SWE:TIME?
:write:   SOUR2:SWE:TIME #
:visible: Set_2.Mode=="SWEEP"
:textwidth: 8
Hz 1u 500


;------------------------------------------------------------------------------------
; Set 2 - Modudulation
;------------------------------------------------------------------------------------

#cmdSetup comboboxHot Modulation Set_2
:read:    SOUR2:MOD?
:write:   SOUR2:MOD #
:visible: Set_2.Mode=="MOD"
:update:  Set_2.AM_Shape
:string:
Off  OFF
AM   AM
AMSC AMSC
FM   FM
PM   PM
ASK  ASK
FSK  FSK
BPSK BPSK
PWM  PWM
#metaSection ExtendedFunctions
SUM  SUM
#metaSection

; AM
#cmdSetup comboboxHot AM_Source Set_2
:read:    SOUR2:AM:SOUR?
:write:   SOUR2:AM:SOUR # 
:visible: Set_2.Mode=="MOD" && (Set_2.Modulation=="AM" || Set_2.Modulation=="AMSC")
:string:
Internal INT
External EXT

#cmdSetup comboboxHot AM_Shape Set_2
:read:    SOUR2:AM:INT:FUNC?
:write:   SOUR2:AM:INT:FUNC #
:visible: Set_2.Mode=="MOD" && (Set_2.Modulation=="AM" || Set_2.Modulation=="AMSC") && Set_2.AM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number AM_Frequency Set_2
:read:    SOUR2:AM:FREQ?
:write:   SOUR2:AM:FREQ #
:visible: Set_2.Mode=="MOD" && (Set_2.Modulation=="AM" || Set_2.Modulation=="AMSC") && Set_2.AM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number AM_Depth Set_2
:read:    SOUR2:AM:DEPTH?
:write:   SOUR2:AM:DEPTH #
:visible: Set_2.Mode=="MOD" && (Set_2.Modulation=="AM" || Set_2.Modulation=="AMSC") 
:textwidth: 8
% 0 100

; FM
#cmdSetup comboboxHot FM_Source Set_2
:read:    SOUR2:FM:SOUR?
:write:   SOUR2:FM:SOUR # 
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot FM_Shape Set_2
:read:    SOUR2:FM:INT:FUNC?
:write:   SOUR2:FM:INT:FUNC #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FM" && Set_2.FM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number FM_Frequency Set_2
:read:    SOUR2:FM:FREQ?
:write:   SOUR2:FM:FREQ #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FM" && Set_2.FM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number FM_Deviation Set_2
:read:    SOUR2:FM:DEV?
:write:   SOUR2:FM:DEV #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FM" 
:textwidth: 8
Hz 0 160M

; PM
#cmdSetup comboboxHot PM_Source Set_2
:read:    SOUR2:PM:SOUR?
:write:   SOUR2:PM:SOUR # 
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot PM_Shape Set_2
:read:    SOUR2:PM:INT:FUNC?
:write:   SOUR2:PM:INT:FUNC #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PM" && Set_2.PM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number PM_Frequency Set_2
:read:    SOUR2:PM:FREQ?
:write:   SOUR2:PM:FREQ #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PM" && Set_2.PM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number PM_Deviation Set_2
:read:    SOUR2:PM:DEV?
:write:   SOUR2:PM:DEV #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PM" 
:textwidth: 8
° -360 +360

; PWM
#cmdSetup comboboxHot PWM_Source Set_2
:read:    SOUR2:PWM:SOUR?
:write:   SOUR2:PWM:SOUR #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PWM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot PWM_Shape Set_2
:read:    SOUR2:PWM:INT:FUNC?
:write:   SOUR2:PWM:INT:FUNC #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PWM" && Set_2.PWM_Source=="INT"
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number PWM_Frequency Set_2
:read:    SOUR2:PWM:FREQ?
:write:   SOUR2:PWM:FREQ #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PWM" && Set_2.PWM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number PWM_Deviation Set_2
:read:    SOUR2:PWM:DEV?
:write:   SOUR2:PWM:DEV #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="PWM" 
:textwidth: 8
% 0 100


; SUM
#cmdSetup comboboxHot SUM_Source Set_2
:read:    SOUR2:SUM:SOUR?
:write:   SOUR2:SUM:SOUR # 
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="SUM"
:string:
Internal INT
External EXT

#cmdSetup comboboxHot SUM_Shape Set_2
:read:    SOUR2:SUM:INT:FUNC?
:write:   SOUR2:SUM:INT:FUNC #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="SUM" && Set_2.SUM_Source=="INT"
:string:
Sine SINE 
Square SQUARE
Ramp_up RAMPUP
Ramp_down RAMPDN
Triangle TRIANG
Noise NOISE
#metaSection ExtendedFunctions
PRBSPN7 PRBSPN7
PRBSPN9 PRBSPN9
PRBSPN11 PRBSPN11
PRBSPN15 PRBSPN15
PRBSPN20 PRBSPN20
PRBSPN23 PRBSPN23
PRBSPN29 PRBSPN29
PRBSPN31 PRBSPN31
#metaSection
DC DC
Sinc SINC 
Exp._Rise EXPRISE 
Exp._Fall EXPFALL 
Log._Rise LOGRISE 
Log._Fall LOGFALL 
HaverSine HAVERSINE 
Cardiac CARDIAC 
Gaussian GAUSSIAN 
Lorenz LORENTZ 
D-Lorenz DLORENTZ
Arb_User1 ARB1 
Arb_User2 ARB2 
Arb_User3 ARB3 
Arb_User4 ARB4

#cmdSetup number SUM_Frequency Set_2
:read:    SOUR2:SUM:FREQ?
:write:   SOUR2:SUM:FREQ #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="SUM" && Set_2.SUM_Source=="INT"
:textwidth: 8
Hz 1u 10M

#cmdSetup number SUM_Level Set_2
:read:    SOUR2:SUM:AMPL?
:write:   SOUR2:SUM:AMPL #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="SUM" 
:textwidth: 8
% 0 100

; ASK
#cmdSetup comboboxHot ASK_Source Set_2
:read:    SOUR2:ASK:SOUR?
:write:   SOUR2:ASK:SOUR #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="ASK"
:string: 
Internal INT
External EXT

#cmdSetup number ASK_Rate Set_2
:read:    SOUR2:ASK:INT:RATE?
:write:   SOUR2:ASK:INT:RATE #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="ASK" && Set_2.ASK_Source=="INT"
:textwidth: 8
Hz 2m 10M

#cmdSetup number ASK_Hop Set_2
:read:    SOUR2:ASK:AMPL?
:write:   SOUR2:ASK:AMPL #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="ASK" 
:textwidth: 8
Vpp 0 20

#cmdSetup comboboxHot ASK_Polarity Set_2
:read:    SOUR2:ASK:POL?
:write:   SOUR2:ASK:POL #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="ASK"
:string:
Positive POS
Negative NEG


; FSK
#cmdSetup comboboxHot FSK_Source Set_2
:read:    SOUR2:FSK:SOUR?
:write:   SOUR2:FSK:SOUR #
:string: 
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FSK"
Internal INT
External EXT

#cmdSetup number FSK_Rate Set_2
:read:    SOUR2:FSK:INT:RATE?
:write:   SOUR2:FSK:INT:RATE #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FSK" && Set_2.FSK_Source=="INT"
:textwidth: 8
Hz 2m 10M

#cmdSetup number FSK_Hop Set_2
:read:    SOUR2:FSK:FREQ?
:write:   SOUR2:FSK:FREQ #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FSK" 
:textwidth: 8
Hz 1u 160M

#cmdSetup comboboxHot FSK_Polarity Set_2
:read:    SOUR2:FSK:POL?
:write:   SOUR2:FSK:POL #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="FSK"
:string:
Positive POS
Negative NEG


; BPSK
#cmdSetup comboboxHot BPSK_Source Set_2
:read:    SOUR2:BPSK:SOUR?
:write:   SOUR2:BPSK:SOUR #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="BPSK"
:string: 
Internal INT
External EXT

#cmdSetup number BPSK_Rate Set_2
:read:    SOUR2:BPSK:INT:RATE?
:write:   SOUR2:BPSK:INT:RATE #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="BPSK" && Set_2.BPSK_Source=="INT"
:textwidth: 8
Hz 2m 10M

#cmdSetup number BPSK_Hop Set_2
:read:    SOUR2:BPSK:PHASE?
:write:   SOUR2:BPSK:PHASE #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="BPSK" 
:textwidth: 8
° -360 360

#cmdSetup comboboxHot BPSK_Polarity Set_2
:read:    SOUR2:BPSK:POL?
:write:   SOUR2:BPSK:POL #
:visible: Set_2.Mode=="MOD" && Set_2.Modulation=="BPSK"
:string:
Positive POS
Negative NEG

;------------------------------------------------------------------------------------

#cmdSetup separator - Set_2
:color: (0,255,75)
3 100 Solid


;------------------------------------------------------------------------------------
; Setup
;------------------------------------------------------------------------------------

#cmdSetup Info Clock Setup

#cmdSetup separator - Setup
:color: (0,0,0)
3 100 Solid

#cmdSetup comboboxHot Source Setup
:read:    ROSC:SOUR?
:write:   ROSC:SOUR #
:string:
Internal INT
External EXT


#cmdSetup separator - Setup
1 100 Empty

#cmdSetup Info Synchronization Setup

#cmdSetup separator - Setup
:color: (0,0,0)
3 100 Solid

#cmdSetup comboboxHot Output Setup
:read:    OUTP:SYNC?
:write:   OUTP:SYNC #
:string:
Off OFF
On ON

#cmdSetup comboboxHot Type Setup
:read:    OUTP:SYNC:MODE?
:write:   OUTP:SYNC:MODE #
:string:
Normal  NORMAL
Auto    AUTO
Carrier CARRIER
Trigger TRIGGER
Off     OFF

#cmdSetup comboboxHot Config Setup
:read:    OUTP:SYNC:SOUR?
:write:   OUTP:SYNC:SOUR #
:string:
Channel_2 MAINOUT
Sync      SYNCOUT


#cmdSetup separator - Setup
1 100 Empty

#cmdSetup Info Coupling Setup

#cmdSetup separator - Setup
:color:   (0,0,0)
3 100 Solid

#cmdSetup comboboxHot Frequency Setup
:read:    FREQ:COUP?
:write:   FREQ:COUP #
:enable:  Setup.Tracking=="OFF"
:string:
Off OFF
On  ON

#cmdSetup comboboxHot Amplitude Setup
:read:    VOLT:COUP?
:write:   VOLT:COUP #
:enable:  Setup.Tracking=="OFF"
:string:
Off OFF
On  ON

#cmdSetup comboboxHot Output Setup
:read:    OUTP:COUP?
:write:   OUTP:COUP #
:enable:  Setup.Tracking=="OFF"
:string:
Off OFF
On  ON

#cmdSetup comboboxHot Tracking Setup
:read:    TRACK?
:write:   TRACK #
:enable:  Setup.Output=="OFF" && Setup.Amplitude=="OFF" && Setup.Frequency=="OFF"
:string:
Off          OFF
Equal        EQUAL
Differentail INVERT

;PHAS:SYNC
#cmdSetup button Align_Outputs Setup
:write:   PHAS:SYNC


#cmdSetup separator - Setup
1 100 Empty

#cmdSetup Info Trigger Setup

#cmdSetup separator - Setup
:color: (0,0,0)
3 100 Solid

#cmdSetup comboboxHot Manual_Key Setup
:read: 
:write:   CHNTRG #
:string:
Single_Channel SINGLE
Dual_Channels  DUAL

#cmdSetup button Trigger Setup
:write:   *TRG


#cmdSetup separator - Setup
1 100 Empty


#cmdSetup Info Instrument Setup

#cmdSetup separator - Setup
:color:  (0,0,0)
3 100 Solid

#cmdSetup button Default_Settings Setup
:write:   OUTP1 0;OUTP2 0;COUNT:STAT 0; *RST; RCNT; ROUT; R1A;R1B;R1C;R1D;R1E;R1F;R1G;R1H;R1I;R1J;R1K;R1L;R1M;R1N; R2A;R2B;R2C;R2D;R2E;R2F;R2G;R2H;R2I;R2J;R2K;R2L;R2M;R2N;
:update:  Output_1_ Output_2_ Counter 


;------------------------------------------------------------------------------------
; Global
;------------------------------------------------------------------------------------

#cmdSetup buttonsOn Output_1_
:read:   OUTP1?
:write:  OUTP1 (value)
:update: Output_1 Output_2
:color:  (235,235,00)
:updatealloff:
Off 0
On 1

#cmdSetup buttonsOn Output_2_
:read:   OUTP2?
:write:  OUTP2 (value)
:update: Output_1 Output_2
:color:  (0,255,75)
:updatealloff:
Off 0
On 1

#cmdSetup buttonsOn Counter
:read:    COUNT:STAT?
:write:   COUNT:STAT (value)
:color:   (255,255,255)
:updatemodechange:
:updatealloff:
Off 0
On 1


; -----------------------------------------------------------------------------
; Other
; -----------------------------------------------------------------------------

#otherList
menuItem[0]="Device Settings.txt";
menuItem[1]="Init Sequence.txt";

var entry0 = deviceRead(handle, "ARB1DEF?");
var entry1 = deviceRead(handle, "ARB2DEF?");
var entry2 = deviceRead(handle, "ARB3DEF?");
var entry3 = deviceRead(handle, "ARB4DEF?");
menuItem[2+0] = "ARB1: " + entry0+".xxx";
menuItem[2+1] = "ARB2: " + entry1+".xxx";
menuItem[2+2] = "ARB3: " + entry2+".xxx";
menuItem[2+3] = "ARB4: " + entry3+".xxx";


#otherFunc


#otherImage


#otherText
var nl;
var func;
var all;
var enable;
var mode;

if (name=="Device Settings.txt" || name=="Init Sequence.txt") 
  all  = name=="Device Settings.txt";
  nl   = ";\r\n";

  if (all)
    print("// Device settings, use commands in a script or copy to a terminal.\r\n");
  else
    print("// Initialize the current mode. Use commands in a script or copy to a terminal.\r\n");
  endif
  
  mode=deviceRead(handle,"SOUR1:FUNC?"); 
  print("SOUR1:FUNC "              +deviceRead(handle,"SOUR1:FUNC?")+nl);
  if (int(deviceRead(handle,"SOUR1:MENU:PERIOD?")))
    print("SOUR1:PER "             +deviceRead(handle,"SOUR1:PER?")+nl);
  else
    print("SOUR1:FREQ "            +deviceRead(handle,"SOUR1:FREQ?")+nl);
  endif
  
  if (int(deviceRead(handle,"SOUR1:MENU:LEVEL?")))
    print("SOUR1:VOLT:HIGH "       +deviceRead(handle,"SOUR1:VOLT:HIGH?")+nl);
    print("SOUR1:VOLT:LOW "        +deviceRead(handle,"SOUR1:VOLT:LOW?")+nl);
  else
    print("SOUR1:VOLT "            +deviceRead(handle,"SOUR1:VOLT?")+nl);
    print("SOUR1:VOLT:OFFS "       +deviceRead(handle,"SOUR1:VOLT:OFFS?")+nl);
  endif
  
  if (all || mode=="RAMP")
    print("SOUR1:FUNC:RAMP:SYMM "  +deviceRead(handle,"SOUR1:FUNC:RAMP:SYMM?")+nl);
  endif
  
  if (all || mode=="SQUARE")
    print("SOUR1:FUNC:SQU:SYMM "   +deviceRead(handle,"SOUR1:FUNC:SQU:SYMM?")+nl);
  endif
  
  if (all || mode=="PULSE")
    if (int(deviceRead(handle,"SOUR1:MENU:PERIOD?")))
	  print("SOUR1:FUNC:PULS:PER " +deviceRead(handle,"SOUR1:FUNC:PULS:PER?")+nl);
	else
      print("SOUR1:FUNC:PULS:FREQ "+deviceRead(handle,"SOUR1:FUNC:PULS:FREQ?")+nl);
    endif
	
	if (int(deviceRead(handle,"SOUR1:MENU:WIDTH?")))
	  print("SOUR1:FUNC:PULS:WIDT "+deviceRead(handle,"SOUR1:FUNC:PULS:WIDT?")+nl);
	else
      print("SOUR1:FUNC:PULS:DCYC "+deviceRead(handle,"SOUR1:FUNC:PULS:DCYC?")+nl);
	endif
	
    print("SOUR1:FUNC:PULS:TRAN:LEAD " +deviceRead(handle,"SOUR1:FUNC:PULS:TRAN:LEAD?")+nl);
    print("SOUR1:FUNC:PULS:TRAN:TRA "  +deviceRead(handle,"SOUR1:FUNC:PULS:TRAN:TRA?")+nl);
    print("SOUR1:FUNC:PULS:DEL "   +deviceRead(handle,"SOUR1:FUNC:PULS:DEL?")+nl);
  endif
  
  if (all || inList(mode, "PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31"))
    print("SOUR1:FUNC:PRBS:BRAT "  +deviceRead(handle,"SOUR1:FUNC:PRBS:BRAT?")+nl);
  endif
  
  print("OUTP1:POL "               +deviceRead(handle,"OUTP1:POL?")+nl);
  print("OUTP1:LOAD "              +deviceRead(handle,"OUTP1:LOAD?")+nl);
  print("SOUR1:PHASE "             +deviceRead(handle,"SOUR1:PHASE?")+nl);
  print("SOUR1:VOLT:RANGE:AUTO "   +deviceRead(handle,"SOUR1:VOLT:RANGE:AUTO?")+nl);
  
  enable=int(deviceRead(handle,"SOUR1:BURS:MODE?"));
  if (all || enable)
    print("SOUR1:BURS:TRIG:SOUR "  +deviceRead(handle,"SOUR1:BURS:TRIG:SOUR?")+nl);
    print("SOUR1:BURS:GATE:POL "   +deviceRead(handle,"SOUR1:BURS:GATE:POL?")+nl);
    print("SOUR1:BURS:INT:PER "    +deviceRead(handle,"SOUR1:BURS:INT:PER?")+nl);
    print("SOUR1:BURS:NCYC "       +deviceRead(handle,"SOUR1:BURS:NCYC?")+nl);
    print("SOUR1:BURS:PHASE "      +deviceRead(handle,"SOUR1:BURS:PHASE?")+nl);
  endif
  print("SOUR1:BURS:MODE "         +deviceRead(handle,"SOUR1:BURS:MODE?")+nl);
  
  enable=int(deviceRead(handle,"SOUR1:SWE:STAT?"));
  if (all || enable)
    print("SOUR1:SWE:MODE "        +deviceRead(handle,"SOUR1:SWE:MODE?")+nl);
    print("SOUR1:SWE:TRIG:SOUR "   +deviceRead(handle,"SOUR1:SWE:TRIG:SOUR?")+nl);
    print("SOUR1:SWE:GATE:POL "    +deviceRead(handle,"SOUR1:SWE:GATE:POL?")+nl);
    print("SOUR1:SWE:INT:PER "     +deviceRead(handle,"SOUR1:SWE:INT:PER?")+nl);
    print("SOUR1:SWE:SPAC "        +deviceRead(handle,"SOUR1:SWE:SPAC?")+nl);
    print("SOUR1:SWE:FREQ:START "  +deviceRead(handle,"SOUR1:SWE:FREQ:START?")+nl);
    print("SOUR1:SWE:FREQ:STOP "   +deviceRead(handle,"SOUR1:SWE:FREQ:STOP?")+nl);
    print("SOUR1:SWE:TIME "        +deviceRead(handle,"SOUR1:SWE:TIME?")+nl);
  endif
  print("SOUR1:SWE:STAT "          +deviceRead(handle,"SOUR1:SWE:STAT?")+nl);
  
  print("SOUR1:MOD "               +deviceRead(handle,"SOUR1:MOD?")+nl);
  mode=deviceRead(handle,"SOUR1:MOD?");
  if (all || mode=="AM" || mode=="AMSC")
    print("SOUR1:AM:SOUR "         +deviceRead(handle,"SOUR1:AM:SOUR?")+nl);
    print("SOUR1:AM:INT:FUNC "     +deviceRead(handle,"SOUR1:AM:INT:FUNC?")+nl);
    print("SOUR1:AM:FREQ "         +deviceRead(handle,"SOUR1:AM:FREQ?")+nl);
    print("SOUR1:AM:DEPTH "        +deviceRead(handle,"SOUR1:AM:DEPTH?")+nl);
  endif
  if (all || mode=="FM")
    print("SOUR1:FM:SOUR "         +deviceRead(handle,"SOUR1:FM:SOUR?")+nl);
    print("SOUR1:FM:INT:FUNC "     +deviceRead(handle,"SOUR1:FM:INT:FUNC?")+nl);
    print("SOUR1:FM:FREQ "         +deviceRead(handle,"SOUR1:FM:FREQ?")+nl);
    print("SOUR1:FM:DEV "          +deviceRead(handle,"SOUR1:FM:DEV?")+nl);
  endif
  if (all || mode=="PM")
    print("SOUR1:PM:SOUR "         +deviceRead(handle,"SOUR1:PM:SOUR?")+nl);
    print("SOUR1:PM:INT:FUNC "     +deviceRead(handle,"SOUR1:PM:INT:FUNC?")+nl);
    print("SOUR1:PM:FREQ "         +deviceRead(handle,"SOUR1:PM:FREQ?")+nl);
    print("SOUR1:PM:DEV "          +deviceRead(handle,"SOUR1:PM:DEV?")+nl);
  endif
  if (all || mode=="PWM")
    print("SOUR1:PWM:SOUR "        +deviceRead(handle,"SOUR1:PWM:SOUR?")+nl);
    print("SOUR1:PWM:INT:FUNC "    +deviceRead(handle,"SOUR1:PWM:INT:FUNC?")+nl);
    print("SOUR1:PWM:FREQ "        +deviceRead(handle,"SOUR1:PWM:FREQ?")+nl);
    print("SOUR1:PWM:DEV "         +deviceRead(handle,"SOUR1:PWM:DEV?")+nl);
  endif
  if (all || mode=="SUM")
    print("SOUR1:SUM:SOUR "        +deviceRead(handle,"SOUR1:SUM:SOUR?")+nl);
    print("SOUR1:SUM:INT:FUNC "    +deviceRead(handle,"SOUR1:SUM:INT:FUNC?")+nl);
    print("SOUR1:SUM:FREQ "        +deviceRead(handle,"SOUR1:SUM:FREQ?")+nl);
    print("SOUR1:SUM:AMPL "        +deviceRead(handle,"SOUR1:SUM:AMPL?")+nl);
  endif
  if (all || mode=="ASK")
    print("SOUR1:ASK:SOUR "        +deviceRead(handle,"SOUR1:ASK:SOUR?")+nl);
    print("SOUR1:ASK:INT:RATE "    +deviceRead(handle,"SOUR1:ASK:INT:RATE?")+nl);
    print("SOUR1:ASK:AMPL "        +deviceRead(handle,"SOUR1:ASK:AMPL?")+nl);
    print("SOUR1:ASK:POL "         +deviceRead(handle,"SOUR1:ASK:POL?")+nl);
  endif
  if (all || mode=="FSK")
    print("SOUR1:FSK:SOUR "        +deviceRead(handle,"SOUR1:FSK:SOUR?")+nl);
    print("SOUR1:FSK:INT:RATE "    +deviceRead(handle,"SOUR1:FSK:INT:RATE?")+nl);
    print("SOUR1:FSK:FREQ "        +deviceRead(handle,"SOUR1:FSK:FREQ?")+nl);
    print("SOUR1:FSK:POL "         +deviceRead(handle,"SOUR1:FSK:POL?")+nl);
  endif
  if (all || mode=="BPSK")
    print("SOUR1:BPSK:SOUR "       +deviceRead(handle,"SOUR1:BPSK:SOUR?")+nl);
    print("SOUR1:BPSK:INT:RATE "   +deviceRead(handle,"SOUR1:BPSK:INT:RATE?")+nl);
    print("SOUR1:BPSK:PHASE "      +deviceRead(handle,"SOUR1:BPSK:PHASE?")+nl);
    print("SOUR1:BPSK:POL "        +deviceRead(handle,"SOUR1:BPSK:POL?")+nl);
  endif
                  
  mode=deviceRead(handle,"SOUR2:FUNC?");                  
  print("SOUR2:FUNC "              +deviceRead(handle,"SOUR2:FUNC?")+nl);
  if (int(deviceRead(handle,"SOUR2:MENU:PERIOD?")))
    print("SOUR2:PER "             +deviceRead(handle,"SOUR2:PER?")+nl);
  else
    print("SOUR2:FREQ "            +deviceRead(handle,"SOUR2:FREQ?")+nl);
  endif
  
  if (int(deviceRead(handle,"SOUR2:MENU:LEVEL?")))
    print("SOUR2:VOLT:HIGH "       +deviceRead(handle,"SOUR2:VOLT:HIGH?")+nl);
    print("SOUR2:VOLT:LOW "        +deviceRead(handle,"SOUR2:VOLT:LOW?")+nl);
  else
    print("SOUR2:VOLT "            +deviceRead(handle,"SOUR2:VOLT?")+nl);
    print("SOUR2:VOLT:OFFS "       +deviceRead(handle,"SOUR2:VOLT:OFFS?")+nl);
  endif
 
  if (all || mode=="RAMP")
    print("SOUR2:FUNC:RAMP:SYMM "  +deviceRead(handle,"SOUR2:FUNC:RAMP:SYMM?")+nl);
  endif
  
  if (all || mode=="SQUARE")
    print("SOUR2:FUNC:SQU:SYMM "   +deviceRead(handle,"SOUR2:FUNC:SQU:SYMM?")+nl);
  endif
  
  if (all || mode=="PULSE")
    if (int(deviceRead(handle,"SOUR2:MENU:PERIOD?")))
	  print("SOUR2:FUNC:PULS:PER " +deviceRead(handle,"SOUR2:FUNC:PULS:PER?")+nl);
	else
      print("SOUR2:FUNC:PULS:FREQ "+deviceRead(handle,"SOUR2:FUNC:PULS:FREQ?")+nl);
	endif
	
	if (int(deviceRead(handle,"SOUR2:MENU:WIDTH?")))
	  print("SOUR2:FUNC:PULS:WIDT "+deviceRead(handle,"SOUR2:FUNC:PULS:WIDT?")+nl);
	else
      print("SOUR2:FUNC:PULS:DCYC "+deviceRead(handle,"SOUR2:FUNC:PULS:DCYC?")+nl);
	endif
    
    print("SOUR2:FUNC:PULS:TRAN:LEAD " +deviceRead(handle,"SOUR2:FUNC:PULS:TRAN:LEAD?")+nl);
    print("SOUR2:FUNC:PULS:TRAN:TRA "  +deviceRead(handle,"SOUR2:FUNC:PULS:TRAN:TRA?")+nl);
    print("SOUR2:FUNC:PULS:DEL "   +deviceRead(handle,"SOUR2:FUNC:PULS:DEL?")+nl);
  endif
  
  if (all || inList(mode, "PRBSPN7 PRBSPN9 PRBSPN11 PRBSPN15 PRBSPN23 PRBSPN29 PRBSPN31"))
    print("SOUR2:FUNC:PRBS:BRAT "  +deviceRead(handle,"SOUR2:FUNC:PRBS:BRAT?")+nl);
  endif
  
  print("OUTP2:POL "               +deviceRead(handle,"OUTP2:POL?")+nl);
  print("OUTP2:LOAD "              +deviceRead(handle,"OUTP2:LOAD?")+nl);
  print("SOUR2:PHASE "             +deviceRead(handle,"SOUR2:PHASE?")+nl);
  print("SOUR2:VOLT:RANGE:AUTO "   +deviceRead(handle,"SOUR2:VOLT:RANGE:AUTO?")+nl);
  
  enable=int(deviceRead(handle,"SOUR2:BURS:MODE?"));
  if (all || enable)
    print("SOUR2:BURS:TRIG:SOUR "  +deviceRead(handle,"SOUR2:BURS:TRIG:SOUR?")+nl);
    print("SOUR2:BURS:GATE:POL "   +deviceRead(handle,"SOUR2:BURS:GATE:POL?")+nl);
    print("SOUR2:BURS:INT:PER "    +deviceRead(handle,"SOUR2:BURS:INT:PER?")+nl);
    print("SOUR2:BURS:NCYC "       +deviceRead(handle,"SOUR2:BURS:NCYC?")+nl);
    print("SOUR2:BURS:PHASE "      +deviceRead(handle,"SOUR2:BURS:PHASE?")+nl);
  endif
  print("SOUR2:BURS:MODE "         +deviceRead(handle,"SOUR2:BURS:MODE?")+nl);
  
  enable=int(deviceRead(handle,"SOUR2:SWE:STAT?"));
  if (all || enable)
    print("SOUR2:SWE:MODE "        +deviceRead(handle,"SOUR2:SWE:MODE?")+nl);
    print("SOUR2:SWE:TRIG:SOUR "   +deviceRead(handle,"SOUR2:SWE:TRIG:SOUR?")+nl);
    print("SOUR2:SWE:GATE:POL "    +deviceRead(handle,"SOUR2:SWE:GATE:POL?")+nl);
    print("SOUR2:SWE:INT:PER "     +deviceRead(handle,"SOUR2:SWE:INT:PER?")+nl);
    print("SOUR2:SWE:SPAC "        +deviceRead(handle,"SOUR2:SWE:SPAC?")+nl);
    print("SOUR2:SWE:FREQ:START "  +deviceRead(handle,"SOUR2:SWE:FREQ:START?")+nl);
    print("SOUR2:SWE:FREQ:STOP "   +deviceRead(handle,"SOUR2:SWE:FREQ:STOP?")+nl);
    print("SOUR2:SWE:TIME "        +deviceRead(handle,"SOUR2:SWE:TIME?")+nl);
  endif
  print("SOUR2:SWE:STAT "          +deviceRead(handle,"SOUR2:SWE:STAT?")+nl);
  
  print("SOUR2:MOD "               +deviceRead(handle,"SOUR2:MOD?")+nl);
  mode=deviceRead(handle,"SOUR2:MOD?");
  if (all || mode=="AM" || mode=="AMSC")
    print("SOUR2:AM:SOUR "         +deviceRead(handle,"SOUR2:AM:SOUR?")+nl);
    print("SOUR2:AM:INT:FUNC "     +deviceRead(handle,"SOUR2:AM:INT:FUNC?")+nl);
    print("SOUR2:AM:FREQ "         +deviceRead(handle,"SOUR2:AM:FREQ?")+nl);
    print("SOUR2:AM:DEPTH "        +deviceRead(handle,"SOUR2:AM:DEPTH?")+nl);
  endif
  if (all || mode=="FM")
    print("SOUR2:FM:SOUR "         +deviceRead(handle,"SOUR2:FM:SOUR?")+nl);
    print("SOUR2:FM:INT:FUNC "     +deviceRead(handle,"SOUR2:FM:INT:FUNC?")+nl);
    print("SOUR2:FM:FREQ "         +deviceRead(handle,"SOUR2:FM:FREQ?")+nl);
    print("SOUR2:FM:DEV "          +deviceRead(handle,"SOUR2:FM:DEV?")+nl);
  endif
  if (all || mode=="PM")
    print("SOUR2:PM:SOUR "         +deviceRead(handle,"SOUR2:PM:SOUR?")+nl);
    print("SOUR2:PM:INT:FUNC "     +deviceRead(handle,"SOUR2:PM:INT:FUNC?")+nl);
    print("SOUR2:PM:FREQ "         +deviceRead(handle,"SOUR2:PM:FREQ?")+nl);
    print("SOUR2:PM:DEV "          +deviceRead(handle,"SOUR2:PM:DEV?")+nl);
  endif
  if (all || mode=="FWM")
    print("SOUR2:PWM:SOUR "        +deviceRead(handle,"SOUR2:PWM:SOUR?")+nl);
    print("SOUR2:PWM:INT:FUNC "    +deviceRead(handle,"SOUR2:PWM:INT:FUNC?")+nl);
    print("SOUR2:PWM:FREQ "        +deviceRead(handle,"SOUR2:PWM:FREQ?")+nl);
    print("SOUR2:PWM:DEV "         +deviceRead(handle,"SOUR2:PWM:DEV?")+nl);
  endif
  if (all || mode=="SUM")
    print("SOUR2:SUM:SOUR "        +deviceRead(handle,"SOUR2:SUM:SOUR?")+nl);
    print("SOUR2:SUM:INT:FUNC "    +deviceRead(handle,"SOUR2:SUM:INT:FUNC?")+nl);
    print("SOUR2:SUM:FREQ "        +deviceRead(handle,"SOUR2:SUM:FREQ?")+nl);
    print("SOUR2:SUM:AMPL "        +deviceRead(handle,"SOUR2:SUM:AMPL?")+nl);
  endif
  if (all || mode=="ASK")
    print("SOUR2:ASK:SOUR "        +deviceRead(handle,"SOUR2:ASK:SOUR?")+nl);
    print("SOUR2:ASK:INT:RATE "    +deviceRead(handle,"SOUR2:ASK:INT:RATE?")+nl);
    print("SOUR2:ASK:AMPL "        +deviceRead(handle,"SOUR2:ASK:AMPL?")+nl);
    print("SOUR2:ASK:POL "         +deviceRead(handle,"SOUR2:ASK:POL?")+nl);
  endif
  if (all || mode=="FSK")
    print("SOUR2:FSK:SOUR "        +deviceRead(handle,"SOUR2:FSK:SOUR?")+nl);
    print("SOUR2:FSK:INT:RATE "    +deviceRead(handle,"SOUR2:FSK:INT:RATE?")+nl);
    print("SOUR2:FSK:FREQ "        +deviceRead(handle,"SOUR2:FSK:FREQ?")+nl);
    print("SOUR2:FSK:POL "         +deviceRead(handle,"SOUR2:FSK:POL?")+nl);
  endif
  if (all || mode=="BPSK")
    print("SOUR2:BPSK:SOUR "       +deviceRead(handle,"SOUR2:BPSK:SOUR?")+nl);
    print("SOUR2:BPSK:INT:RATE "   +deviceRead(handle,"SOUR2:BPSK:INT:RATE?")+nl);
    print("SOUR2:BPSK:PHASE "      +deviceRead(handle,"SOUR2:BPSK:PHASE?")+nl);
    print("SOUR2:BPSK:POL "        +deviceRead(handle,"SOUR2:BPSK:POL?")+nl);
  endif

  print("ROSC:SOUR "             +deviceRead(handle,"ROSC:SOUR?")+nl);
  print("OUTP:SYNC "             +deviceRead(handle,"OUTP:SYNC?")+nl);
  print("OUTP:SYNC:MODE "        +deviceRead(handle,"OUTP:SYNC:MODE?")+nl);
  print("OUTP:SYNC:SOUR "        +deviceRead(handle,"OUTP:SYNC:SOUR?")+nl);
  print("FREQ:COUP "             +deviceRead(handle,"FREQ:COUP?")+nl);
  print("VOLT:COUP "             +deviceRead(handle,"VOLT:COUP?")+nl);
  print("OUTP:COUP "             +deviceRead(handle,"OUTP:COUP?")+nl);
  print("TRACK "                 +deviceRead(handle,"TRACK?")+nl);
  print("OUTP1 "                 +deviceRead(handle,"OUTP1?")+nl);
  print("OUTP2 "                 +deviceRead(handle,"OUTP2?")+nl);
  
  print("COUNT:STAT "            +deviceRead(handle,"COUNT:STAT?")+nl);
endif

#otherData


;------------------------------------------------------------------------------------
; Help
;------------------------------------------------------------------------------------

#notes 
Press F1 in Mode or Setup window for device information. 

Problems and known Bugs:

- TGF4000 device
  The FTG4000 series does not support the read back of programmed values (!), so
  in general the correct state of the instrument cannot be detected. The 
  corresponding COMMAND? operations - except for a few cases - are not supported.
  Since this is very unique in the industry, I contacted AIM-TTi but got no 
  support or response so far (the motiviation seems to be very limited).
  The current workaround is like this: All SCPI commands got a wrapper, which
  store the programmed values in an dedicated variable. The readback returns then
  the variable contents instead of the value from the instrument. This works 
  as long the "factory reset" button in the Setup window or the *RST command 
  is applied at the beginning of the session which synchronizes the host and 
  device to a well known state.
  Practically you can live with this solution, but of corse there exists
  corner cases where the replicated system state on the host no longer supports
  the behaviour of the instrumnt (e.g. error cases, duty/width setting on the
  display of the pulse waveform when switching frequency/periode, ...)
  
- TGF4000 device
  A more sophisticated solution would be to use the LRN? command, which 
  transfers the device state to the host, analyze it and fill out all variables.
  But since Windows 10 the LRN? command does no longer work (the instrument 
  hangs and needs to be shut off to recover from that situation)


#helpurl https://www.aimtti.com/resources/tgf4000-series-instruction-manual-issue-3


;------------------------------------------------------------------------------------
; Debug
;------------------------------------------------------------------------------------

;#DEBUG TGF4162  +modeComm +valueComm +otherComm +commHex
