; TestController device configuration file for the HP 5335A Universal Counter.
; Version 1.01
; Date 03-11-2026
; Written by Gertjan Miedema,  info at miedemageluid dot nl,  Username "Gertjan" on EEVblog.

; For use with TestController, software to control and log data: https://lygte-info.dk/project/TestControllerIntro%20UK.html
; For use with a Prologix GPIB interface, or clone. (AR488!)
; Tested with AR488 and official Prologix GPIB to USB adapters.



; Some tips:
;
; - Default HP 5335A GPIB address is 03.
;   (DIP switch setting: first 5 DIP switches down (zero), last two up (one)).
;
; - The current GPIB address is shown at power on.
;
; - For most of the items in the setup menu, extra info is available in mouse-over tips.
;   Especially useful for the trigger settings!
;
; - The GATE MODE is automatically adjusted to the optimal setting.
;   (depending on the Mode and gate time)
;
; - TRIGGER SETTINGS  There are four modes for setting the trigger levels:
;     Manual, PRESET:     The trigger levels are set to 0.0V (This is the default mode).
;     Manual, ADJUSTable: Trigger levels are adjustable between +5.0V and -5.0V.
;     Auto, PRESET:       Sets the trigger level to 50% between top and bottom peaks of signal
;     Auto, ADJUSTable:   Not possible in remote mode.
;
; - For ease of use, use the default settings when possible.
;   The counter will auto-adapt its settings to optimal for each different Mode.
;
; - Shortest practical log interval is 0,3s (READ? overhead is about 200ms)
;
; - Changing the settings for the 5335A Options permanently is possible by editing this definition.
;   Edit this part: ;----set available options----
;                   0 = option not present,  1 = option present
;                   :setvar: option020=1
;                   :setvar: option030=1
;                   :setvar: option040=1
;
; - If you have a start-up problem, and use a AR488 with a slow booting Chinese Nano clone,
;   un-remark this command:
;     ; Start up delay, only needed for AR488 with slow booting Chinese Nano clones
;     #resetDelay 3.5
;
; If you find bugs, have questions or anything else, please email me at the address in the header.
;


; Known issues:
;
; A negative slew rate will be read without the minus sign.
;
; From the 5335A manual:
; When Input A has been set to 50R and Input B has not (B defaults to 1M),
; setting A and B to Common input A, will set Input B to 50R also. 
; However, after switching back to separate A and B, Input B will remain in the 50R setting.
; This is also true for Channel B's AC/DC coupling and Xl0/X1 attenuator.
;
; The INPUT B SLOPE key indicator does not correctly reflect the slope of the B channel input
; during functions where the INPUT A slope controls both channels.
;




#idString HP 5335A
#name HP 5335A
#handle HP5335A

#driver Ascii
#port GPIB

#interfaceType Counter




; Start up delay, only needed for AR488 with slow booting Chinese Nano clones
; #resetDelay 3.5


; The author statement is used for the listing in the About window.
#author Gertjan Miedema




#notes  Device configuration file for the HP 5335A Universal Counter.


- Default HP 5335A GPIB address is 03.
  (DIP switch setting: first 5 DIP switches down (zero), last two up (one)).

- The current GPIB address is shown at power on.

- For most of the items in the setup menu, extra info is available in mouse-over tips.
  Especially useful for the trigger settings!

- For more info, tips and known issues, look in the header of this configuration file (HP5335A.txt)


Configuration file version: 1.01




;---------  GPIB settings  -------------
; Used to change the standard LF end of line to CR or CRLF.
; For eol a string is used, to write control character escapes must be used, use: /r for CR and /r/n for CRLF
#eol /r/n

; The #gpibReadEol defines how the device terminates its answers, the default uses eoi. 
; Specifying "#gpibReadEol 10" would expect a LF character for terminating a answer.(13 = CR, 10 = LF)
#gpibReadEol 13

; Add a small delay after each GPIB write, this can slow down the processing for old slow devices. (in ms)
; #gpibWriteDelay 10

; Minimum time before trying to read a answer from a device in ms
; #gpibWriteReadDelay 10

; ++read_tmo_ms is controlled with #readingDelay
; This specifies the timeout value, in SECONDS, that is used by the ++read command to wait for a character
; to be transmitted while reading data from the GPIB bus. The timeout value may be set between 0 and 32 seconds.
#readingDelay 2






; ============== Start HP 5335A commands to SCPI/TestController commands translations  ==============

; There must be a line for each of the original device commands that will be used, converting it to a similar SCPI command


; -----  Commands to init & exit  -----

