; ********************************************************************************************
; ***   For Siglent SDGxxxxX function generators                                           ***
; ***                                                                                      ***
; ***   Please note:                                                                       ***
; ***   This version is tested on the SDG2042X/SDG2122X with firmware 2.01.01.35R3B2       ***
; ***   and Testcontroller V1.78 (with support for underscore in read/write)               ***
; ***                                                                                      ***
; ***   Cavities:                                                                          ***
; ***   Could not get MODE PHASE-LOCKED working on SDG2042X/SDG2122X                       ***
; ***                                                                                      ***
; ***   Please report found errors                                                         ***
; ***                                                                                      ***
; *** Source originally from HKJ and klausES.                                              ***
; *** 28 Aug 21 Yaybee Corrected some errors, added TrueArB, added Fcounter #askvalues,    ***
; ***                  state overview indicators,                                          ***
; ***                  changed CH2 controls to unique values.                              ***
; *** 20 Aug 21 Yaybee Major overhaul of SetUp with introduction of selector controls,     ***
; ***                  new #replaceText controls are added,                                ***
; ***                  many new commands/controls are added                                ***
; *** 02 May 20	HKJ    Change Ampl. Cal. Z to use a combobox,                              ***
; ***                  this way HiZ can be selected                                        ***
; *** 01 May 20		   Added rms and dbm.                                              ***
; *** 01 May 20		   Mods by Hexley                                                  ***
; ********************************************************************************************


; latest Version 0.94 by:
#author Yaybee

; *********************************************************
; ********  D E V I C E   C A P A B I L I T I E S  ********
; *********************************************************

#metadef
#idString Siglent Technologies,SDG1032X,
#name Siglent SDG1032X
#handle SDG1032X
#replaceText MaxSineFreq 30M
#replaceText MinSinePeriod 33.333n
#replaceText MaxSquareFreq 30M
#replaceText MinSquarePeriod 33.333n
#replaceText MinPulseWidth 32.6n
#replaceText MinPulseRiseFall 16.8n
#replaceText MaxPulseRiseFall 22.4
#replaceText MaxRampFreq 500k
#replaceText MaxArbFreq 6M
#replaceText MaxArbSrate 30M
#remove #cmdSetup radio Sweep_Marker Channel_1
#remove #cmdSetup number Sweep_Marker_Freq Channel_1
#remove #cmdSetup radio Sweep_Marker_ Channel_2
#remove #cmdSetup number Sweep_Marker_Freq_ Channel_2
#remove #cmdSetup radio Arbitrary_Type Channel_1
#remove #cmdSetup number Symbol_Rate Channel_1
#remove #cmdSetup radio Arbitrary_Type_ Channel_2
#remove #cmdSetup number Symbol_Rate_ Channel_2

#metadef
#idString Siglent Technologies,SDG1062X,
#name Siglent SDG1062X
#handle SDG1062X
#replaceText MaxSineFreq 60M
#replaceText MinSinePeriod 16.666n
#replaceText MaxSquareFreq 60M
#replaceText MinSquarePeriod 16.666n
#replaceText MinPulseWidth 32.6n
#replaceText MinPulseRiseFall 16.8n
#replaceText MaxPulseRiseFall 22.4
#replaceText MaxRampFreq 500k
#replaceText MaxArbFreq 6M
#replaceText MaxArbSrate 30M
#remove #cmdSetup radio Sweep_Marker Channel_1
#remove #cmdSetup number Sweep_Marker_Freq Channel_1
#remove #cmdSetup radio Sweep_Marker_ Channel_2
#remove #cmdSetup number Sweep_Marker_Freq_ Channel_2
#remove #cmdSetup radio Arbitrary_Type Channel_1
#remove #cmdSetup number Symbol_Rate Channel_1
#remove #cmdSetup radio Arbitrary_Type_ Channel_2
#remove #cmdSetup number Symbol_Rate_ Channel_2

#metadef
#idString Siglent Technologies,SDG2042X,
#name Siglent SDG2042X
#handle SDG2042X
#replaceText MaxSineFreq 40M
#replaceText MinSinePeriod 25n
#replaceText MaxSquareFreq 25M
#replaceText MinSquarePeriod 40n
#replaceText MinPulseWidth 16.3n
#replaceText MinPulseRiseFall 8.4n
#replaceText MaxPulseRiseFall 22.4
#replaceText MaxRampFreq 1M
#replaceText MaxArbFreq 20M
#replaceText MaxArbSrate 75M
#remove #cmdSetup radio Sweep_Marker Channel_1
#remove #cmdSetup number Sweep_Marker_Freq Channel_1
#remove #cmdSetup radio Sweep_Marker_ Channel_2
#remove #cmdSetup number Sweep_Marker_Freq_ Channel_2

#metadef
#idString Siglent Technologies,SDG2082X,
#name Siglent SDG2082X
#handle SDG2082X
#replaceText MaxSineFreq 80M
#replaceText MinSinePeriod 12.5n
#replaceText MaxSquareFreq 25M
#replaceText MinSquarePeriod 40n
#replaceText MinPulseWidth 16.3n
#replaceText MinPulseRiseFall 8.4n
#replaceText MaxPulseRiseFall 22.4
#replaceText MaxRampFreq 1M
#replaceText MaxArbFreq 20M
#replaceText MaxArbSrate 75M
#remove #cmdSetup radio Sweep_Marker Channel_1
#remove #cmdSetup number Sweep_Marker_Freq Channel_1
#remove #cmdSetup radio Sweep_Marker_ Channel_2
#remove #cmdSetup number Sweep_Marker_Freq_ Channel_2

#metadef
#idString Siglent Technologies,SDG2122X,
#name Siglent SDG2122X
#handle SDG2122X
#replaceText MaxSineFreq 120M
#replaceText MinSinePeriod 8.333n
#replaceText MaxSquareFreq 25M
#replaceText MinSquarePeriod 40n
#replaceText MinPulseWidth 16.3n
#replaceText MinPulseRiseFall 8.4n
#replaceText MaxPulseRiseFall 22.4
#replaceText MaxRampFreq 1M
#replaceText MaxArbFreq 20M
#replaceText MaxArbSrate 75M
#remove #cmdSetup radio Sweep_Marker Channel_1
#remove #cmdSetup number Sweep_Marker_Freq Channel_1
#remove #cmdSetup radio Sweep_Marker_ Channel_2
#remove #cmdSetup number Sweep_Marker_Freq_ Channel_2

#metadef
#idString Siglent Technologies,SDG6022X,
#name Siglent SDG6022X
#handle SDG2122X
#replaceText MaxSineFreq 200M
#replaceText MinSinePeriod 5n
#replaceText MaxSquareFreq 80M
#replaceText MinSquarePeriod 12.5n
#replaceText MinPulseWidth 3.4n
#replaceText MinPulseRiseFall 2n
#replaceText MaxPulseRiseFall 75
#replaceText MaxRampFreq 5M
#replaceText MaxArbFreq 50M
#replaceText MaxArbSrate 300M

#metadef
#idString Siglent Technologies,SDG6032X,
#name Siglent SDG6032X
#handle SDG6032X
#replaceText MaxSineFreq 350M
#replaceText MinSinePeriod 2.857n
#replaceText MaxSquareFreq 120M
#replaceText MinSquarePeriod 8.333n
#replaceText MinPulseWidth 3.3n
#replaceText MinPulseRiseFall 1n
#replaceText MaxPulseRiseFall 75
#replaceText MaxRampFreq 5M
#replaceText MaxArbFreq 50M
#replaceText MaxArbSrate 300M

#metadef
#idString Siglent Technologies,SDG6052X,
#name Siglent SDG6052X
#handle SDG6052X
#replaceText MaxSineFreq 500M
#replaceText MinSinePeriod 2n
#replaceText MaxSquareFreq 120M
#replaceText MinSquarePeriod 8.333n
#replaceText MinPulseWidth 3.3n
#replaceText MinPulseRiseFall 1n
#replaceText MaxPulseRiseFall 75
#replaceText MaxRampFreq 5M
#replaceText MaxArbFreq 50M
#replaceText MaxArbSrate 300M


; generalized capabilities of Siglent Technologies SDGxxxxX series

#meta
#idString Siglent Technologies,SDGxxxxX,
#name Siglent SDGxxxxX
#handle SDGxxxxX
#port lxi


; *********************************************************
; ********        S C R I P T I N G  M O D E       ********
; ********                   O R                   ********
; ********         F C O U N T E R  M O D E        ********
; *********************************************************

; WARNING: at this moment you cannot enable the basic wave scripting and
; the frequency counter function at the same time.
; One set of configuration statements needs to be set to comment lines.
; This device does not support mode setting by reading a mode variable.
; Using multiple modes requires Testcontroller to simulate a mode variable,
; so we can query this mode with #askMode
; Mode could be None, CH1, CH2, CH2+CH2 (currently specified) and
; as secondary mode we could add the frequency counter.

; *********************************************************
; ********        S C R I P T I N G  M O D E       ********
; *********************************************************

; NOTE: The ARB will not send out the actual real-time values of the
; base wave, but the configuration parameter as defined in Setup.
; So TAB "current values" has no real meaning for this device.
; This is specially valid for active Sweep or Modulation.
; You can however log four values per channel and track changes issued by
; script write commands for basic wave (see scripting interface)

; A fixed list per channel of column name with unit and formatter
; for the #askValuesProcessor SiglentSDG function
#value Frequency1 Hz SI
#value Amplitude1 V SI
#value Offset1 V SI
#value DutyCycle1 % D1
#value Frequency2 Hz SI
#value Amplitude2 V SI
#value Offset2 V SI
#value DutyCycle2 % D1

; How to poll for data, this is used for table and #values?
#askValues C1:BSWV?;C2:BSWV?
; Special math processing for the response on BSWV?
#askValuesProcessor SiglentSDG
; This should be equal to, but probably faster than:
; #askValuesMathFormat getMatchGroup(value,"FRQ,(.*?)HZ",1) + " " + getMatchGroup(value,"AMP,(.*?)V",1) + " " + getMatchGroup(value,"OFST,(.*?)V",1) + " " + getElement(getMatch(value,"DUTY,[^,]*(,|$)"),1,",")
; so you can use other parameters in your query if you want to.


; *********************************************************
; ********         F C O U N T E R  M O D E        ********
; *********************************************************

; NOTE: The ARB has a build-in basic frequency counter.
; The access is at the back-panel and can be configured in Setup or in a script.
; Being a measuring device this will report actual real-time values.
; There are some restrictions; see user documentation.

; A list of column name with unit and formatter
;#value Frequency Hz SI
;#value RefDeviation ppm D2
;#value DutyCycle % D1

; How to poll for data, this is used for table and #values?
;#askValues FCNT?
;#askValuesMathFormat getMatchGroup(value,"FRQ,(.*?)HZ",1) + " " + getMatchGroup(value,"FRQDEV,(.*?)ppm",1) + " " + getElement(getMatch(value,"DUTY,[^,]*(,|$)"),1,",")

; *********************************************************
; ********        I N I T  &  C L O S U R E        ********
; *********************************************************

; Initial commands to device when establishing connection
#initCmd NBFM PNT,DOT,SEPT,SPACE

; Final command to device before breaking connection
#finalCmd C1:OUTP OFF;C2:OUTP OFF

; Commands button: Outputs off
#outputOff C1:OUTP OFF;C2:OUTP OFF


; *********************************************************
; ********  S C R I P T I N G   I N T E R F A C E  ********
; *********************************************************

; this creates a generalized command interface for scripts

; Sets device type as dual output Arbitrary waveform generator
#interfaceType ARB ARB:2