; Command to go remote
; [LLO] Set device in remote control mode, i.e. the user interface on the device is disabled.
#scpiCmd goRemote tx [LLO]


; Command to reset
; [CLR]   Do a "Selected Device Clear" function. Same as front panel RESET.
; IN      Initialize everything to default
; FN1     Select function Freq A (to prevent freezing when display was in remote)
#scpiCmd CLEAR tx IN FN1


; Command to init
; AT0 BT0 Set Manual adjust trigger levels to 0V (Init setting is still Trig lvl PRESET) 
; FN1    Select function Freq A
; GA0.11 Gate time 0.11 sec
; CY3    Set cycle to single
#scpiCmd INIT tx AT0 BT0 FN1 GA0.11 CY3


; Final commands to counter before breaking connection, used to restore local control
; [LOC]    Go to Local, Set device in local control mode, i.e. the user interface on the device is active. 
#scpiCmd goLocal tx [LOC]



; Command to initialize and set interface variables
#scpiCmd CACH:INIT none
:setvar: stopTime=0.0
:setvar: readCache=0.0
:setvar: functionCache=1
:setvar: gateModeCache=0
:setvar: gateTimeCache=0.11
:setvar: trigAutoCache=0
:setvar: trigPresCache=1
:setvar: trigLevACache=0.0
:setvar: trigLevBCache=0.0
:setvar: cycleModeCache=3
;----input A----
:setvar: inpaAttCache=0
:setvar: inpaImpCache=0
:setvar: inpaFiltCache=0
:setvar: inpaCoupCache=0
:setvar: inpaSlopeCache=0
:setvar: inpaCommCache=0
;----input B----
:setvar: inpbAttCache=0
:setvar: inpbImpCache=0
:setvar: inpbFiltCache=0
:setvar: inpbCoupCache=0
:setvar: inpbSlopeCache=0
;----Math----
:setvar: mathOffsCache=0
:setvar: mathOffsMeasCache=0.0

;----set available options----
; 0 = option not present,  1 = option present
:setvar: option020=1
:setvar: option030=1
:setvar: option040=1





; -----  Instrument identification   ------

; -----  Check if a HP 5335A is online  -----
; The HP 5335A does not have any *IDN? equivalent
; In the Gate Time answer string there is a "S" in the 1st position
; IN    Initialize everything to default (So it will work always)
; GA0.1 Gate time 0.1 sec (to prevent time-out when instrument is manually set to a long gate time)
; FN13  Set function Gate Time. This will give an answer even without input signal. 

#scpiCmd ID:CHK? txrx? IN GA0.1 FN13
:string: 
:readmath: substring(value,0,1);




; ===========  Mode & Measurement  ===========


; -----   Select function  ------

; Select function
; FN1  Freq A
; FN2  Time A->B
; FN4  Ratio A/B 
; FN5  Freq C 
; FN6  1/time A->B
; FN7  Pulse A
; FN8  RATIO C/A 
; FN9  Period A 
; FN10 Rise/Fall A 
; FN11 Slew A 
; FN12 Duty Cycle A 
; FN13 Gate Time
; FN14 TRIG LVL 
; FN15 VOLTS 
; FN16 PHASE A rel B 
; FN17 FREQ B 

; Set function
#scpiCmd FUNC tx FU(value)
:setvar: functionCache=inputValue


; Query function (from cache)
#scpiCmd FUNC? none?
:readmath: functionCache



; -----  data read out  -----

; A programmed Gate Time is used up to 1,5sec
; For longer gate times manual  gating is used,  with separate gate OPEN and gate CLOSE commands
; CY3 Set cycle to single

#scpiCmd READ? #pgm#
if gateTimeCache<=1.5
     print(substring(deviceRead(handle,"txrx? CY3"),1));
elseif gateTimeCache>1.5
    stopTime=seconds()+gateTimeCache
    deviceWrite(handle,"tx CY3 GO");
    while (seconds()<stopTime) do
        sleep(100)
    endwhile;
    print(substring(deviceRead(handle,"txrx? GC"),1));
endif;





; ==========  Control  ==========



; -----  Gate time  ------

; A programmed Gate Time is used up to 1,5sec
; For longer gate times manual  gating is used,  with separate gate OPEN and gate CLOSE commands
; GM    Gate Mode,  0: Normal,  1: Fast,  2: Min, 3: Manual
; GA<#>  Set GATE TIME 1 ms to one second
; GO  Gate OPEN
; GC  Gate CLOSE

; Set Gate time
#scpiCmd GATE:TIME #pgm#
gateTimeCache=value

if value<=1.5
    deviceWrite(handle,"tx GM0 GA"+value);
elseif value>1.5
     deviceWrite(handle,"tx GM3");
endif;



; Query Gate time (from cache)
#scpiCmd GATE:TIME? none?
:readmath: gateTimeCache


; Set Gate Open
#scpiCmd GATE:OPEN tx GO


; Set Gate close
#scpiCmd GATE:CLOSE txrx? GC




; ----- Gate mode ------

; GM  Gate mode, 0: NORM, 1: FAST, 2: MIN, 3: Manual

; Set Gate mode
#scpiCmd GATE:MODE tx GM(value)
:setvar: gateModeCache=inputValue

; Query Gate mode
#scpiCmd GATE:MODE? none?
:readmath: gateModeCache





; =======  Triggering  ========

; Manual, Preset: The trigger levels are set to 0.0V (= Default mode)
; Manual, Adjustable: adjust the trigger level between +5.0V and -5.0V
; Auto, Preset: sets the trigger to 50% between top and bottom peaks of signal
; (Auto is mutually exclusive with remote trigger levels)



; ----- Auto triggering ------

; AU  Auto triggering, 0: off, 1: on
; TR  TRIGG remote, 0: set trigger levels to local, 1: set trigger levels to remote
; It is necessary to send the TR0(TRIG REMOTE) command prior to an AU1 (AUTO TRIGGER) or AP1/BP1 (PRESET) command.

; Set Auto triggering
#scpiCmd TRIG:AUTO tx ((value==0)?"TR1 AU0":"TR0 AP1 BP1 AU1")
:setvar: trigAutoCache=inputValue
:setvar: trigPresCache=((inputValue==1)?1:trigPresCache)


; Query Auto triggering
#scpiCmd TRIG:AUTO? none?
:readmath: trigAutoCache



; ----- Preset / Adjustable triggering ------

; AP  Ch A preset or Adjustable triggering, 0: Adjustable, 1: Preset
; BP  Ch B preset or Adjustable triggering, 0: Adjustable, 1: Preset
; TR  TRIGG remote, 0: set trigger levels to local, 1: set trigger levels to remote
; It is necessary to send the TR0 (TRIG REMOTE) command prior to an AU1 (AUTO TRIGGER) or AP1/BP1 (PRESET)command.
; In remote, both channels have to be switched to preset/adjust at the same time

; Set preset/adjust triggering
#scpiCmd TRIG:PRES tx ((value==0)?"TR1 AP0 BP0":"TR0 AP1 BP1")
:setvar: trigPresCache=inputValue


; Query Ch A preset/adj triggering
#scpiCmd TRIG:PRES? none?
:readmath: trigPresCache



; ----- Manual triggering ------
; AT<#>  Set Trigger level Ch A (from -5.00V to +5.00V)
; inpaAttCache  Input A attenuator, 0: attenuation=1x, 1: attenuation=10x
; inpbAttCache  Input B attenuator, 0: attenuation=1x, 1: attenuation=10x

; Set Trigger Level Ch A
#scpiCmd TRIG:LEVA tx AT((inpaAttCache==0)?value:value/10)
:setvar: trigLevACache=inputValue


; Query Trigger Level Ch A (from counter)
#scpiCmd TRIG:LEVA? #pgm#

trigLevACache=substring(deviceRead(handle,"txrx? GA0.02 FN14 CY3"),9)
print(trigLevACache);
trigLevBCache=substring(deviceRead(handle,"txrx?"),9)
if gateModeCache==2
     deviceWrite(handle,"tx GM2 FN"+functionCache+" CY3")
elseif gateModeCache!=2
    deviceWrite(handle,"tx GA"+gateTimeCache+" FN"+functionCache+" CY3")
endif;



; Set Trigger Level Ch B
#scpiCmd TRIG:LEVB tx BT((inpbAttCache==0)?value:value/10)
:setvar: trigLevBCache=inputValue



; Trigger levels A and B are always requested at the same time.
; To speed trigger level read-out up, trigger level A is read from counter, and from the same read-out 
; trigger level B is put in cache. This is then used for the Query Trigger Level Ch B command.

; Query Trigger Level Ch B (from cache)
#scpiCmd TRIG:LEVB? none?
:readmath: trigLevBCache



; ---- Trigger level menu select ----

; option040     Programmable Input Amplifiers, 0: absent, 1= present
; trigAutoCache Auto triggering, 0: off, 1: on
; trigPresCache Preset or Adjustable triggering, 0: Adjustable, 1: Preset
; inpaAttCache  Input A attenuator, 0: attenuation=1x, 1: attenuation=10x
; inpbAttCache  Input B attenuator, 0: attenuation=1x, 1: attenuation=10x