; write settings of some basic wave parameters
#interface setFrequency C(channel):BSWV FRQ,(value)
#interface setAmplitude C(channel):BSWV AMP,(value)
#interface setOffset C(channel):BSWV OFST,(value)
#interface setWaveform C(channel):BSWV WVTP,(value)
#interface setOn C(channel):OUTP (getElement("OFF ON",value," "))

; read setting of some basic wave parameters
#interface getFrequency C(channel):BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
#interface getAmplitude C(channel):BSWV?
:readmath: getElement(getMatch(value,"AMP,[0-9.]+V,"),1,",")
:readformat: u
#interface getOffset C(channel):BSWV?
:readmath: getElement(getMatch(value,"OFST,[^,]*(,|$)"),1,",")
:readformat: u
#interface getWaveform C(channel):BSWV?
:string:
:readmath: getElement(value,1,",")
#interface getOn C(channel):OUTP?
:readmath: listIndex(getMatch(value,"(ON)|(OFF)"),"OFF ON"," ")

; table entry numbers for C1 & C2 values
#interface readFrequency 0 4
#interface readAmplitude 1 5
#interface readOffset 2 6
#interface readDutyCycle 3 7

; Special for switch on/off optional functions preset via setup menu
#interface setOnModulation C(channel):MDWV STATE,(getElement("OFF ON",value," "))
#interface setOnSweep C(channel):SWWV STATE,(getElement("OFF ON",value," "))
#interface setOnBurst C(channel):BTWV STATE,(getElement("OFF ON",value," "))
#interface setOnHarmonics C(channel):HARM HARMSTATE,(getElement("OFF ON",value," "))

; interface for FCOUNTER
#interface setOnCounter FCNT STATE,(getElement("OFF ON",value," "))
#interface setCounterFreqRef FCNT REFQ,(value)
#interface setCounterTrigLvl FCNT TRG,(value)
#interface setCounterMode FCNT MODE,(value)
#interface setCounterHfRej FCNT HFR,(value)

; *********************************************************
; ********     S E T U P  D E F I N I T I O N S    ********
; *********************************************************

; *********************************************************
; ********     WARNING:                            ********
; ********     This device will not block local    ********
; ********     control when using remote access.   ********
; ********     Changes done on the device will not ********
; ********     always be seen in the setup window. ********
; ********     USE: #SYNCPOPUPS                    ********
; ********     in a script to update Setup items   ********
; *********************************************************

; ********   B A S I C  W A V E   C H A N N E L 1  ********

#cmdSetup color _ Channel_1
(0,200,0)

#cmdSetup buttonsOn State Channel_1
:read: C1:OUTP?
:readmath: getMatch(value,"(ON)|(OFF)")
:write: C1:OUTP STATE,#
:update: CH1_Output_State
:color: (240,60,0)
:string:
CH1_Output_Off OFF
CH1_Output_On ON

#cmdSetup comboboxHot Waveform Channel_1
; NOTE: changing wave type can auto disable modulation/sweep/burst on device
:read: C1:BSWV?
:readmath: getElement(value,1,",")
:write: C1:BSWV WVTP,#
:update: Wave_selector Modulation_State Sweep_State Burst_State Harmonics_State
:updatedelayed: 0.1
:tip: Select base waveform; will be carrier for modulation
Sine SINE
Square SQUARE
Ramp RAMP
Pulse PULSE
Noise NOISE
Arbitrary ARB
DC DC

#cmdSetup radio Load_Impedance Channel_1
:read: C1:OUTP?
:readmath: getElement(getMatch(value,"LOAD,[^,]*(,|$)"),1,",")
:write: C1:OUTP LOAD,#
:update: User_Defined_Z P-P_Amplitude RMS_Amplitude dBm_Amplitude Offset High_Level Low_Level
:tip: Expected load for correct display of amplitude
:string:
High_Z HZ
50_Ω 50
User_Defined_Z 100000