#scpiCmd TRIG:LEVA:MENU? #pgm#
if option040==1 && trigAutoCache==0 && trigPresCache==0 && inpaAttCache==0
    print(1);
elseif option040==1 && trigAutoCache==0 && trigPresCache==0 && inpaAttCache==1
    print(2);
else
    print(0);
endif;


#scpiCmd TRIG:LEVB:MENU? #pgm#
if option040==1 && trigAutoCache==0 && trigPresCache==0 && inpbAttCache==0
    print(1);
elseif option040==1 && trigAutoCache==0 && trigPresCache==0 && inpbAttCache==1
    print(2);
else
    print(0);
endif;




; -----   Cycle mode  ------

; CY  Cycle mode, 1: NORM, 2: MIN,  3: SINGLE

; Set Cycle mode
#scpiCmd CYCLE:MODE tx CY(value)
:setvar: cycleModeCache=inputValue


; Query Cycle mode
#scpiCmd CYCLE:MODE? none?
:readmath: cycleModeCache




; ==========  Math  ==========


; ----- Math Offset mode ------
; MD    Math group.  0: disable math group,  1: enable math group
; MOD   Set offset to  last display (last measurement)
; MO<#> Set offset value

; Set Math Offset mode
#scpiCmd MATH:OFFS #pgm#
if value==0
    mathOffsCache=0
    deviceWrite(handle,"tx MD0 MO0");

;mode: set offset to last measurement
elseif value==1
    mathOffsCache=1
    deviceWrite(handle,"tx MD1 MOD");

;mode: set offset to manual value
elseif value==2
    mathOffsCache=2
    deviceWrite(handle,"tx MD1 MO"+(0-mathOffsMeasCache));
endif;



; Query Math Offset mode
#scpiCmd MATH:OFFS? none?
:readmath: mathOffsCache




; ----- Math Offset value ------
; set offset to manual value
; MO<#> Set offset

; Set Math Offset value
#scpiCmd MATH:OFFS:VALU tx MD1 MO(0-value)
:setvar: mathOffsMeasCache=inputValue
:setvar: mathOffsCache=2


; Query Offset value
#scpiCmd MATH:OFFS:VALU? none?
:readmath: mathOffsMeasCache







; ==========  Input A  ==========


; ----- Ch.A Input impedance  (option 040) ------
; AZ  Input A impedance, 0: Z=1M, 1: Z=50R

; Set Input A input impedance
#scpiCmd INPA:IMP tx AZ(value)
:setvar: inpaImpCache=inputValue

; Query Input A input impedance
#scpiCmd INPA:IMP? none?
:readmath: inpaImpCache



; ----- Ch.A Input coupling AC or DC  (option 040) ------
; AA  Input A coupling, 0: DC, 1: AC

; Set Input A input coupling
#scpiCmd INPA:COUP tx AA(value)
:setvar: inpaCoupCache=inputValue

; Query Input A input coupling
#scpiCmd INPA:COUP? none?
:readmath: inpaCoupCache



; ----- Ch.A Input attenuator  (option 040) ------
; AX  Input A attenuator, 0: attenuation=1x, 1: attenuation=10x

; Set Input A input attenuator
#scpiCmd INPA:ATT tx AX(value)
:setvar: inpaAttCache=inputValue

; Query Input A input attenuator
#scpiCmd INPA:ATT? none?
:readmath: inpaAttCache



; -----  Ch.A Input low pass filter  (option 040) ------
; AF  Input A low pass filter, 0: off, 1: on

; Set Input A input filter
#scpiCmd INPA:FILT tx AF(value)
:setvar: inpaFiltCache=inputValue

; Query Input A input filter
#scpiCmd INPA:FILT? none?
:readmath: inpaFiltCache



; -----  Ch.A Input trigger slope  (option 040) ------
; AS  Input A trigger slope, 0: positive, 1: negative

; Set Input A trigger slope
#scpiCmd INPA:SLOPE tx AS(value)
:setvar: inpaSlopeCache=inputValue

; Query Input A trigger slope
#scpiCmd INPA:SLOPE? none?
:readmath: inpaSlopeCache



; -----  Common input A ------

; When set to Common input A, Ch.B Zin, Attenuator and Coupling are set the same as Ch.A
; CO  Common input A, 0: separate, 1: common

; Set Common input A
#scpiCmd INPA:COMM #pgm#
if value==0
    deviceWrite(handle,"tx CO0")
    inpaCommCache=0;
elseif value==1
    deviceWrite(handle,"tx CO1");
    inpaCommCache=1
; Sync input A settings to B
    inpbImpCache=inpaImpCache
    inpbAttCache=inpaAttCache
    inpbCoupCache=inpaCoupCache
endif;


; Query Common input A
#scpiCmd INPA:COMM? none?
:readmath: inpaCommCache





; ==========  Input B  ==========

; ----- Ch.B Input impedance  (option 040) ------
; BZ  Input B impedance, 0: Z=1M, 1: Z=50R

; Set Input B input impedance
#scpiCmd INPB:IMP tx BZ(value)
:setvar: inpbImpCache=inputValue

; Query Input B input impedance
#scpiCmd INPB:IMP? none?
:readmath: inpbImpCache



; ----- Ch.B Input coupling AC or DC  (option 040) ------
; BA  Input B coupling, 0: DC, 1: AC

; Set Input B input coupling
#scpiCmd INPB:COUP tx BA(value)
:setvar: inpbCoupCache=inputValue

; Query Input B input coupling
#scpiCmd INPB:COUP? none?
:readmath: inpbCoupCache



; ----- Ch.B Input attenuator  (option 040) ------
; BX  Input B attenuator, 0: attenuation=1x, 1: attenuation=10x

; Set Input B input attenuator
#scpiCmd INPB:ATT tx BX(value)
:setvar: inpbAttCache=inputValue

; Query Input B input attenuator
#scpiCmd INPB:ATT? none?
:readmath: inpbAttCache



; -----  Ch.B Input low pass filter  (option 040) ------
; BF  Input B low pass filter, 0: off, 1: on

; Set Input B input filter
#scpiCmd INPB:FILT tx BF(value)
:setvar: inpbFiltCache=inputValue

; Query Input B input filter
#scpiCmd INPB:FILT? none?
:readmath: inpbFiltCache



; -----  Ch.B Input trigger slope  (option 040)  ------
; BS  Input B trigger slope, 0: positive, 1: negative

; Set Input B trigger slope
#scpiCmd INPB:SLOPE tx BS(value)
:setvar: inpbSlopeCache=inputValue

; Query Input A trigger slope
#scpiCmd INPB:SLOPE? none?
:readmath: inpbSlopeCache




; ==========  Miscellaneous  ==========


; -----  Options ------
; Option 020: DC Voltmeter module,  0: absent, 1= present
; Option 030: 1,3GHz C Channel input module, 0: absent, 1= present
; Option 040: Programmable Input Amplifiers, 0: absent, 1= present

; Select Option 020 present
#scpiCmd OPT:020 none
:setvar: option020=inputValue

; Query Option 020 present
#scpiCmd OPT:020? none?
:readmath: option020


; Select Option 030 present
#scpiCmd OPT:030 none
:setvar: option030=inputValue

; Query Option 030 present
#scpiCmd OPT:030? none?
:readmath: option030


; Select Option 040 present
#scpiCmd OPT:040 none
:setvar: option040=inputValue

; Query Option 040 present
#scpiCmd OPT:040? none?
:readmath: option040



; ============== End original HP 5335A commands to SCPI/TestController commands translations  ==============





;----------------------- Data read out  ------------------


; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6)
; code: #value name unit format {selector}

#value Freq_A Hz SI12 Frequency_A
#value Freq_B Hz SI12 Frequency_B
#value Freq_C Hz SI12 Frequency_C
#value Period_A s SI12 Period_A
#value Duty_Cycle_A % D2 Duty_Cycle_A
#value Gate_time s SI Gate_time
#value Ratio_A/B _ D6 Ratio_A/B
#value Ratio_C/A _ D6 Ratio_C/A
#value Slew_A V/s SI Slew_rate_A
#value Rise/Fall_time_A s SI Rise_/_Fall_time_A
#value Time_A_to_B s SI Time_Int_A_to_B
#value 1/time_A_to_B 1/s SI 1/time_A_to_B
#value Phase_A_rel_B deg D1 Phase_A_rel_B
#value Pulse_A s SI Pulse_A
#value DC_Volts V SI DC_Volts






; This is a single line command
#askValues READ?




#askMode FUNC?





; ------------------  Initial commands & Final command  -------------

; Initial commands to meter when establishing connection
#initCmd CLEAR;[100];INIT;[100];CACH:INIT



; Command to prevent connection to other devices
; The first character in the answer string must be an "S"
#verifyDevice "S" ID:CHK?