#cmdSetup number User_Defined_Z Channel_1
:read: C1:OUTP?
:readmath: getElement(getMatch(value,"LOAD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:OUTP LOAD,#
:update: P-P_Amplitude RMS_Amplitude dBm_Amplitude Offset High_Level Low_Level
:enable: Channel_1.Load_Impedance=="100000"
:tip: Manual setting of the actual load impedance
Ω 50 100k

#cmdSetup selector Wave_selector Channel_1
:read: C1:BSWV?
:readmath: getElement(value,1,",")
:updatedelayed: 0.2
SINE Channel_1.Offset Channel_1.Frequency Channel_1.Period Channel_1.P-P_Amplitude Channel_1.High_Level Channel_1.Low_Level Channel_1.RMS_Amplitude Channel_1.dBm_Amplitude Channel_1.Phase
SQUARE Channel_1.Offset Channel_1.Frequency_ Channel_1.Period_ Channel_1.P-P_Amplitude Channel_1.High_Level Channel_1.Low_Level Channel_1.RMS_Amplitude Channel_1.dBm_Amplitude Channel_1.Phase Channel_1.Duty_cycle
RAMP Channel_1.Offset Channel_1.Frequency__ Channel_1.P-P_Amplitude Channel_1.High_Level Channel_1.Low_Level Channel_1.RMS_Amplitude Channel_1.dBm_Amplitude Channel_1.Phase Channel_1.Symmetry
PULSE Channel_1.Offset Channel_1.Frequency Channel_1.Period Channel_1.P-P_Amplitude Channel_1.High_Level Channel_1.Low_Level Channel_1.RMS_Amplitude Channel_1.Duty_cycle Channel_1.Pulse_Width Channel_1.Pulse_Rise Channel_1.Pulse_Fall
NOISE Channel_1.Standard_Deviation Channel_1.Mean Channel_1.Bandwidth_Limit Channel_1.Noise_Bandwidth
ARB Channel_1.Offset Channel_1.Frequency___ Channel_1.P-P_Amplitude Channel_1.High_Level Channel_1.Low_Level Channel_1.Phase Channel_1.Arbitrary_Index Channel_1.Arbitrary_Name Channel_1.Arbitrary_Type Channel_1.Symbol_Rate
DC Channel_1.Offset

; Sine
#cmdSetup number Frequency Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV FRQ,#
:update: Period Sweep_Start Sweep_Stop Harmonics_Selector Frequency_ Period_ Sweep_Start_ Sweep_Stop_ Harmonics_Selector_
:tip: Frequency of base sine waveform; period will be updated
Hz 1u MaxSineFreq

; Sine
#cmdSetup number Period Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"PERI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV PERI,#
:update: Frequency Sweep_Start Sweep_Stop Harmonics_Selector Frequency__ Period__ Sweep_Start_ Sweep_Stop_ Harmonics_Selector_
:tip: Period of base sine waveform; frequency will be updated
s MinSinePeriod 1M

; Square
#cmdSetup number Frequency_ Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV FRQ,#
:update: Period_ Sweep_Start Sweep_Stop Frequency__ Period__ Sweep_Start_ Sweep_Stop_ Harmonics_Selector_
:tip: Frequency of base square waveform; period will be updated
Hz 1u MaxSquareFreq

; Square
#cmdSetup number Period_ Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"PERI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV PERI,#
:update: Frequency_ Sweep_Start Sweep_Stop Frequency__ Period__ Sweep_Start_ Sweep_Stop_ Harmonics_Selector_
:tip: Period of base square waveform; frequency will be updated
s MinSquarePeriod 1M

; Ramp
#cmdSetup number Frequency__ Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV FRQ,#
:update: Period Sweep_Start Sweep_Stop Frequency_ Period_ Sweep_Start_ Sweep_Stop_
:tip: Frequency of Ramp waveform
Hz 1u MaxRampFreq

; ARB
#cmdSetup number Frequency___ Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV FRQ,#
:update: Symbol_Rate Sweep_Start Sweep_Stop Symbol_Rate_ Sweep_Start_ Sweep_Stop_
:tip: Frequency of Arbitrary waveform
Hz 1u MaxArbFreq

#cmdSetup number P-P_Amplitude Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"AMP,[0-9.]+V,"),1,",")
:readformat: u
:write: C1:BSWV AMP,#
:update: High_Level Low_Level RMS_Amplitude dBm_Amplitude Harmonics_Selector High_Level_ Low_Level_ RMS_Amplitude_ dBm_Amplitude_ Harmonics_Selector_
:tip: Amplitude + offset must be within ±10V. Limits depend on load Z
Vpp 1m 20

#cmdSetup number RMS_Amplitude Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"AMPVRMS,[0-9.]+Vrms,"),1,",")
:readformat: u
:write: C1:BSWV AMPVRMS,#
:update: High_Level Low_Level P-P_Amplitude dBm_Amplitude High_Level_ Low_Level_ P-P_Amplitude_ dBm_Amplitude_
:tip: RMS equivalent of Vpp: Vpp will be updated
Vrms 0.3m 7.1

#cmdSetup number dBm_Amplitude Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"AMPDBM,-?[0-9.]+dBm,"),1,",")
:readformat: u
:write: C1:BSWV AMPDBM,#
:update: High_Level Low_Level P-P_Amplitude RMS_Amplitude High_Level_ Low_Level_ P-P_Amplitude_ dBm_Amplitude_
:enable: Channel_1.Load_Impedance!="HZ"
:tip: dBc equivalent of Vpp: Vpp & Vrms will be updated; not available in High_Z mode
dBm -84 24

#cmdSetup number Offset Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"OFST,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV OFST,#
:update: High_Level Low_Level
:tip: Amplitude + Offset must be within ±10V. Limits depend on load Z
Vdc -10 10

#cmdSetup number High_Level Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"HLEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV HLEV,#
:update: P-P_Amplitude RMS_Amplitude Offset
:tip: Must be > Low Level. Limits depend on load Z.
V -10 10

#cmdSetup number Low_Level Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"LLEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV LLEV,#
:update: P-P_Amplitude RMS_Amplitude Offset
:tip: Must be < High Level. Limits depend on load Z.
V -10 10

#cmdSetup number Phase Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"PHSE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV PHSE,#
:update: Burst_Start_Phase Burst_Start_Phase_ Phase_ Burst_Start_Phase_ Burst_Start_Phase__
:tip: Start Phase of CH1 only in Phase-Locked mode
° 0 360

#cmdSetup number Duty_cycle Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"DUTY,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV DUTY,#
:tip: Limited by frequency setting
% 1m 99.999

#cmdSetup number Symmetry Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"SYM,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV SYM,#
:tip: Symmetry of up-Ramp and down-Ramp
% 0 100

#cmdSetup number Pulse_Width Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"WIDTH,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV WIDTH,#
:tip: from 50% rising to 50% falling edge; width depends on frequency
s MinPulseWidth 1M

#cmdSetup number Pulse_Rise Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"RISE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV RISE,#
:tip: 10% ~ 90%, 1 Vpp, 50Ω Load; subject to pulse width limits
s MinPulseRiseFall MaxPulseRiseFall

#cmdSetup number Pulse_Fall Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"FALL,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV FALL,#
:tip: 10% ~ 90%, 1 Vpp, 50Ω Load; subject to pulse width limits
s MinPulseRiseFall MaxPulseRiseFall

#cmdSetup numberInt Arbitrary_Index Channel_1
:read: C1:ARWV?
:readmath: getElement(value,1,",")
:write: C1:ARWV INDEX,#
:update: Arbitrary_Name
:tip: Enter sequence number of internally stored waveform
_ 0 196

#cmdSetup info Arbitrary_Name Channel_1
:read: C1:ARWV?
:readmath: getElement(getMatch(value,"NAME,[^,]*(,|$)"),1,",")
_

#cmdSetup radio Arbitrary_Type Channel_1
:read: C1:SRATE?
:readmath: getElement(getMatch(value,"MODE,[^,]*(,|$)"),1,",")
:write: C1:SRATE MODE,#
:update: Symbol_Rate Frequency___
:string:
DDS DDS
TrueARB TARB

#cmdSetup number Symbol_Rate Channel_1
:read: C1:SRATE?
:readmath: getMatchGroup(value,"VALUE,(.*?)Sa/s",1)
:write: C1:SRATE VALUE,#
:update: Frequency___
:enable: Channel_1.Arbitrary_Type=="TARB"
:tip: Sets Symbol Rate of ARB data
Sa/s 1u MaxArbSrate

#cmdSetup number Standard_Deviation Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"STDEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV STDEV,#
:tip: Stdev + Mean must be within ±10V. Limits depend on load Z.
V 2m 10

#cmdSetup number Mean Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"MEAN,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV MEAN,#
:tip: Stdev + Mean must be within ±10V. Limits depend on load Z.
V -10 10

#cmdSetup radio Bandwidth_Limit Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"BANDSTATE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV BANDSTATE,#
:update: Noise_Bandwidth
:tip: Enables bandwidth limit setting
:string:
Off OFF
On ON

#cmdSetup number Noise_Bandwidth Channel_1
:read: C1:BSWV?
:readmath: getElement(getMatch(value,"BANDWIDTH,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BSWV BANDWIDTH,#
:enable: Channel_1.Bandwidth_Limit == "ON"
:tip: Bandwidth limiting frequency
Hz 20M MaxSineFreq

#cmdSetup checkbox CH1_Output Channel_1
:read: C1:OUTP?
:readmath: getElement(getMatch(value,"PLRT,[^,]*(,|$)"),1,",")
:write: C1:OUTP PLRT,
:tip: Output Polarity
:string:
Polarity_Invert NOR INVT

#cmdSetup checkbox CH1_Output Channel_1
:read: C1:CMBN?
:readmath: getElement(value,1," ")
:write: C1:CMBN
:update: High_Level Low_Level P-P_Amplitude Offset
:tip: Add CH2 to CH1; CH2 is unchanged
:string:
Add_CH2_to_CH1 OFF ON


; ********   M O D U L A T I O N  C H A N N E L 1  ********

; MDWV? device basic response: C1:MDWV STATE,ON,[modulation type], [modulation based parameters]
; or						   C1:MDWV STATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value

#cmdSetup buttonsOn Modulation_State Channel_1
:read: C1:MDWV?
:readmath: getElement(value,1,",")
:write: C1:MDWV STATE,#
:update: Modulation_Settings_visible_in_On_State State
:enable: Channel_1.Waveform!="DC"
:color: (240,60,0)
:string:
CH1_Modulation_Off OFF
CH1_Modulation_On ON

#cmdSetup selector Modulation_Settings_visible_in_On_State Channel_1
; selector name will be displayed in OFF state
:read: C1:MDWV?
:readmath: getElement(value,1,",")=="OFF" ? "OFF" : getElement(value,2,",")
:updatedelayed: 0.2
OFF
AM Channel_1.Modulation_Type Channel_1.AM_Source Channel_1.AM_Frequency Channel_1.AM_Mod_Wave Channel_1.AM_Mod_depth
DSBAM Channel_1.Modulation_Type Channel_1.DSBAM_Source Channel_1.DSBAM_Frequency Channel_1.DSBAM_Mod_Wave
FM Channel_1.Modulation_Type Channel_1.FM_Source Channel_1.FM_Frequency Channel_1.FM_Mod_Wave Channel_1.FM_Frequency_deviation
PM Channel_1.Modulation_Type Channel_1.PM_Source Channel_1.PM_Frequency Channel_1.PM_Mod_Wave Channel_1.PM_Phase_deviation
PWM Channel_1.Modulation_Type Channel_1.PWM_Source Channel_1.PWM_Frequency Channel_1.PWM_Mod_Wave Channel_1.PWM_Duty_deviation
ASK Channel_1.Modulation_Type Channel_1.ASK_Source Channel_1.ASK_Key_Freq
FSK Channel_1.Modulation_Type Channel_1.FSK_Source Channel_1.FSK_Key_Freq Channel_1.FSK_Hop_Freq
PSK Channel_1.Modulation_Type Channel_1.PSK_Source Channel_1.PSK_Key_Freq

#cmdSetup comboboxhot Modulation_Type Channel_1
:read: C1:MDWV?
:readmath: getElement(value,2,",")
:write: C1:MDWV #
:update: Modulation_Settings_visible_in_On_State
:updatedelayed: 0.2
:tip: PWM requires Output 1 Waveform to be Pulse
Amplitude AM
Dual_Sideband_Amplitude DSBAM
Frequency FM
Phase PM
Pulse_Width PWM
Amplitude_Shift_Keying ASK
Frequency_Shift_Keying FSK
Phase_Shift_Keying PSK

; ********   AM modulation

#cmdSetup radio AM_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV AM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number AM_Frequency Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV AM,FRQ,#
:enable: Channel_1.AM_Source=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox AM_Mod_Wave Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV AM,MDSP,#
:enable: Channel_1.AM_Source=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number AM_Mod_depth Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"DEPTH,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV AM,DEPTH,#
:enable: Channel_1.AM_Source=="INT"
:tip: Depth of modulating signal on carrier
% 0 120

; ********   DSBAM modulation

#cmdSetup radio DSBAM_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV DSBAM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number DSBAM_Frequency Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV DSBAM,FRQ,#
:enable: Channel_1.DSBAM_Source=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox DSBAM_Mod_Wave Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV DSBAM,MDSP,#
:enable: Channel_1.DSBAM_Source=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

; ********   FM modulation

#cmdSetup radio FM_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number FM_Frequency Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FM,FRQ,#
:enable: Channel_1.FM_Source=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox FM_Mod_Wave Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FM,MDSP,#
:enable: Channel_1.FM_Source=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number FM_Frequency_deviation Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"DEVI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FM,DEVI,#
:enable: Channel_1.FM_Source=="INT"
:tip: Frequency deviation can be set from 0 to 50% of carrier frequency
% 0 MaxSineFreq

; ********   PM modulation

#cmdSetup radio PM_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number PM_Frequency Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PM,FRQ,#
:enable: Channel_1.PM_Source=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox PM_Mod_Wave Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PM,MDSP,#
:enable: Channel_1.PM_Source=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number PM_Phase_deviation Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"DEVI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PM,DEVI,#
:enable: Channel_1.PM_Source=="INT"
:tip: Phase deviation can be set from 0 to 360 degree
% 0 360

; ********   PWM modulation (only for pulse carrier)

#cmdSetup radio PWM_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PWM,SRC,#
:update: Waveform
:string:
Internal INT
External EXT

#cmdSetup number PWM_Frequency Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PWM,FRQ,#
:enable: Channel_1.PWM_Source=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox PWM_Mod_Wave Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PWM,MDSP,#
:enable: Channel_1.PWM_Source=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number PWM_Duty_deviation Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"DEVI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PWM,DEVI,#
:enable: Channel_1.PWM_Source=="INT"
:tip: Duty-cycle value deviation depends on the carrier duty cycle
% 0 100

; ********   ASK modulation

#cmdSetup radio ASK_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV ASK,SRC,#
:tip: Ext modulation must be square with CMOS levels
:string:
Internal INT
External EXT

#cmdSetup number ASK_Key_Freq Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"KFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV ASK,KFRQ,#
:enable: Channel_1.ASK_Source=="INT"
:tip: This sets the internal modulation of the carrier frequency
Hz 1m 1M

; ********   FSK modulation

#cmdSetup radio FSK_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FSK,SRC,#
:tip: Ext modulation must be square with CMOS levels
:string:
Internal INT
External EXT

#cmdSetup number FSK_Key_Freq Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"KFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FSK,KFRQ,#
:enable: Channel_1.FSK_Source=="INT"
:tip: This sets the internal modulation of the carrier frequency
Hz 1m 1M

#cmdSetup number FSK_Hop_Freq Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"HFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV FSK,HFRQ,#
:enable: Channel_1.FSK_Source=="INT"
:tip: Aka space freq (0); must be < max carrier frequency
Hz 1m MaxSineFreq

; ********   PSK modulation

#cmdSetup radio PSK_Source Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PSK,SRC,#
:tip: Ext modulation must be square with CMOS levels
:string:
Internal INT
External EXT

#cmdSetup number PSK_Key_Freq Channel_1
:read: C1:MDWV?
:readmath: getElement(getMatch(value,"KFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:MDWV PSK,KFRQ,#
:enable: Channel_1.PSK_Source=="INT"
:tip: This sets the internal modulation of the carrier frequency
Hz 1m 1M


; ********   S W E E P  W A V E  C H A N N E L 1   ********

; SWWV? device basic response: C1:SWWV STATE,ON, [sweep based parameters]
; or						   C1:SWWV STATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value

#cmdSetup buttonsOn Sweep_State Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:write: C1:SWWV STATE,#
:update: Sweep_Settings_visible_in_On_State State
:enable: inList(Channel_1.Waveform,"SINE SQUARE RAMP ARB")
:color: (240,60,0)
:string:
CH1_Sweep_Off OFF
CH1_Sweep_On ON

#cmdSetup selector Sweep_Settings_visible_in_On_State Channel_1
; selector name will be displayed in OFF state
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:updatedelayed: 0.2
OFF
ON Channel_1.Sweep_Time Channel_1.Sweep_Start Channel_1.Sweep_Stop Channel_1.Sweep_Mode Channel_1.Sweep_Direction Channel_1.Sweep_Trigger Channel_1.Sweep_Trigger_Edge Channel_1.Sweep_Trigger_Out Channel_1.Manual_Sweep_Trigger Channel_1.Sweep_Marker Channel_1.Sweep_Marker_Freq

#cmdSetup number Sweep_Time Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"TIME,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV TIME,#
:tip: Duration to sweep from start frequency to stop frequency
s 1m 500

#cmdSetup number Sweep_Start Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"START,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV START,#
:update: Frequency Period
:tip: Lowest frequency of sweep freq. span; frequency = center freq.
Hz 1u MaxSineFreq

#cmdSetup number Sweep_Stop Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"STOP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV STOP,#
:update: Frequency Period
:tip: Highest frequency of sweep freq. span; frequency = center freq.
Hz 1u MaxSineFreq

#cmdSetup radio Sweep_Marker Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"MARK_STATE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV MARK\_STATE,#
:string:
Off OFF
On ON

#cmdSetup number Sweep_Marker_Freq Channel_1
; :enable: Channel_1.Sweep_Marker=="ON"
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"MARK_FREQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV MARK\_FREQ,#
:tip: The range is from the start frequency to the stop frequency
Hz 1u MaxSineFreq

#cmdSetup radio Sweep_Mode Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"SWMD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV SWMD,#
:string:
Linear LINE
Logarithmic LOG

#cmdSetup radio Sweep_Direction Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"DIR,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV DIR,#
:string:
Up UP
Down DOWN

#cmdSetup radio Sweep_Trigger Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"TRSR,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV TRSR,#
:update: Sweep_Trigger_Edge Sweep_Trigger_Out
:string:
Internal INT
External EXT
Manual MAN

#cmdSetup radio Sweep_Trigger_Edge Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"EDGE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV EDGE,#
:enable: Channel_1.Sweep_Trigger!="INT"
:string:
Rising RISE
Falling FALL

#cmdSetup checkbox Sweep_Trigger_Out Channel_1
:read: C1:SWWV?
:readmath: getElement(getMatch(value,"TRMD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:SWWV TRMD,#
:enable: Channel_1.Sweep_Trigger!="EXT"
:string:
Rear_Panel_[Aux_In/Out] OFF ON

#cmdSetup button Manual_Sweep_Trigger Channel_1
:write: C1:SWWV MTRIG
:enable: Channel_1.Sweep_Trigger=="MAN"


; ********       S I N E   H A R M O N I C S       ********

; HARM? device basic response: C1:HARM HARMSTATE,ON,[sine harmonics parameters]
; or						   C1:HARM HARMSTATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value

#cmdSetup buttonsOn Harmonics_State Channel_1
:read: C1:HARM?
:readmath: getElement(getMatch(value,"HARMSTATE,[^,]*(,|$)"),1,",")
:write: C1:HARM HARMSTATE,#
:update: Harmonics_Settings_visible_in_On_State State
:enable: Channel_1.Waveform=="SINE"
:color: (240,60,0)
:string:
CH1_Harmonics_Off OFF
CH1_Harmonics_On ON

#cmdSetup selector Harmonics_Settings_visible_in_On_State Channel_1
; selector name will be displayed in OFF state
:read: C1:HARM?
:readmath: getElement(getMatch(value,"HARMSTATE,[^,]*(,|$)"),1,",")
OFF
ON Channel_1.Harmonics_Type Channel_1.Harmonics_Selector

#cmdSetup radio Harmonics_Type Channel_1
:read: C1:HARM?
:readmath: getElement(getMatch(value,"HARMTYPE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:HARM HARMTYPE,#
:update: Harmonics_Selector
:tip: Range 2 to max 16, while highest harmonic frequency < MaxSineFreq
:string:
Even EVEN
Odd ODD
All ALL

#cmdSetup selector Harmonics_Selector Channel_1
:read: C1:HARM?
:readmath: getElement(getMatch(value,"HARMTYPE,[^,]*(,|$)"),1,",")
:readformat: u
EVEN Channel_1.Harmonics_Order_2 Channel_1.Harmonics_Order_4 Channel_1.Harmonics_Order_6 Channel_1.Harmonics_Order_8 Channel_1.Harmonics_Order_10 Channel_1.Harmonics_Order_12 Channel_1.Harmonics_Order_14 Channel_1.Harmonics_Order_16
ODD Channel_1.Harmonics_Order_3 Channel_1.Harmonics_Order_5 Channel_1.Harmonics_Order_7 Channel_1.Harmonics_Order_9 Channel_1.Harmonics_Order_11 Channel_1.Harmonics_Order_13 Channel_1.Harmonics_Order_15
ALL Channel_1.Harmonics_Order_2 Channel_1.Harmonics_Order_3 Channel_1.Harmonics_Order_4 Channel_1.Harmonics_Order_5 Channel_1.Harmonics_Order_6 Channel_1.Harmonics_Order_7 Channel_1.Harmonics_Order_8 Channel_1.Harmonics_Order_9 Channel_1.Harmonics_Order_10 Channel_1.Harmonics_Order_11 Channel_1.Harmonics_Order_12 Channel_1.Harmonics_Order_13 Channel_1.Harmonics_Order_14 Channel_1.Harmonics_Order_15 Channel_1.Harmonics_Order_16

#cmdSetup multi Harmonics_Order_2 Channel_1
:read: C1:HARM HARMORDER,2; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,2,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_3 Channel_1
:read: C1:HARM HARMORDER,3; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,3,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_4 Channel_1
:read: C1:HARM HARMORDER,4; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,4,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_5 Channel_1
:read: C1:HARM HARMORDER,5; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,5,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_6 Channel_1
:read: C1:HARM HARMORDER,6; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,6,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_7 Channel_1
:read: C1:HARM HARMORDER,7; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,7,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_8 Channel_1
:read: C1:HARM HARMORDER,8; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,8,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_9 Channel_1
:read: C1:HARM HARMORDER,9; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,9,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_10 Channel_1
:read: C1:HARM HARMORDER,10; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,10,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_11 Channel_1
:read: C1:HARM HARMORDER,11; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,11,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_12 Channel_1
:read: C1:HARM HARMORDER,12; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,12,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_13 Channel_1
:read: C1:HARM HARMORDER,13; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,13,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_14 Channel_1
:read: C1:HARM HARMORDER,14; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,14,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_15 Channel_1
:read: C1:HARM HARMORDER,15; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,15,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_16 Channel_1
:read: C1:HARM HARMORDER,16; C1:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C1:HARM HARMORDER,16,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp


; ********   B U R S T  W A V E  C H A N N E L 1   ********

; BTWV? device basic response: C1:BTWV STATE,ON, [burst based parameters]
; or						   C1:BTWV STATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value
; LIMITATION: Using noise as carrier has been switch off due to complexity of setup

#cmdSetup buttonsOn Burst_State Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:write: C1:BTWV STATE,#
:update: Burst_Settings_visible_in_On_State
:enable: inList(Channel_1.Waveform,"SINE SQUARE RAMP PULS ARB")
:color: (240,60,0)
:string:
CH1_Burst_Off OFF
CH1_Burst_On ON

#cmdSetup selector Burst_Settings_visible_in_On_State Channel_1
; selector name will be displayed in OFF state
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
OFF
ON Channel_1.Burst_Type Channel_1.Burst_Type_Selector

#cmdSetup radio Burst_Type Channel_1
; we have to set trigger edge to get this parameter in the read response
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"GATE_NCYC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV GATE\_NCYC,#; C1:BTWV EDGE,RISE
:update: Burst_Type_Selector
:string:
N_Cycles NCYC
Gated GATE

#cmdSetup selector Burst_Type_Selector Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"GATE_NCYC,[^,]*(,|$)"),1,",")
NCYC Channel_1.Burst_Start_Phase Channel_1.Burst_Cycle Channel_1.Burst_Cycle_Number Channel_1.Burst_Period Channel_1.Burst_Trigger Channel_1.Burst_Delay Channel_1.Burst_Trigger_Edge Channel_1.Burst_Trigger_Out Channel_1.Manual_Burst_Trigger
GATE Channel_1.Burst_Start_Phase_ Channel_1.Burst_Gate_Polarity Channel_1.Burst_Period_ Channel_1.Burst_Trigger_

; ********   N-Cycle Burst

#cmdSetup number Burst_Start_Phase Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"STPS,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV STPS,#
:update: Phase
:tip: Start Phase of CH1 only in Phase-Locked mode
° 0 360

#cmdSetup radio Burst_Cycle Channel_1
:read: C1:BTWV?
:readmath: match(value,".*TIME,INF.*") ? "INF" : "1"
:write: C1:BTWV TIME,#
:update: Burst_Cycle_Number Burst_Period
:enable: Channel_1.Burst_Trigger!="INT"
:string:
Burst_Period 1
Infinite_Burst INF

#cmdSetup numberInt Burst_Cycle_Number Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"TIME,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV TIME,#
:enable: Channel_1.Burst_Cycle=="1"
:tip: Number of wave cycles in Burst Period
count 1 50000

#cmdSetup number Burst_Period Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"PRD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV PRD,#
:enable: Channel_1.Burst_Cycle=="1" && Channel_1.Burst_Trigger=="INT"
:tip: Burst Period ≥ 0.99μs + carrier period × burst number
s 1u 1M

#cmdSetup number Burst_Delay Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"DLAY,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV DLAY,#
:tip: Wait time before burst in burst cycle period
s 0 1000

#cmdSetup radio Burst_Trigger Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"TRSR,[^,]*(,|$)"),1,","))
:readformat: u
:write: C1:BTWV TRSR,#
:update: Burst_Period Burst_Trigger_Edge Burst_Trigger_Out Burst_Cycle_Number
:string:
Internal INT
External EXT
Manual MAN

#cmdSetup radio Burst_Trigger_Edge Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"EDGE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV EDGE,#
:enable: Channel_1.Burst_Trigger=="EXT"
:string:
On_Rising_Edge RISE
On_Falling_Edge FALL

#cmdSetup radio Burst_Trigger_Out Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"TRMD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV TRMD,#
:enable: Channel_1.Burst_Trigger!="EXT"
:string:
As_Rising_Edge RISE
As_Falling_Edge FALL
Off OFF

#cmdSetup button Manual_Burst_Trigger Channel_1
:write: C1:BTWV MTRIG
:enable: Channel_1.Burst_Trigger=="MAN"

; ********   Gated Burst

#cmdSetup number Burst_Start_Phase_ Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"STPS,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV STPS,#
:update: Phase
:tip: Start Phase of CH1 only in Phase-Locked mode
° 0 360

#cmdSetup radio Burst_Gate_Polarity Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"PLRT,[^,]*(,|$)"),1,","))
:readformat: u
:write: C1:BTWV PLRT,#
:enable: Channel_1.Burst_Trigger_=="EXT"
:string:
On_Rising_Edge POS
On_Falling_Edge NEG

#cmdSetup number Burst_Period_ Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"PRD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C1:BTWV PRD,#
:enable: Channel_1.Burst_Trigger_=="INT"
:tip: Burst Period ≥ 0.99μs + carrier period × burst number
s 1u 1M

#cmdSetup radio Burst_Trigger_ Channel_1
:read: C1:BTWV?
:readmath: getElement(getMatch(value,"TRSR,[^,]*(,|$)"),1,","))
:readformat: u
:write: C1:BTWV TRSR,#
:update: Burst_Period_
:string:
Internal INT
External EXT


; ********   B A S I C  W A V E   C H A N N E L 2  ********

#cmdSetup color _ Channel_2
(230,230,30)

#cmdSetup buttonsOn State_ Channel_2
:read: C2:OUTP?
:readmath: getMatch(value,"(ON)|(OFF)")
:write: C2:OUTP STATE,#
:update: CH2_Output_State_
:color: (240,60,0)
:string:
CH2_Output_Off OFF
CH2_Output_On ON

#cmdSetup comboboxHot Waveform_ Channel_2
; NOTE: changing wave type can auto disable modulation/sweep/burst on device
:read: C2:BSWV?
:readmath: getElement(value,1,",")
:write: C2:BSWV WVTP,#
:update: Wave_selector_ Modulation_State_ Sweep_State_ Burst_State_ Harmonics_State_
:updatedelayed: 0.1
:tip: Select base waveform; will be carrier for modulation
Sine SINE
Square SQUARE
Ramp RAMP
Pulse PULSE
Noise NOISE
Arbitrary ARB
DC DC

#cmdSetup radio Load_Impedance_ Channel_2
:read: C2:OUTP?
:readmath: getElement(getMatch(value,"LOAD,[^,]*(,|$)"),1,",")
:write: C2:OUTP LOAD,#
:update: User_Defined_Z_ P-P_Amplitude_ RMS_Amplitude_ dBm_Amplitude_ Offset_ High_Level_ Low_Level_
:tip: Expected load for correct display of amplitude
:string:
High_Z HZ
50_Ω 50
User_Defined_Z 100000

#cmdSetup number User_Defined_Z_ Channel_2
:read: C2:OUTP?
:readmath: getElement(getMatch(value,"LOAD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:OUTP LOAD,#
:update: P-P_Amplitude_ RMS_Amplitude_ dBm_Amplitude_ Offset_ High_Level_ Low_Level_
:enable: Channel_2.Load_Impedance_=="100000"
:tip: Manual setting of the actual load impedance
Ω 50 100k

#cmdSetup selector Wave_selector_ Channel_2
:read: C2:BSWV?
:readmath: getElement(value,1,",")
:updatedelayed: 0.2
SINE Channel_2.Offset_ Channel_2.Frequency_ Channel_2.Period_ Channel_2.P-P_Amplitude_ Channel_2.High_Level_ Channel_2.Low_Level_ Channel_2.RMS_Amplitude_ Channel_2.dBm_Amplitude_ Channel_2.Phase_
SQUARE Channel_2.Offset_ Channel_2.Frequency__ Channel_2.Period__ Channel_2.P-P_Amplitude_ Channel_2.High_Level_ Channel_2.Low_Level_ Channel_2.RMS_Amplitude_ Channel_2.dBm_Amplitude_ Channel_2.Phase_ Channel_2.Duty_cycle_
RAMP Channel_2.Offset_ Channel_2.Frequency___ Channel_2.P-P_Amplitude_ Channel_2.High_Level_ Channel_2.Low_Level_ Channel_2.RMS_Amplitude_ Channel_2.dBm_Amplitude_ Channel_2.Phase_ Channel_2.Symmetry_
PULSE Channel_2.Offset_ Channel_2.Frequency_ Channel_2.Period_ Channel_2.P-P_Amplitude_ Channel_2.High_Level_ Channel_2.Low_Level_ Channel_2.RMS_Amplitude_ Channel_2.Duty_cycle_ Channel_2.Pulse_Width_ Channel_2.Pulse_Rise_ Channel_2.Pulse_Fall_
NOISE Channel_2.Standard_Deviation_ Channel_2.Mean_ Channel_2.Bandwidth_Limit_ Channel_2.Noise_Bandwidth_
ARB Channel_2.Offset_ Channel_2.Frequency____ Channel_2.P-P_Amplitude_ Channel_2.High_Level_ Channel_2.Low_Level_ Channel_2.Phase_ Channel_2.Arbitrary_Index_ Channel_2.Arbitrary_Name_ Channel_2.Arbitrary_Type_ Channel_2.Symbol_Rate_
DC Channel_2.Offset_

; Sine
#cmdSetup number Frequency_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV FRQ,#
:update: Period_ Sweep_Start_ Sweep_Stop_ Harmonics_Selector_ Frequency Period Sweep_Start Sweep_Stop Harmonics_Selector
:tip: Frequency of base sine waveform; period will be updated
Hz 1u MaxSineFreq

; Sine
#cmdSetup number Period_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"PERI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV PERI,#
:update: Frequency_ Sweep_Start_ Sweep_Stop_ Harmonics_Selector_ Frequency Period Sweep_Start Sweep_Stop Harmonics_Selector
:tip: Period of base sine waveform; frequency will be updated
s MinSinePeriod 1M

; Square
#cmdSetup number Frequency__ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV FRQ,#
:update: Period_ Sweep_Start_ Sweep_Stop_ Frequency_ Period Sweep_Start Sweep_Stop
:tip: Frequency of base square waveform; period will be updated
Hz 1u MaxSquareFreq

; Square
#cmdSetup number Period__ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"PERI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV PERI,#
:update: Frequency__ Sweep_Start_ Sweep_Stop_ Period_ Frequency_ Sweep_Start Sweep_Stop
:tip: Period of base square waveform; frequency will be updated
s MinSquarePeriod 1M

; Ramp
#cmdSetup number Frequency___ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV FRQ,#
:update: Period_ Sweep_Start_ Sweep_Stop_ Period Sweep_Start Sweep_Stop
:tip: Frequency of Ramp waveform
Hz 1u MaxRampFreq

; ARB
#cmdSetup number Frequency____ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV FRQ,#
:update: Symbol_Rate_ Sweep_Start_ Sweep_Stop_ Sweep_Start Sweep_Stop
:tip: Frequency of Arbitrary waveform
Hz 1u MaxArbFreq

#cmdSetup number P-P_Amplitude_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"AMP,[0-9.]+V,"),1,",")
:readformat: u
:write: C2:BSWV AMP,#
:update: High_Level_ Low_Level_ RMS_Amplitude_ dBm_Amplitude_ Harmonics_Selector_ High_Level Low_Level RMS_Amplitude dBm_Amplitude Harmonics_Selector
:tip: Amplitude + offset must be within ±10V. Limits depend on load Z
Vpp 1m 20

#cmdSetup number RMS_Amplitude_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"AMPVRMS,[0-9.]+Vrms,"),1,",")
:readformat: u
:write: C2:BSWV AMPVRMS,#
:update: High_Level_ Low_Level_ P-P_Amplitude_ dBm_Amplitude_ Harmonics_Selector_ High_Level Low_Level P-P_Amplitude dBm_Amplitude Harmonics_Selector
:tip: RMS equivalent of Vpp: Vpp will be updated
Vrms 0.3m 7.1

#cmdSetup number dBm_Amplitude_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"AMPDBM,-?[0-9.]+dBm,"),1,",")
:readformat: u
:write: C2:BSWV AMPDBM,#
:update: High_Level_ Low_Level_ P-P_Amplitude_ RMS_Amplitude_ Harmonics_Selector_ High_Level Low_Level P-P_Amplitude RMS_Amplitude Harmonics_Selector
:enable: Channel_2.Load_Impedance_!="HZ"
:tip: dBc equivalent of Vpp: Vpp & Vrms will be updated; not available in High_Z mode
dBm -84 24

#cmdSetup number Offset_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"OFST,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV OFST,#
:update: High_Level_ Low_Level_
:tip: Amplitude + Offset must be within ±10V. Limits depend on load Z
Vdc -10 10

#cmdSetup number High_Level_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"HLEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV HLEV,#
:update: P-P_Amplitude_ RMS_Amplitude_ Offset_
:tip: Must be > Low Level. Limits depend on load Z.
V -10 10

#cmdSetup number Low_Level_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"LLEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV LLEV,#
:update: P-P_Amplitude_ RMS_Amplitude_ Offset_
:tip: Must be < High Level. Limits depend on load Z.
V -10 10

#cmdSetup number Phase_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"PHSE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV PHSE,#
:update: Burst_Start_Phase_ Burst_Start_Phase__ Phase Burst_Start_Phase Burst_Start_Phase_
:tip: Start Phase of CH2 only in Phase-Locked mode
° 0 360

#cmdSetup number Duty_cycle_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"DUTY,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV DUTY,#
:tip: Limited by frequency setting
% 1m 99.999

#cmdSetup number Symmetry_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"SYM,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV SYM,#
:tip: Symmetry of up-Ramp and down-Ramp
% 0 100

#cmdSetup number Pulse_Width_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"WIDTH,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV WIDTH,#
:tip: from 50% rising to 50% falling edge; width depends on frequency
s MinPulseWidth 1M

#cmdSetup number Pulse_Rise_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"RISE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV RISE,#
:tip: 10% ~ 90%, 1 Vpp, 50Ω Load; subject to pulse width limits
s MinPulseRiseFall MaxPulseRiseFall

#cmdSetup number Pulse_Fall_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"FALL,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV FALL,#
:tip: 10% ~ 90%, 1 Vpp, 50Ω Load; subject to pulse width limits
s MinPulseRiseFall MaxPulseRiseFall

#cmdSetup numberInt Arbitrary_Index_ Channel_2
:read: C2:ARWV?
:readmath: getElement(value,1,",")
:write: C2:ARWV INDEX,#
:update: Arbitrary_Name_
:tip: Enter sequence number of internally stored waveform
_ 0 196

#cmdSetup info Arbitrary_Name_ Channel_2
:read: C2:ARWV?
:readmath: getElement(getMatch(value,"NAME,[^,]*(,|$)"),1,",")
_

#cmdSetup radio Arbitrary_Type_ Channel_2
:read: C2:SRATE?
:readmath: getElement(getMatch(value,"MODE,[^,]*(,|$)"),1,",")
:write: C2:SRATE MODE,#
:update: Symbol_Rate_ Frequency____
:string:
DDS DDS
TrueARB TARB

#cmdSetup number Symbol_Rate_ Channel_2
:read: C2:SRATE?
:readmath: getMatchGroup(value,"VALUE,(.*?)Sa/s",1)
:write: C2:SRATE VALUE,#
:update: Frequency____
:enable: Channel_2.Arbitrary_Type_=="TARB"
:tip: Sets Symbol Rate of ARB data
Sa/s 1u MaxArbSrate

#cmdSetup number Standard_Deviation_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"STDEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV STDEV,#
:tip: Stdev + Mean must be within ±10V. Limits depend on load Z.
V 2m 10

#cmdSetup number Mean_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"MEAN,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV MEAN,#
:tip: Stdev + Mean must be within ±10V. Limits depend on load Z.
V -10 10

#cmdSetup radio Bandwidth_Limit_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"BANDSTATE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV BANDSTATE,#
:update: Noise_Bandwidth_
:tip: Enables bandwidth limit setting
:string:
Off OFF
On ON

#cmdSetup number Noise_Bandwidth_ Channel_2
:read: C2:BSWV?
:readmath: getElement(getMatch(value,"BANDWIDTH,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BSWV BANDWIDTH,#
:enable: Channel_2.Bandwidth_Limit_ == "ON"
:tip: Bandwidth limiting frequency
Hz 20M MaxSineFreq

#cmdSetup checkbox CH2_Output_ Channel_2
:read: C2:OUTP?
:readmath: getElement(getMatch(value,"PLRT,[^,]*(,|$)"),1,",")
:write: C2:OUTP PLRT,
:tip: Output Polarity
:string:
Polarity_Invert NOR INVT

#cmdSetup checkbox CH2_Output_ Channel_2
:read: C2:CMBN?
:readmath: getElement(value,1," ")
:write: C2:CMBN
:update: High_Level_ Low_Level_ P-P_Amplitude_ Offset_
:tip: Add CH1 to CH2; CH1 is unchanged
:string:
Add_CH1_to_CH2 OFF ON


; ********   M O D U L A T I O N  C H A N N E L 2  ********

; MDWV? device basic response: C2:MDWV STATE,ON,[modulation type], [modulation based parameters]
; or						   C2:MDWV STATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value

#cmdSetup buttonsOn Modulation_State_ Channel_2
:read: C2:MDWV?
:readmath: getElement(value,1,",")
:write: C2:MDWV STATE,#
:update: Modulation_Settings_visible_in_On_State_ State_
:enable: Channel_2.Waveform_!="DC"
:color: (240,60,0)
:string:
CH2_Modulation_Off OFF
CH2_Modulation_On ON

#cmdSetup selector Modulation_Settings_visible_in_On_State_ Channel_2
; selector name will be displayed in OFF state
:read: C2:MDWV?
:readmath: getElement(value,1,",")=="OFF" ? "OFF" : getElement(value,2,",")
:updatedelayed: 0.2
OFF
AM Channel_2.Modulation_Type_ Channel_2.AM_Source_ Channel_2.AM_Frequency_ Channel_2.AM_Mod_Wave_ Channel_2.AM_Mod_depth_
DSBAM Channel_2.Modulation_Type_ Channel_2.DSBAM_Source_ Channel_2.DSBAM_Frequency_ Channel_2.DSBAM_Mod_Wave_
FM Channel_2.Modulation_Type_ Channel_2.FM_Source_ Channel_2.FM_Frequency_ Channel_2.FM_Mod_Wave_ Channel_2.FM_Frequency_deviation_
PM Channel_2.Modulation_Type_ Channel_2.PM_Source_ Channel_2.PM_Frequency_ Channel_2.PM_Mod_Wave_ Channel_2.PM_Phase_deviation_
PWM Channel_2.Modulation_Type_ Channel_2.PWM_Source_ Channel_2.PWM_Frequency_ Channel_2.PWM_Mod_Wave_ Channel_2.PWM_Duty_deviation_
ASK Channel_2.Modulation_Type_ Channel_2.ASK_Source_ Channel_2.ASK_Key_Freq_
FSK Channel_2.Modulation_Type_ Channel_2.FSK_Source_ Channel_2.FSK_Key_Freq_ Channel_2.FSK_Hop_Freq_
PSK Channel_2.Modulation_Type_ Channel_2.PSK_Source_ Channel_2.PSK_Key_Freq_

#cmdSetup comboboxhot Modulation_Type_ Channel_2
:read: C2:MDWV?
:readmath: getElement(value,2,",")
:write: C2:MDWV #
:update: Modulation_Settings_visible_in_On_State_
:updatedelayed: 0.2
:tip: PWM requires Output 1 Waveform to be Pulse
Amplitude AM
Dual_Sideband_Amplitude DSBAM
Frequency FM
Phase PM
Pulse_Width PWM
Amplitude_Shift_Keying ASK
Frequency_Shift_Keying FSK
Phase_Shift_Keying PSK

; ********   AM modulation

#cmdSetup radio AM_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV AM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number AM_Frequency_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV AM,FRQ,#
:enable: Channel_2.AM_Source_=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox AM_Mod_Wave_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV AM,MDSP,#
:enable: Channel_2.AM_Source_=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number AM_Mod_depth_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"DEPTH,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV AM,DEPTH,#
:enable: Channel_2.AM_Source_=="INT"
:tip: Depth of modulating signal on carrier
% 0 120

; ********   DSBAM modulation

#cmdSetup radio DSBAM_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV DSBAM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number DSBAM_Frequency_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV DSBAM,FRQ,#
:enable: Channel_2.DSBAM_Source_=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox DSBAM_Mod_Wave_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV DSBAM,MDSP,#
:enable: Channel_2.DSBAM_Source_=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

; ********   FM modulation

#cmdSetup radio FM_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number FM_Frequency_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FM,FRQ,#
:enable: Channel_2.FM_Source_=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox FM_Mod_Wave_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FM,MDSP,#
:enable: Channel_2.FM_Source_=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number FM_Frequency_deviation_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"DEVI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FM,DEVI,#
:enable: Channel_2.FM_Source_=="INT"
:tip: Frequency deviation can be set from 0 to 50% of carrier frequency
% 0 MaxSineFreq

; ********   PM modulation

#cmdSetup radio PM_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PM,SRC,#
:string:
Internal INT
External EXT

#cmdSetup number PM_Frequency_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PM,FRQ,#
:enable: Channel_2.PM_Source_=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox PM_Mod_Wave_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PM,MDSP,#
:enable: Channel_2.PM_Source_=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number PM_Phase_deviation_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"DEVI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PM,DEVI,#
:enable: Channel_2.PM_Source_=="INT"
:tip: Phase deviation can be set from 0 to 360 degree
% 0 360

; ********   PWM modulation (only for pulse carrier)

#cmdSetup radio PWM_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PWM,SRC,#
:update: Waveform_
:string:
Internal INT
External EXT

#cmdSetup number PWM_Frequency_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"FRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PWM,FRQ,#
:enable: Channel_2.PWM_Source_=="INT"
:tip: Only with internal source; ext +/- 6V correspond to 100%
Hz 1m 1M

#cmdSetup combobox PWM_Mod_Wave_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"MDSP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PWM,MDSP,#
:enable: Channel_2.PWM_Source_=="INT"
Sine SINE
Square SQUARE
Triangle TRIANGLE
Up_Ramp UPRAMP
Down_Ramp DNRAMP
Noise NOISE
Arbitrary ARB

#cmdSetup number PWM_Duty_deviation_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"DEVI,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PWM,DEVI,#
:enable: Channel_2.PWM_Source_=="INT"
:tip: Duty-cycle value deviation depends on the carrier duty cycle
% 0 100

; ********   ASK modulation

#cmdSetup radio ASK_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV ASK,SRC,#
:tip: Ext modulation must be square with CMOS levels
:string:
Internal INT
External EXT

#cmdSetup number ASK_Key_Freq_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"KFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV ASK,KFRQ,#
:enable: Channel_2.ASK_Source_=="INT"
:tip: This sets the internal modulation of the carrier frequency
Hz 1m 1M

; ********   FSK modulation

#cmdSetup radio FSK_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FSK,SRC,#
:tip: Ext modulation must be square with CMOS levels
:string:
Internal INT
External EXT

#cmdSetup number FSK_Key_Freq_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"KFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FSK,KFRQ,#
:enable: Channel_2.FSK_Source_=="INT"
:tip: This sets the internal modulation of the carrier frequency
Hz 1m 1M

#cmdSetup number FSK_Hop_Freq_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"HFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV FSK,HFRQ,#
:enable: Channel_2.FSK_Source_=="INT"
:tip: Aka space freq (0); must be < max carrier frequency
Hz 1m MaxSineFreq

; ********   PSK modulation

#cmdSetup radio PSK_Source_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"SRC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PSK,SRC,#
:tip: Ext modulation must be square with CMOS levels
:string:
Internal INT
External EXT

#cmdSetup number PSK_Key_Freq_ Channel_2
:read: C2:MDWV?
:readmath: getElement(getMatch(value,"KFRQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:MDWV PSK,KFRQ,#
:enable: Channel_2.PSK_Source_=="INT"
:tip: This sets the internal modulation of the carrier frequency
Hz 1m 1M


; ********   S W E E P  W A V E  C H A N N E L 2   ********

; SWWV? device basic response: C2:SWWV STATE,ON, [sweep based parameters]
; or						   C2:SWWV STATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value

#cmdSetup buttonsOn Sweep_State_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:write: C2:SWWV STATE,#
:update: Sweep_Settings_visible_in_On_State_ State_
:enable: inList(Channel_2.Waveform_,"SINE SQUARE RAMP ARB")
:color: (240,60,0)
:string:
CH2_Sweep_Off OFF
CH2_Sweep_On ON

#cmdSetup selector Sweep_Settings_visible_in_On_State_ Channel_2
; selector name will be displayed in OFF state
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:updatedelayed: 0.2
OFF
ON Channel_2.Sweep_Time_ Channel_2.Sweep_Start_ Channel_2.Sweep_Stop_ Channel_2.Sweep_Mode_ Channel_2.Sweep_Direction_ Channel_2.Sweep_Trigger_ Channel_2.Sweep_Trigger_Edge_ Channel_2.Sweep_Trigger_Out_ Channel_2.Manual_Sweep_Trigger_ Channel_2.Sweep_Marker_ Channel_2.Sweep_Marker_Freq_

#cmdSetup number Sweep_Time_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"TIME,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV TIME,#
:tip: Duration to sweep from start frequency to stop frequency
s 1m 500

#cmdSetup number Sweep_Start_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"START,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV START,#
:update: Frequency_ Period_
:tip: Lowest frequency of sweep freq. span; frequency = center freq.
Hz 1u MaxSineFreq

#cmdSetup number Sweep_Stop_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"STOP,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV STOP,#
:update: Frequency_ Period_
:tip: Highest frequency of sweep freq. span; frequency = center freq.
Hz 1u MaxSineFreq

#cmdSetup radio Sweep_Marker_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"MARK_STATE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV MARK\_STATE,#
:string:
Off OFF
On ON

#cmdSetup number Sweep_Marker_Freq_ Channel_2
; :enable: Channel_2.Sweep_Marker=="ON"
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"MARK_FREQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV MARK\_FREQ,#
:tip: The range is from the start frequency to the stop frequency
Hz 1u MaxSineFreq

#cmdSetup radio Sweep_Mode_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"SWMD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV SWMD,#
:string:
Linear LINE
Logarithmic LOG

#cmdSetup radio Sweep_Direction_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"DIR,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV DIR,#
:string:
Up UP
Down DOWN

#cmdSetup radio Sweep_Trigger_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"TRSR,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV TRSR,#
:update: Sweep_Trigger_Edge_ Sweep_Trigger_Out_
:string:
Internal INT
External EXT
Manual MAN

#cmdSetup radio Sweep_Trigger_Edge_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"EDGE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV EDGE,#
:enable: Channel_2.Sweep_Trigger_!="INT"
:string:
Rising RISE
Falling FALL

#cmdSetup checkbox Sweep_Trigger_Out_ Channel_2
:read: C2:SWWV?
:readmath: getElement(getMatch(value,"TRMD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:SWWV TRMD,#
:enable: Channel_2.Sweep_Trigger_!="EXT"
:string:
Rear_Panel_[Aux_In/Out] OFF ON

#cmdSetup button Manual_Sweep_Trigger_ Channel_2
:write: C2:SWWV MTRIG
:enable: Channel_2.Sweep_Trigger_=="MAN"


; ********       S I N E   H A R M O N I C S       ********

; HARM? device basic response: C2:HARM HARMSTATE,ON,[sine harmonics parameters]
; or						   C2:HARM HARMSTATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value

#cmdSetup buttonsOn Harmonics_State_ Channel_2
:read: C2:HARM?
:readmath: getElement(getMatch(value,"HARMSTATE,[^,]*(,|$)"),1,",")
:write: C2:HARM HARMSTATE,#
:update: Harmonics_Settings_visible_in_On_State_ State_
:enable: Channel_2.Waveform_=="SINE"
:color: (240,60,0)
:string:
CH2_Harmonics_Off OFF
CH2_Harmonics_On ON

#cmdSetup selector Harmonics_Settings_visible_in_On_State_ Channel_2
; selector name will be displayed in OFF state
:read: C2:HARM?
:readmath: getElement(getMatch(value,"HARMSTATE,[^,]*(,|$)"),1,",")
OFF
ON Channel_2.Harmonics_Type_ Channel_2.Harmonics_Selector_

#cmdSetup radio Harmonics_Type_ Channel_2
:read: C2:HARM?
:readmath: getElement(getMatch(value,"HARMTYPE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:HARM HARMTYPE,#
:update: Harmonics_Selector_
:tip: Range 2 to max 16, while highest harmonic frequency < MaxSineFreq
:string:
Even EVEN
Odd ODD
All ALL

#cmdSetup selector Harmonics_Selector_ Channel_2
:read: C2:HARM?
:readmath: getElement(getMatch(value,"HARMTYPE,[^,]*(,|$)"),1,",")
:readformat: u
EVEN Channel_2.Harmonics_Order_2_ Channel_2.Harmonics_Order_4_ Channel_2.Harmonics_Order_6_ Channel_2.Harmonics_Order_8_ Channel_2.Harmonics_Order_10_ Channel_2.Harmonics_Order_12_ Channel_2.Harmonics_Order_14_ Channel_2.Harmonics_Order_16_
ODD Channel_2.Harmonics_Order_3_ Channel_2.Harmonics_Order_5_ Channel_2.Harmonics_Order_7_ Channel_2.Harmonics_Order_9_ Channel_2.Harmonics_Order_11_ Channel_2.Harmonics_Order_13_ Channel_2.Harmonics_Order_15_
ALL Channel_2.Harmonics_Order_2_ Channel_2.Harmonics_Order_3_ Channel_2.Harmonics_Order_4_ Channel_2.Harmonics_Order_5_ Channel_2.Harmonics_Order_6_ Channel_2.Harmonics_Order_7_ Channel_2.Harmonics_Order_8_ Channel_2.Harmonics_Order_9_ Channel_2.Harmonics_Order_10_ Channel_2.Harmonics_Order_11_ Channel_2.Harmonics_Order_12_ Channel_2.Harmonics_Order_13_ Channel_2.Harmonics_Order_14_ Channel_2.Harmonics_Order_15_ Channel_2.Harmonics_Order_16_

#cmdSetup multi Harmonics_Order_2_ Channel_2
:read: C2:HARM HARMORDER,2; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,2,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_3_ Channel_2
:read: C2:HARM HARMORDER,3; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,3,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_4_ Channel_2
:read: C2:HARM HARMORDER,4; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,4,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_5_ Channel_2
:read: C2:HARM HARMORDER,5; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,5,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_6_ Channel_2
:read: C2:HARM HARMORDER,6; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,6,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_7_ Channel_2
:read: C2:HARM HARMORDER,7; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,7,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_8_ Channel_2
:read: C2:HARM HARMORDER,8; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,8,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_9_ Channel_2
:read: C2:HARM HARMORDER,9; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,9,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_10_ Channel_2
:read: C2:HARM HARMORDER,10; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,10,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_11_ Channel_2
:read: C2:HARM HARMORDER,11; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,11,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_12_ Channel_2
:read: C2:HARM HARMORDER,12; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,12,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_13_ Channel_2
:read: C2:HARM HARMORDER,13; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,13,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_14_ Channel_2
:read: C2:HARM HARMORDER,14; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,14,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_15_ Channel_2
:read: C2:HARM HARMORDER,15; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,15,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp

#cmdSetup multi Harmonics_Order_16_ Channel_2
:read: C2:HARM HARMORDER,16; C2:HARM?
:readmath: getMatchGroup(value,"HARMDBC,(.*?)dBc",1) + " " + getMatchGroup(value,"HARMPHASE,(.*?)$",1) + " " + getMatchGroup(value,"HARMAMP,(.*?)V",1)
:write: C2:HARM HARMORDER,16,HARMDBC,#,HARMPHASE,#
:tip: Harmonic amplitude in dB below base sine amplitude
number Ampl dBc -80 0
number Phase ° 0 360
info _ Vpp


; ********   B U R S T  W A V E  C H A N N E L 2   ********

; BTWV? device basic response: C2:BTWV STATE,ON, [burst based parameters]
; or						   C2:BTWV STATE,OFF

; NOTE: When you set a new value and the input reverts to the old value, you probably entered an invalid value
; LIMITATION: Using noise as carrier has been switch off due to complexity of setup

#cmdSetup buttonsOn Burst_State_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:write: C2:BTWV STATE,#
:update: Burst_Settings_visible_in_On_State_
:enable: inList(Channel_2.Waveform_,"SINE SQUARE RAMP PULS ARB")
:color: (240,60,0)
:string:
CH2_Burst_Off OFF
CH2_Burst_On ON

#cmdSetup selector Burst_Settings_visible_in_On_State_ Channel_2
; selector name will be displayed in OFF state
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
OFF
ON Channel_2.Burst_Type_ Channel_2.Burst_Type_Selector_

#cmdSetup radio Burst_Type_ Channel_2
; we have to set trigger edge to get this parameter in the read response
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"GATE_NCYC,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV GATE\_NCYC,#; C2:BTWV EDGE,RISE
:update: Burst_Type_Selector_
:string:
N_Cycles NCYC
Gated GATE

#cmdSetup selector Burst_Type_Selector_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"GATE_NCYC,[^,]*(,|$)"),1,",")
NCYC Channel_2.Burst_Start_Phase_ Channel_2.Burst_Cycle_ Channel_2.Burst_Cycle_Number_ Channel_2.Burst_Period_ Channel_2.Burst_Trigger_ Channel_2.Burst_Delay_ Channel_2.Burst_Trigger_Edge_ Channel_2.Burst_Trigger_Out_ Channel_2.Manual_Burst_Trigger_
GATE Channel_2.Burst_Start_Phase__ Channel_2.Burst_Gate_Polarity_ Channel_2.Burst_Period__ Channel_2.Burst_Trigger__

; ********   N-Cycle Burst

#cmdSetup number Burst_Start_Phase_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"STPS,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV STPS,#
:update: Phase_
:tip: Start Phase of CH2 only in Phase-Locked mode
° 0 360

#cmdSetup radio Burst_Cycle_ Channel_2
:read: C2:BTWV?
:readmath: match(value,".*TIME,INF.*") ? "INF" : "1"
:write: C2:BTWV TIME,#
:update: Burst_Cycle_Number_ Burst_Period_
:enable: Channel_2.Burst_Trigger_!="INT"
:string:
Burst_Period 1
Infinite_Burst INF

#cmdSetup numberInt Burst_Cycle_Number_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"TIME,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV TIME,#
:enable: Channel_2.Burst_Cycle_=="1"
:tip: Number of wave cycles in Burst Period
count 1 50000

#cmdSetup number Burst_Period_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"PRD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV PRD,#
:enable: Channel_2.Burst_Cycle_=="1" && Channel_2.Burst_Trigger_=="INT"
:tip: Burst Period ≥ 0.99μs + carrier period × burst number
s 1u 1M

#cmdSetup number Burst_Delay_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"DLAY,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV DLAY,#
:tip: Wait time before burst in burst cycle period
s 0 1000

#cmdSetup radio Burst_Trigger_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"TRSR,[^,]*(,|$)"),1,","))
:readformat: u
:write: C2:BTWV TRSR,#
:update: Burst_Period_ Burst_Trigger_Edge_ Burst_Trigger_Out_ Burst_Cycle_Number_
:string:
Internal INT
External EXT
Manual MAN

#cmdSetup radio Burst_Trigger_Edge_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"EDGE,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV EDGE,#
:enable: Channel_2.Burst_Trigger_=="EXT"
:string:
On_Rising_Edge RISE
On_Falling_Edge FALL

#cmdSetup radio Burst_Trigger_Out_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"TRMD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV TRMD,#
:enable: Channel_2.Burst_Trigger_!="EXT"
:string:
As_Rising_Edge RISE
As_Falling_Edge FALL
Off OFF

#cmdSetup button Manual_Burst_Trigger_ Channel_2
:write: C2:BTWV MTRIG
:enable: Channel_2.Burst_Trigger_=="MAN"

; ********   Gated Burst

#cmdSetup number Burst_Start_Phase__ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"STPS,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV STPS,#
:update: Phase_
:tip: Start Phase of CH2 only in Phase-Locked mode

° 0 360

#cmdSetup radio Burst_Gate_Polarity_ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"PLRT,[^,]*(,|$)"),1,","))
:readformat: u
:write: C2:BTWV PLRT,#
:enable: Channel_2.Burst_Trigger__=="EXT"
:string:
On_Rising_Edge POS
On_Falling_Edge NEG

#cmdSetup number Burst_Period__ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"PRD,[^,]*(,|$)"),1,",")
:readformat: u
:write: C2:BTWV PRD,#
:enable: Channel_2.Burst_Trigger__=="INT"
:tip: Burst Period ≥ 0.99μs + carrier period × burst number
s 1u 1M

#cmdSetup radio Burst_Trigger__ Channel_2
:read: C2:BTWV?
:readmath: getElement(getMatch(value,"TRSR,[^,]*(,|$)"),1,","))
:readformat: u
:write: C2:BTWV TRSR,#
:update: Burst_Period__
:string:
Internal INT
External EXT


; ********     C H A N N E L   C O U P L I N G     ********

; ********   Channel Coupling Mode

; Error with device:
; SPCI command MODE PHASE-LOCKED does not work
; SPCI command MODE INDEPENDENT however does work
; NOTE: It has been confirmed by Hexley that this will work on the SDG1032X,
; so you can enable this and comment out the VKEY solution on these devices
;#cmdSetup radio Channel_Phase_Mode Coupling
;:read: MODE?
;:readmath: getElement(value,1," ")
;:readformat: u
;:write: MODE #
;:update: Channels_Phase_Mode
;:tip: Sets phase couping state of CH1 and CH2 DDS
;:string:
;Phase_Locked PHASE-LOCKED
;Independent INDEPENDENT

#cmdsetup radio Channel_Phase_Mode Coupling
:read: MODE?
:readmath: getElement(value,1," ")=="INDEPENDENT" ? "VKEY_VALUE,4,STATE,1;[*OPC];_VKEY_VALUE,11,STATE,1;[*OPC];_VKEY_VALUE,3,STATE,1;[*OPC];VKEY_VALUE,13,STATE,1;[*OPC];_VKEY_VALUE,23,STATE,1" :  "VKEY_VALUE,4,STATE,1;[*OPC];_VKEY_VALUE,11,STATE,1;[*OPC];_VKEY_VALUE,3,STATE,1;[*OPC];VKEY_VALUE,13,STATE,1;[*OPC];_VKEY_VALUE,28,STATE,1"
:write: #
:update: Channels_Phase_Mode
:tip: Sets phase couping state of CH1 and CH2 DDS
:string:
Independent VKEY_VALUE,4,STATE,1;[*OPC];_VKEY_VALUE,11,STATE,1;[*OPC];_VKEY_VALUE,3,STATE,1;[*OPC];VKEY_VALUE,13,STATE,1;[*OPC];_VKEY_VALUE,23,STATE,1
Phase_Locked VKEY_VALUE,4,STATE,1;[*OPC];_VKEY_VALUE,11,STATE,1;[*OPC];_VKEY_VALUE,3,STATE,1;[*OPC];VKEY_VALUE,13,STATE,1;[*OPC];_VKEY_VALUE,28,STATE,1


; ********   Channel Tracking

#cmdSetup buttonsOn Channel_Tracking Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"TRACE,[^,]*(,|$)"),1,",")
:write: COUP FCOUP,OFF; [*OPC];COUP ACOUP,OFF; [*OPC]; COUP PCOUP,OFF; [*OPC]; COUP TRACE,#
:update: Coupling_disabled_while_Tracking Channel_Copy_Off Frequency_Coupling_Off Amplitude_Coupling_Off Phase_Coupling_Off
:color: (240,60,0)
:string:
CH2_Tracks_CH1_Off OFF
CH2_Tracks_CH1_On ON

; TO DO: Phase during tracking

#cmdSetup selector Coupling_disabled_while_Tracking Coupling
; selector name will be displayed in ON state
:read: COUP?
:readmath: getElement(getMatch(value,"TRACE,[^,]*(,|$)"),1,",")
ON
OFF Coupling.CH2_CH1_Coupling Coupling.Channel_Copy_Off

; ********   Channel Coupling

#cmdSetup checkbox CH2_CH1_Coupling Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"FCOUP,[^,]*(,|$)"),1,",")
:write: COUP FCOUP,#
:update: Frequency_Coupling_Off Channel_Copy_Off
:string:
Frequency OFF ON

#cmdSetup checkbox CH2_CH1_Coupling Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"ACOUP,[^,]*(,|$)"),1,",")
:write: COUP ACOUP,#
:update: Amplitude_Coupling_Off Channel_Copy_Off
:string:
Amplitude OFF ON

#cmdSetup checkbox CH2_CH1_Coupling Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"PCOUP,[^,]*(,|$)"),1,",")
:write: COUP PCOUP,#
:update: Phase_Coupling_Off Channel_Copy_Off
:string:
Phase OFF ON

#cmdSetup selector Frequency_Coupling_Off Coupling
; selector name will be displayed in OFF state
:read: COUP?
:readmath: match(value,".*FCOUP.*") ? getElement(getMatch(value,"FCOUP,[^,]*(,|$)"),1,",") : "OFF"
ON Coupling.Freq_Coupling_Type Coupling.Freq_Coupling_Deviation Coupling.Freq_Coupling_Ratio
OFF

#cmdSetup radio Freq_Coupling_Type Coupling
:read: COUP?
:readmath: match(value,".*FDEV.*") ? "COUP_FDEV,0" : "COUP_FRAT,1"
:write: #
:update: Freq_Coupling_Ratio Freq_Coupling_Deviation 
:string:
Deviation COUP_FDEV,0
Ratio COUP_FRAT,1

#cmdSetup number Freq_Coupling_Deviation Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"FDEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: COUP FDEV,#
:update: Freq_Coupling_Ratio Frequency_ Frequency__ Frequency___ Frequency____ Period_ Period__ Symbol_Rate_
:enable: Coupling.Freq_Coupling_Type=="COUP_FDEV,0"
:tip: Device will keep CH2 on CH1 + deviation
Hz_(CH2_-_CH1) -MaxSineFreq MaxSineFreq

#cmdSetup number Freq_Coupling_Ratio Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"FRAT,[^,]*(,|$)"),1,",")
:readformat: u
:write: COUP FRAT,#
:update: Freq_Coupling_Deviation Frequency_ Frequency__ Frequency___ Frequency____ Period_ Period__ Symbol_Rate_
:enable: Coupling.Freq_Coupling_Type=="COUP_FRAT,1"
:tip: Device will keep CH2 on CH1 * deviation
CH2_/_CH1 1m 1000

#cmdSetup selector Amplitude_Coupling_Off Coupling
; selector name will be displayed in OFF state
:read: COUP?
:readmath: match(value,".*ACOUP.*") ? getElement(getMatch(value,"ACOUP,[^,]*(,|$)"),1,",") : "OFF"
OFF
ON Coupling.Ampl_Coupling_Type Coupling.Ampl_Coupling_Deviation Coupling.Ampl_Coupling_Ratio

#cmdSetup radio Ampl_Coupling_Type Coupling
:read: COUP?
:readmath: match(value,".*ADEV.*") ? "COUP_ADEV,0" : "COUP_ARAT,1"
:write: #
:update: Ampl_Coupling_Ratio Ampl_Coupling_Deviation 
:string:
Deviation COUP_ADEV,0
Ratio COUP_ARAT,1

#cmdSetup number Ampl_Coupling_Deviation Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"ADEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: COUP ADEV,#
:update: Ampl_Coupling_Ratio P-P_Amplitude_ RMS_Amplitude_ dBm_Amplitude_
:enable: Coupling.Ampl_Coupling_Type=="COUP_ADEV,0"
:tip: Device will keep CH2 on CH1 + deviation
Vpp_(CH2_-_CH1) -20 20

#cmdSetup number Ampl_Coupling_Ratio Coupling
:read: COUP?
:readmath: match(value,".*ARAT.*") ? getElement(getMatch(value,"ARAT,[^,]*(,|$)"),1,",") : 1
:readformat: u
:write: COUP ARAT,#
:update: Ampl_Coupling_Deviation P-P_Amplitude_ RMS_Amplitude_ dBm_Amplitude_
:enable: Coupling.Ampl_Coupling_Type=="COUP_ARAT,1"
:tip: Device will keep CH2 on CH1 * deviation
CH2_/_CH1 1m 1000

#cmdSetup selector Phase_Coupling_Off Coupling
; selector name will be displayed in OFF state
:read: COUP?
:readmath: match(value,".*PCOUP.*") ? getElement(getMatch(value,"PCOUP,[^,]*(,|$)"),1,",") : "OFF"
ON Coupling.Phase_Coupling_Type Coupling.Phase_Coupling_Deviation Coupling.Phase_Coupling_Ratio
OFF

#cmdSetup radio Phase_Coupling_Type Coupling
:read: COUP?
:readmath: match(value,".*PDEV.*") ? "COUP_PDEV,0" : "COUP_PRAT,1"
:write: #
:update: Phase_Coupling_Ratio Phase_Coupling_Deviation 
:string:
Deviation COUP_PDEV,0
Ratio COUP_PRAT,1

#cmdSetup number Phase_Coupling_Deviation Coupling
:read: COUP?
:readmath: getElement(getMatch(value,"PDEV,[^,]*(,|$)"),1,",")
:readformat: u
:write: COUP PDEV,#
:update: Phase_Coupling_Ratio Phase_ Phase_ Burst_Start_Phase_ Burst_Start_Phase__
:enable: Coupling.Phase_Coupling_Type=="COUP_PDEV,0"
:tip: Device will keep CH2 on CH1 + deviation in Phase-Locked mode
degree_(CH2_-_CH1) -360 360

#cmdSetup number Phase_Coupling_Ratio Coupling
:read: COUP?
:readmath: match(value,".*PRAT.*") ? getElement(getMatch(value,"PRAT,[^,]*(,|$)"),1,",") : 1
:readformat: u
:write: COUP PRAT,#
:update: Phase_Coupling_Deviation Phase_ Phase_ Burst_Start_Phase_ Burst_Start_Phase__
:enable: Coupling.Phase_Coupling_Type=="COUP_PRAT,1"
:tip: Device will keep CH2 on CH1 * deviation in Phase-Locked mode
CH2_/_CH1 1m 1000

; ********   Channel Copy

#cmdSetup selector Channel_Copy_Off Coupling
; selector name will be displayed in ON state
:read: COUP?
:readmath: match(value,".*COUP,ON.*") ? "ON" : "OFF"
ON
OFF Coupling.Copy_CH1_Parameters_to_CH2 Coupling.Copy_CH2_Parameters_to_CH1

#cmdSetup button Copy_CH1_Parameters_to_CH2 Coupling
:write: PACP C2,C1
:tip: Copy all parameters from CH1 to CH2; requires initialization of Setup afterwards

#cmdSetup button Copy_CH2_Parameters_to_CH1 Coupling
:write: PACP C1,C2
:tip: Copy all parameters from CH2 to CH1; requires initialization of Setup afterwards

; ********              C O U N T E R              ********

#cmdSetup buttonsOn Back_Panel_Counter Counter
:read: FCNT?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
:write: FCNT STATE,#
:update: Freq_Counter_Settings_visible_in_On_State Counter_State
:tip: Measure frequencies between 100m/10Hz to 200/400MHz at back panel Counter port
:color: (240,60,0)
:string:
Signal_counter_Off OFF
Signal_counter_On ON

#cmdSetup selector Freq_Counter_Settings_visible_in_On_State Counter
; selector name will be displayed in OFF state
:read: FCNT?
:readmath: getElement(getMatch(value,"STATE,[^,]*(,|$)"),1,",")
OFF
ON Counter.Reference_Frequency Counter.Signal_Trigger_Level Counter.Signal_Coupling_Mode Counter.Signal_HF_Reject Counter.Get_Signal_Measurement Counter.Signal_Frequency Counter.Signal_Deviation Counter.Counter Counter.Signal_Width Counter.Signal_Duty_Cycle

#cmdSetup number Reference_Frequency Counter
:read: FCNT?
:readmath: getElement(getMatch(value,"REFQ,[^,]*(,|$)"),1,",")
:readformat: u
:write: FCNT REFQ,#
:tip: To calculate the deviation between the measured frequency and the reference frequency automatically
Hz 1u MaxSineFreq

#cmdSetup number Signal_Trigger_Level Counter
:read: FCNT?
:readmath: getElement(getMatch(value,"TRG,[^,]*(,|$)"),1,",")
:readformat: u
:write: FCNT TRG,#
:tip: Obtains the measurement readings when the input signal reaches the specified trigger level
V -3 1.5

#cmdSetup radio Signal_Coupling_Mode Counter
:read: FCNT?
:readmath: getElement(getMatch(value,"MODE,[^,]*(,|$)"),1,",")
:write: FCNT MODE,#
:tip: Sets the coupling model of the input signal to AC or DC
:string:
AC AC
DC DC

#cmdSetup radio Signal_HF_Reject Counter
:read: FCNT?
:readmath: getElement(getMatch(value,"HFR,[^,]*(,|$)"),1,",")
:write: FCNT HFR,#
:tip: Use when signal with lower than a 250kHz frequency is measured
:string:
Off OFF
On ON

#cmdSetup button Get_Signal_Measurement Counter
:update: Signal_Frequency Signal_Deviation Signal_Width Signal_Duty_Cycle

#cmdSetup info Signal_Frequency Counter
:read: FCNT?
:readmath: getMatchGroup(value,"FRQ,(.*?)HZ",1)
Hz_measured
_

#cmdSetup info Signal_Deviation Counter
:read: FCNT?
:readmath: getMatchGroup(value,"FRQDEV,(.*?)ppm",1)
ppm_from_reference
_

#cmdSetup info Signal_Width Counter
:read: FCNT?
:readmath: getMatchGroup(value,"PW,(.*?)S",1)
s
Positive

#cmdSetup info Signal_Width Counter
:read: FCNT?
:readmath: getMatchGroup(value,"NW,(.*?)S",1)
s
Negative

#cmdSetup info Signal_Duty_Cycle Counter
:read: FCNT?
:readmath: getElement(getMatch(value,"DUTY,[^,]*(,|$)"),1,",")
:readformat: u
%
_

; ********               S Y S T E M               ********

#cmdSetup radio Over-Voltage_Protection System
:read: VOLTPRT?
:write: VOLTPRT #
:tip: BE CARFULL changing this to OFF
:string:
Off OFF
On ON

#cmdSetup radio System_Clock System
:read: ROSC?
:readmath: getMatch(value,"(INT)|(EXT)")
:write: ROSC 10MOUT,OFF; ROSC #
:update: Back_Panel_[10MHz_In/Out]
:tip: External clock via Back_Panel_10MHz_In/Out
:string:
Internal INT
External EXT

#cmdSetup radio Power_on_Config System
:read: SCFG?
:readmath: getElement(value,1," ")
:write: SCFG #
:string:
Factory_Default DEFAULT
Last_Used LAST

#cmdSetup checkbox Back_Panel_[10MHz_In/Out] System
:read: ROSC?
:readmath: getElement(getMatch(value,"10MOUT,[^,]*(,|$)"),1,",")
:write: ROSC 10MOUT,#
:enable: System.System_Clock=="INT"
:string:
Output_Enabled OFF ON

#cmdSetup checkbox Number_Format System
:read: NBFM?
:readmath: getElement(getMatch(value,"PNT,[^,]*(,|$)"),1,",")
:write: NBFM PNT,#
:string:
Decimal_Point_is_Comma DOT COMMA

#cmdSetup checkbox Number_Format System
:read: NBFM?
:readmath: getElement(getMatch(value,"SEPT,[^,]*(,|$)"),1,",")
:write: NBFM SEPT,#
:string:
1000_Separator OFF SPACE

#cmdSetup checkbox Buzzer System
:read: BUZZ?
:readmath: getElement(value,1," ")
:write: BUZZ #
:string:
On OFF ON

#cmdSetup comboboxHot Screen_Saver_After System
:read: SCSV?
:readmath: replace(getElement(value,1," "),"MIN","")
:write: SCSV #
:tip: Will blank LCD screen after x time
1_minute 1
5_minutes 5
15_minutes 15
30_minutes 30
1_hour 60
2_hours 120
5_hours 300
never OFF


; ********                 I N F O                 ********

#cmdSetup info Channels_Phase_Mode
; INDEPENDENT = No DDS phase coupling CH1<>CH2 (open lock on device screen)
; PHASE-LOCKED = DDS phase coupling CH1<>CH2 (closed lock on device screen)
:read: MODE?
:readmath: getElement(value,1," ")=="INDEPENDENT" ? "CH1 & CH2 are Phase Independent" : "CH1 & CH2 are Phase Locked"
_
_

#cmdSetup indicator CH1_Output_State
:read: C1:OUTP?
OFF getMatch(value,"(ON)|(OFF)")=="OFF" blue
ON getMatch(value,"(ON)|(OFF)")=="ON" red

#cmdSetup indicator CH2_Output_State_
:read: C2:OUTP?
OFF getMatch(value,"(ON)|(OFF)")=="OFF" blue
ON getMatch(value,"(ON)|(OFF)")=="ON" red

#cmdSetup indicator Counter_State
:read: FCNT?
OFF getMatch(value,"(ON)|(OFF)")=="OFF" blue
ON getMatch(value,"(ON)|(OFF)")=="ON" red