; Final command to meter before breaking connection
#finalCmd CLEAR;[100];goLocal;[1000]; 





; ========================== MENU'S  ================================


; ==========  Mode (Function) menu  ==========

; code: #cmdMode modeLabel deviceModeString SCPI commands
; modeLabel: the label used on the button (This is the same value used for the #value selector).
; deviceModeString: the string the device return with #askMode command 

; Functions:
; FN1  Freq A
; FN2  Time A->B
; FN4  Ratio A/B 
; FN5  Freq C 
; FN6  1/time A->B
; FN7  Pulse A
; FN8  RATIO C/A 
; FN9  Period A 
; FN10 Rise/Fall A 
; FN11 Slew A 
; FN12 Duty Cycle A 
; FN13 Gate Time
; FN14 TRIG LVL 
; FN15 VOLTS 
; FN16 PHASE A rel B 
; FN17 FREQ B       Special Function 


; INPA:COMM #  Common input A, 0: separate, 1: common
; TRIG:AUTO #  Auto triggering, 0: off, 1: on
; TRIG:PRES #  Preset or Adjustable triggering, 0: Adjustable, 1: Preset
; GATE:MODE #  Gate mode, 0: NORM, 1: FAST, 2: MIN, 3: Manual


#cmdModeLayout 3 5


#cmdMode Frequency_A 1
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 0;FUNC 1

#cmdMode Frequency_B 17
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 0;FUNC 17

#cmdMode Frequency_C 5
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 0;FUNC 5
:enable: option030==1



#cmdMode Period_A 9
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 0;FUNC 9

#cmdMode Ratio_A/B 4
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 0;FUNC 4

#cmdMode Ratio_C/A 8
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 0;FUNC 8
:enable: option030==1



#cmdMode Pulse_A 7
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 2;FUNC 7

#cmdMode Time_Int_A_to_B 2
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 2;FUNC 2

#cmdMode 1/time_A_to_B 6
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 2;FUNC 6



#cmdMode Duty_Cycle_A 12
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;GATE:MODE 2;FUNC 12

#cmdMode Phase_A_rel_B 16
INPA:COMM 0;TRIG:AUTO 1;GATE:MODE 2;FUNC 16

#cmdMode Gate_time 13
FUNC 13



#cmdMode Slew_rate_A 11
INPA:COMM 1;TRIG:AUTO 1;GATE:MODE 2;FUNC 11

#cmdMode Rise_/_Fall_time_A 10
INPA:COMM 1;TRIG:AUTO 1;GATE:MODE 2;FUNC 10

#cmdMode DC_Volts 15
INPA:COMM 0;TRIG:AUTO 0;TRIG:PRES 1;FUNC 15
:enable: option020==1








; ========== Setup menu  ===========

; -----Main tab -----

#cmdSetup info Active_Mode Main
:read: FUNC?
:readmath: getElement(";Frequency A       (max. 200MHz);Time Interval A->B;Total A;Ratio A/B;Frequency C       (max. 1.3GHz);1 / Time Interval A->B;Pulse A;Ratio C/A;Period A       (max. 100MHz);Rise or Fall time A     (signal: >50Hz and <25MHz);Slew Rate A     (signal: >50Hz and <25MHz);Duty Cycle A;Gate time;Trigger Levels;DC Volts;Phase A rel B;Frequency B       (max. 100MHz);Time B->A;Total A->B;Pulse B",(value),";")
:updatemodechange:


#cmdSetup separator - Main
2 100 Raised


#cmdSetup radio Gate_time Main
:read: GATE:TIME?
:write: GATE:TIME # 
:updatemodechange:
:enable: functionCache!=10 && functionCache!=11 && functionCache!=12 && functionCache!=16
:tip: Set the gate time, each longer preset gives one extra digit resolution
11ms 0.011
0,11sec 0.11
1,1sec 1.1
11sec 11


#cmdSetup number Gate_time Main
:read: GATE:TIME?
:write: GATE:TIME #
:updatemodechange:
:enable: functionCache!=10 && functionCache!=11 && functionCache!=12 && functionCache!=16
:tip: Set the gate time, between 1ms and 110seconds
sec 1m 110


#cmdSetup separator - Main
2 100 Raised


#cmdSetup radio Math_offset Main
:read: MATH:OFFS?
:write: MATH:OFFS # 
:update: Offset_value
:enable: functionCache!=13
:tip: <html>Offset (subtract) a value from the measurement<br>MEASure: subtract last measurement from following measurements<br>VALUE: Set manually a value to subtract from following measurements
Off 0
meas 1
value 2


#cmdSetup number Offset_value Main
:read: MATH:OFFS:VALU?
:write: MATH:OFFS:VALU #
:enable: Main.Math_offset==2
:tip: Set a value to subtract from following measurements
_ -200M  200M


#cmdSetup separator - Main
2 100 Raised


#cmdSetup radio Common_input_A Main
:read: INPA:COMM?
:write: INPA:COMM # 
:updatemodechange:
:update: Ch.B__Input_impedance Ch.B__Input_coupling Ch.B__Attenuator
:enable: option040==1
:tip: <html>Off: Separate Ch.A and Ch.B inputs<br>Com: Ch.A input is common for both channels
Off 0
Com 1




; -----Trigger tab -----


#cmdSetup radio Auto_trigger Trigger
:read: TRIG:AUTO?
:write: TRIG:AUTO # 
:updatemodechange:
:update: Trigger Trigger_levels
:enable: functionCache!=10 && functionCache!=11 && functionCache!=16
:tip: <html>OFF: set trigger to preset, or manually between +5V and -5V<br>(with attenuator at 10x between +50V and -50V)<br>Auto ON: sets trigger 50% between pos. and neg. peaks of signal
Off 0
On 1


#cmdSetup radio Trigger_levels Trigger
:read: TRIG:PRES?
:write: TRIG:PRES # 
:updatemodechange:
:update: Trigger
:enable: Trigger.Auto_trigger==0 && option040==1
:tip: <html>Preset (with Auto off): sets trigger to 0.00V<br>Adjust (with Auto off): adjust trigger between -5V and +5V<br>(with attenuator at 10x between +50V and -50V)
Preset 1
Adjust 0


#cmdSetup separator - Trigger
2 100 Raised


; -----Ch.A__Trigger -----

#cmdSetup number Ch.A__Trigger_level Trigger
:read: TRIG:LEVA?
:format: D2
:write: TRIG:LEVA #
:buttontext: Adjust
:tip: <html>Check & adjust Ch.A trigger level<br>Adjust only possible with option 040 present
V -5.00 +5.00


#cmdSetup number Ch.A__trigger_Level Trigger
:read: TRIG:LEVA?
:format: D2
:write: TRIG:LEVA #
:buttontext: Adjust
:tip: <html>Check & adjust Ch.A trigger level<br>Adjust only possible with option 040 present
V -50.00 +50.00


#cmdSetup info Ch.A__trigger_level Trigger
:read: TRIG:LEVA?
:format: D2
:tip: <html>Shows Ch.A trigger level<br>Adjust only possible in manual, and with option 040 present
V
_


; Trigger_level (capital T): set and read (Att 1x)
; trigger_Level (capital L): set and read (Att 10x)
; trigger_level (lowercase t): read only

#cmdSetup selector Trigger Trigger
:read: TRIG:LEVA:MENU?
:updatemodechange:
0 Trigger.Ch.A__trigger_level
1 Trigger.Ch.A__Trigger_level
2 Trigger.Ch.A__trigger_Level


; -----Ch.B__Trigger -----

#cmdSetup number Ch.B__Trigger_level Trigger
:read: TRIG:LEVB?
:format: D2
:write: TRIG:LEVB #
:buttontext: Adjust
:tip: <html>Check & adjust Ch.B trigger level<br>Adjust only possible with option 040 present
V -5.00 +5.00


#cmdSetup number Ch.B__trigger_Level Trigger
:read: TRIG:LEVB?
:format: D2
:write: TRIG:LEVB #
:buttontext: Adjust
:tip: <html>Check & adjust Ch.B trigger level<br>Adjust only possible with option 040 present
V -50.00 +50.00


#cmdSetup info Ch.B__trigger_level Trigger
:read: TRIG:LEVB?
:format: D2
:tip: <html>Shows Ch.B trigger level<br>Adjust only possible in manual, and with option 040 present
V
_


; Trigger_level (capital T): set and read (Att 1x)
; trigger_Level (capital L): set and read (Att 10x)
; trigger_level (lowercase t): read only

#cmdSetup selector Trigger Trigger
:read: TRIG:LEVB:MENU?
:updatemodechange:
0 Trigger.Ch.B__trigger_level
1 Trigger.Ch.B__Trigger_level
2 Trigger.Ch.B__trigger_Level


#cmdSetup separator - Trigger
2 100 Empty

#cmdSetup separator - Trigger
2 100 Empty

#cmdSetup separator - Trigger
2 100 Empty


#cmdSetup button Check_actual_Trigger_levels Trigger
:write: TRIG:LEVA?;TRIG:LEVB?
:update: Trigger
:tip: Update the displayed trigger levels



; -----Input A tab -----


#cmdSetup separator - Input_A
2 100 Empty


#cmdSetup radio Ch.A__Input_impedance Input_A
:read: INPA:IMP?
:write: INPA:IMP #
:enable: option040==1
:tip: Set the Ch.A input impedance
1M 0
50R 1


#cmdSetup radio Ch.A__Input_coupling Input_A
:read: INPA:COUP?
:write: INPA:COUP #
:enable: option040==1
:tip: Set the input coupling to DC or AC
DC 0
AC 1


#cmdSetup radio Ch.A__Attenuator Input_A
:read: INPA:ATT?
:write: INPA:ATT #
:update: Trigger
:enable: option040==1
:tip: Set input attenuator to no attenuation or 10x attenuation
1x 0
10x 1


#cmdSetup radio Ch.A__Low_pass_filter Input_A
:read: INPA:FILT?
:write: INPA:FILT #
:enable: option040==1
:tip: Set low pass filter, -3dB @ 175kHz
Off 0
On 1


#cmdSetup radio Ch.A__Trigger_slope Input_A
:read: INPA:SLOPE?
:write: INPA:SLOPE #
:enable: option040==1
:tip: <html>Set trigger slope: positive (up) going edge,<br>or negative (down) going edge
pos 0
neg 1


#cmdSetup separator - Input_A
2 100 Empty

#cmdSetup separator - Input_A
2 100 Empty

#cmdSetup separator - Input_A
2 100 Empty
:visible: option040==0
center Inputs are only programmable with Option 040 present



; -----Input B tab -----


#cmdSetup separator - Input_B
2 100 Empty


#cmdSetup radio Ch.B__Input_impedance Input_B
:read: INPB:IMP?
:write: INPB:IMP #
:enable: option040==1
:updatemodechange:
:tip: Set the Ch.B input impedance
1M 0
50R 1


#cmdSetup radio Ch.B__Input_coupling Input_B
:read: INPB:COUP?
:write: INPB:COUP #
:enable: option040==1
:updatemodechange:
:tip: Set the input coupling to DC or AC
DC 0
AC 1


#cmdSetup radio Ch.B__Attenuator Input_B
:read: INPB:ATT?
:write: INPB:ATT #
:update: Trigger
:enable: option040==1
:updatemodechange:
:tip: Set input attenuator to no attenuation or 10x attenuation
1x 0
10x 1


#cmdSetup radio Ch.B__Low_pass_filter Input_B
:read: INPB:FILT?
:write: INPB:FILT #
:enable: option040==1
:updatemodechange:
:tip: Set low pass filter, -3dB @ 175kHz
Off 0
On 1

#cmdSetup radio Ch.B__Trigger_slope Input_B
:read: INPB:SLOPE?
:write: INPB:SLOPE #
:enable: option040==1
:updatemodechange:
:tip: <html>Set trigger slope: positive (up) going edge,<br>or negative (down) going edge
pos 0
neg 1


#cmdSetup separator - Input_B
2 100 Empty

#cmdSetup separator - Input_B
2 100 Empty

#cmdSetup separator - Input_B
2 100 Empty
:visible: option040==0
center Inputs are only programmable with Option 040 present



; -----Options tab -----


#cmdSetup separator - Options
2 100 Empty

#cmdSetup separator - Options
2 100 Empty

#cmdSetup separator - Options
2 100 Empty
center Set available options in connected 5335A

#cmdSetup separator - Options
2 100 Empty

#cmdSetup separator - Options
2 100 Empty


#cmdSetup radio Opt._020__DC_Voltmeter_module Options
:read: OPT:020?
:write: OPT:020 # 
:tip: Does the connected 5335A have the Option 020 DC Voltmeter module?
No 0
Yes 1


#cmdSetup radio Opt._030__1.3GHz_C_Channel_input Options
:read: OPT:030?
:write: OPT:030 # 
:tip: Does the connected 5335A have the Option 030 C channel input module?
No 0
Yes 1


#cmdSetup radio Opt._040__Programmable_Inputs Options
:read: OPT:040?
:write: OPT:040 # 
:tip: Does the connected 5335A have the Option 040 Programmable Input Amplifiers?
No 0
Yes 1


#cmdSetup separator - Options
2 100 Empty

#cmdSetup separator - Options
2 100 Empty

#cmdSetup separator - Options
2 100 Empty

#cmdSetup separator - Options
2 100 Empty
center Definition version: 1.01



; -----Setup menu end -----


