;-----------------------------------------------------------------------------
; Marconi 2955 Radio Communications Test Set
;
; Revision 1.0, 21 Sept. 2022 Inital release
;
;-----------------------------------------------------------------------------

#author rachdatu
;(based on template of MikeLud)
#notes Tones (partially), Bar chart, Accessories, Scope, Help (partially) modes not implemented. Tested with AR488 GPIB controller, version 0.46.20, 05/04/2019. Test Controller V2.07

; Some comments: Device accepts only 2 different increments/decrements per page. This is not an issue with the definition file.
; Only a few memory locations have been defined. You can add more.
; A few CTCSS tones have been defined. You can add more.
; When recalling settings, a few are not updated in the interface: Filter, Distortion, and Coupling. Not an issue with the def. file
; You have to set the values to update the device setttings.


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

#idString Marconi,2955,
#name     Marconi 2955
#handle   MI2955
#port GPIB
#driver Ascii


; Initial commands to meter when establishing connection, used to disable local control
;#initCmd

; Final command to meter before breaking connection, used to restore local control
;#finalCmd


; 200 ms sec. delay does not work in Duplex mode, adjust if necessary
;#gpibWriteDelay 200
;#gpibWriteReadDelay 200

#gpibWriteDelay 500
#gpibWriteReadDelay 500

;delay in seconds
;#readingDelay 3

#value RFFrequency MHz D3
#value RFPower W D3
#value ModulationFreq kHz D3
#value ModulationLevel kHz D3
#value Frequency kHz D3
#value Voltage V D3
#value RXDistortion % D3
#value TXDistortion % D3

#askValues txrx? RD1;[500];txrx? RD2;[500];txrx? RD3;[500];txrx? RD4;[500];txrx? RD5;[500];txrx? RD6;[500];txrx? RD7;[500];txrx? RD8;[500];

; Format of answer: f=float, u=remove trailing letters, x=skip, *=Zero upper case values if this value is 0
#askValuesReadFormat uuuuuuuu
#For testing purpose
;#askValuesMathFormat value=="whatever"?whatever:value

;------------------------------------------------------------------------------------
; RX FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd RFFrequency tx RX;RG;FR(value)
#scpiCmd RFFreqDelta tx RX;RG;FR;DI(value)
#scpiCmd RFFreqIncDec tx RX;RG;FR;(value)

#scpiCmd RFLevel tx RX;RG;LV(value)
#scpiCmd RFLevelDelta tx RX;RG;LV;DI(value)
#scpiCmd RFLevelIncDec tx RX;RG;LV;(value)

#scpiCmd ModulationFrequency tx RX;SM;FR(value)
#scpiCmd ModulationFrequencyDelta tx RX;SM;FR;DI(value)
#scpiCmd ModulationFrequencyIncDec tx RX;SM;(value)

#scpiCmd ModulationLevel tx RX;SM;LV(value)
#scpiCmd ModulationLevelDelta tx RX;SM;LV;DI(value)

#scpiCmd RXAFFilter tx RX;FI(value)

#scpiCmd RXDistortion tx RX;SN(value)
#scpiCmd RXACDCCoupling tx RX;(value)

#scpiCmd RXRecallMemory tx RX;RC(value)
#scpiCmd RXStoreMemory tx RX;ST(value)

;------------------------------------------------------------------------------------
; TX FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd TXRFFrequency tx TX;RG;FR(value)
#scpiCmd TXAutoTune tx TX;XA
#scpiCmd AFFrequency tx TX;AG;FR(value)
#scpiCmd AFFreqDelta tx TX;AG;FR;DI(value)
#scpiCmd AFFreqIncDec tx TX;AG;FR;(value)

#scpiCmd AFLevel tx TX;AG;LV(value)
#scpiCmd AFLevelDelta tx TX;AG;LV;DI(value)
#scpiCmd AFLevelIncDec tx TX;AG;LV;(value)

#scpiCmd TXAFFilter tx TX;FI(value)

#scpiCmd TXDistortion tx TX;SN(value)
#scpiCmd TXACDCCoupling tx TX;(value)

#scpiCmd TXRecallMemory tx TX;RC(value)
#scpiCmd TXStoreMemory tx TX;ST(value)

;------------------------------------------------------------------------------------
; DUPLEX FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd enable2ports tx DX;IP(value)
#scpiCmd DXRFFrequency tx DX;RG;FR(value)
#scpiCmd DXRFLevel tx DX;RG;LV(value)
#scpiCmd DXModulationLevel tx DX;SM;LV(value)
#scpiCmd DXAFLevel tx DX;AG;LV(value)

#scpiCmd TXFrequency tx TX;RG;FR(value)

#scpiCmd DXAFFilter tx DX;FI(value)

#scpiCmd DXDistortion tx DX;SN(value)
#scpiCmd DXACDCCoupling tx DX;(value)

#scpiCmd DXRecallMemory tx DX;RC(value)
#scpiCmd DXStoreMemory tx DX;ST(value)

;------------------------------------------------------------------------------------
; TONES FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd CTCSSFrequency tx RX;TN;XA;XB(value)
#scpiCmd CTCSSLevel tx RX;TN;XA;XD(value)
#scpiCmd CTCSSSendTone tx RX;TN;XA;XF
#scpiCmd CTCSSReturn tx RX;TN;XA;XG

;------------------------------------------------------------------------------------
; AUDIO FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd EnableAudioTest tx RX;AG
#scpiCmd ACDCCoupling tx (value)
#scpiCmd AUDIOAFFilter tx FI(value)
#scpiCmd AUDIODistortion tx SN(value)
#scpiCmd AUDIOUnits tx (value)
#scpiCmd AUDIOAFFrequency tx AG;FR(value)
#scpiCmd AUDIOAFFreqDelta tx AG;FR;DI(value)
#scpiCmd AUDIOAFFreqIncDec tx AG;FR;(value)
#scpiCmd AUDIOAFLevel tx AG;LV(value)
#scpiCmd AUDIOAFLevelDelta tx AG;LV;DI(value)
#scpiCmd AUDIOAFLevelIncDec tx AG;LV;(value)
#scpiCmd RecallMemory tx RX;AG;RC(value)
#scpiCmd StoreMemory tx RX;AG;ST(value)

;------------------------------------------------------------------------------------
; MEASUREMENTS FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd GetTXFrequency txrx? RD1
#scpiCmd GetRFPower txrx? RD2
#scpiCmd GetModulationFrequency txrx? RD3
#scpiCmd GetModulationLevel txrx? RD4
#scpiCmd GetAFFrequency txrx? RD5
#scpiCmd GetAFLevel txrx? RD6
#scpiCmd GetRXDistortion txrx? RD7
#scpiCmd GetTXDistortion txrx? RD8
#scpiCmd GetModulationPeak txrx? RD9
#scpiCmd GetModulationTrough txrx? RD10
#scpiCmd RefreshMeasurements txrx? RD5;[500];txrx? RD6;[500]

;------------------------------------------------------------------------------------
; HELP FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd Help tx HP
#scpiCmd ReturnHelp tx HP;XG
#scpiCmd SelfTest tx HP;XF
#scpiCmd ChangeParameters tx HP;XE
#scpiCmd SoftwareVersion txrx? VN

;------------------------------------------------------------------------------------
; OTHER FUNCTIONS
;------------------------------------------------------------------------------------

#scpiCmd MIPurgeBuffer tx PG
#scpiCmd MIClickMe tx CS;WR2,15,Have fun, rachdatu
#scpiCmd ReturnToMeasurements tx RS

;------------------------------------------------------------------------------------
; RX TAB
;------------------------------------------------------------------------------------

#cmdSetup Info Parameters RX

#cmdSetup separator - RX
2 100 Solid

#cmdSetup number RF_Frequency RX
:read: txrx? RD27
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: RFFrequency (value)MZ
:tip: Frequency in MHz
MHz 0 1000
:update: RF_Frequency

#cmdSetup number RF_Frequency_Delta RX
:read: txrx? RD33
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: RFFreqDelta (value)KZ
kHz 0 100
:update: RF_Frequency_Delta

#cmdSetup buttons RF_Frequency_inc_dec RX
:read: txrx? RD27
:readmath: getMatch(value,"[-+.0-9]+")
:write: RFFreqIncDec (value)
INCREMENT FU
DECREMENT FD
:update: RF_Frequency

#cmdSetup number RF_Level RX
:read: txrx? RD28
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: RFLevel (value)DM
dBm -140 -20
:update: RF_Level

; max 120 dB and only dB!
#cmdSetup number RF_Level_Delta RX
:read: txrx? RD34
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: RFLevelDelta (value)DB
dB 0 120
:update: RF_Level_Delta

#cmdSetup buttons RF_Level_inc_dec RX
:read: txrx? RD28
:readmath: getMatch(value,"[-+.0-9]+")
:write: RFLevelIncDec (value)
INCREMENT LU
DECREMENT LD
:update: RF_Level

#cmdSetup number Modulation_Frequency RX
:read: txrx? RD31
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationFrequency (value)KZ
kHz .05 15
:update: Modulation_Frequency

#cmdSetup number Modulation_Frequency_Delta RX
:read: txrx? RD37
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationFrequencyDelta (value)KZ
kHz .05 15
:update: Modulation_Frequency

#cmdSetup buttons Modulation_Frequency_inc_dec RX
:read: txrx? RD31
:readmath: getMatch(value,"[-+.0-9]+")
:write: ModulationFrequencyIncDec (value)
INCREMENT FU
DECREMENT FD
:update: Modulation_Frequency

#cmdSetup separator - RX
2 100 Solid

#cmdSetup combobox Modulation_Type RX
:read:
:write:
:tip: Select Modulation Type and Set
:string:
FM FM
AM AM
PM PM

#cmdSetup buttons Modulation RX
;:read:
:write: tx MD#
Off 0
On 1
;:update: 

;FM
#cmdSetup number Frequency_Modulation_Level RX
:read: txrx? RD32
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationLevel (value)KZ
:enable: RX.Modulation_Type=="FM"
kHz 0 25
:update: Frequency_Modulation_Level

;FM
#cmdSetup number Modulation_Level_Delta RX
:read: txrx? RD38
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationLevelDelta (value)KZ
:enable: RX.Modulation_Type=="FM"
kHz 0 25
:update: Modulation_Level_Delta

;FM
#cmdSetup buttons Modulation_Level_inc_dec RX
:read: txrx? RD32
:readmath: getMatch(value,"[-+.0-9]+")
:write: ModulationLevel (value)
:enable: RX.Modulation_Type=="FM"
INCREMENT LU
DECREMENT LD
:update: Frequency_Modulation_Level

;AM
#cmdSetup number AMplitude_Modulation_Level RX
:read: txrx? RD32
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationLevel (value)AM
:enable: RX.Modulation_Type=="AM"
% 0 100
:update: AMplitude_Modulation_Level

;AM
#cmdSetup number Modulation_Level_Delta RX
:read: txrx? RD38
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationLevelDelta (value)AM
:enable: RX.Modulation_Type=="AM"
% 0 100
:update: Modulation_Level_Delta

;AM
#cmdSetup buttons Modulation_Level_inc_dec RX
:read: txrx? RD32
:readmath: getMatch(value,"[-+.0-9]+")
:write: ModulationLevel (value)
:enable: RX.Modulation_Type=="AM"
INCREMENT LU
DECREMENT LD
:update: AMplitude_Modulation_Level

;PM
#cmdSetup number PHase_Modulation_Level RX
:read: txrx? RD32
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationLevel (value)PM
:enable: RX.Modulation_Type=="PM"
RAD 0 10
:update: PHase_Modulation_Level

;PM
#cmdSetup number Modulation_Level_Delta RX
:read: txrx? RD38
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: ModulationLevelDelta (value)PM
:enable: RX.Modulation_Type=="PM"
RAD 0 10
:update: Modulation_Level_Delta

;PM
#cmdSetup buttons Modulation_Level_inc_dec RX
:read: txrx? RD32
:readmath: getMatch(value,"[-+.0-9]+")
:write: ModulationLevel (value)
:enable: RX.Modulation_Type=="PM"
INCREMENT LU
DECREMENT LD
:update: PHase_Modulation_Level

#cmdSetup separator - RX
2 100 Solid


#cmdSetup Combobox Filter RX
:read:
:write: RXAFFilter (value)
300Hz-3.4kHz 0
15/50kHz 1
300Hz 2

#cmdSetup Combobox Distortion RX
:read:
:write: RXDistortion (value)
OFF 0
SINAD 1
S/N 2
DISTN 3

; Switch to DC only when distortion is OFF
#cmdSetup Combobox Coupling RX
:read: 
:write: RXACDCCoupling (value)
:tip: DC coupling only if Distortion OFF
AC AC
DC DC

#cmdSetup combobox Store_in_Memory_# RX
:read: 
:write: RXStoreMemory
:buttontext: Store
:update:
1 01
2 02
3 03
4 04
5 05 

#cmdSetup combobox Recall_from_Memory_# RX
:read: 
:write: RXRecallMemory
:buttontext: Recall
:update: RF_Frequency RF_Frequency_Delta RF_Level RF_Level_Delta Modulation_Frequency Modulation_Frequency_Delta Frequency_Modulation_Level Modulation_Level_Delta AMplitude_Modulation_Level Modulation_Level_Delta PHase_Modulation_Level Modulation_Level_Delta
1 01
2 02
3 03
4 04
5 05 

#cmdSetup separator - RX
2 100 Solid

;------------------------------------------------------------------------------------
; TX TAB
;------------------------------------------------------------------------------------

#cmdSetup Info Parameters TX

#cmdSetup number RF_Frequency_ TX
:read: txrx? RD1
:readmath: match(value,"^[-+.0-9]+(Hz|VL|UV)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+")
:write: TXRFFrequency (value)MZ
:tip: Frequency in MHz
MHz -1000 1000
;:update: RF_Frequency_

#cmdSetup buttons Auto_Tune TX
:read:
:readmath:
:write: TXAutoTune
:tip: Set TX frequency, click AUTOTUNE and check the offset on the display
AUTOTUNE -
:update: RF_Frequency_

#cmdSetup number AF_Freq TX
:read: txrx? RD29
:readmath: match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+")
:write: AFFrequency (value)KZ
kHz 0.02 20
:update: AF_Freq

#cmdSetup number AF_Freq_Delta TX
:read: txrx? RD35
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: AFFreqDelta (value)KZ
kHz 0.02 20 
:update: AF_Freq_Delta

#cmdSetup buttons AF_Freq_inc_dec TX
:read: txrx? RD35
:readmath: getMatch(value,"[-+.0-9]+")
:write: AFFreqIncDec (value)
INCREMENT FU
DECREMENT FD
:update: AF_Freq

#cmdSetup number AF_Level TX
:read: txrx? RD30
:readmath: match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")*1000 : getMatch(value,"[-+.0-9]+")
:write: AFLevel (value)MV
mV 0 2000
:update: AF_Level

#cmdSetup number AF_Level_Delta TX
:read: txrx? RD36
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: AFLevelDelta (value)MV
mV 0 2000
:update: AF_Level_Delta

#cmdSetup buttons AF_Level_inc_dec TX
:read: txrx? RD36
:readmath: getMatch(value,"[-+.0-9]+")
:write: AFLevelIncDec (value)
INCREMENT LU
DECREMENT LD
:update: AF_Level

#cmdSetup Combobox Filter TX
:read:
:write: TXAFFilter (value)
300Hz-3.4kHz 0
15/50kHz 1
300Hz 2

#cmdSetup Combobox Distortion TX
:read:
:write: TXDistortion (value)
OFF 0
DISTN 3

; Switch to DC only when distortion is OFF
#cmdSetup Combobox Coupling TX
:read: 
:write: TXACDCCoupling (value)
:tip: DC coupling only if Distortion OFF
AC AC
DC DC

#cmdSetup combobox Store_in_Memory_# TX
:read: 
:write: TXStoreMemory
:buttontext: Store
:update:
1 01
2 02
3 03
4 04
5 05 

#cmdSetup combobox Recall_from_Memory_# TX
:read: 
:write: TXRecallMemory
:buttontext: Recall
:update: RF_Frequency_ AF_Freq AF_Freq_Delta AF_Level AF_Level_Delta
1 01
2 02
3 03
4 04
5 05 

;------------------------------------------------------------------------------------
; DUPLEX TAB
;------------------------------------------------------------------------------------

#cmdSetup Info Parameters DUPLEX

#cmdSetup Info BNC_to_RECEIVER_and_N_to_Transmitter DUPLEX

#cmdSetup buttons enable_2_ports DUPLEX
;:read:
:write: enable2ports (value)
Yes 1
No 2

#cmdSetup number RF_Frequency_ DUPLEX
:read: txrx? RD27
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: DXRFFrequency (value)MZ
:tip: Frequency in MHz
MHz 0 1000
:update: RF_Frequency_

#cmdSetup number RF_Level_ DUPLEX
:read: txrx? RD28
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: DXRFLevel (value)DM
dBm -140 -20
:update: RF_Level_

;FM
#cmdSetup number Frequency_Modulation_Level_ DUPLEX
:read: txrx? RD32
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: DXModulationLevel (value)KZ
kHz 0.1 30
:update: Frequency_Modulation_Level_

#cmdSetup number AF_Level_ DUPLEX
:read: txrx? RD30
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")*1000 : getMatch(value,"[-+.0-9]+"))
:write: DXAFLevel (value)MV
mV 0 2000
:update: AF_Level_

#cmdSetup Combobox Filter DUPLEX
:read:
:write: DXAFFilter (value)
300Hz-3.4kHz 0
15/50kHz 1
300Hz 2

#cmdSetup Combobox Distortion DUPLEX
:read:
:write: DXdistortion (value)
OFF 0
SINAD 1
DISTN 3

; Switch to DC only when distortion is OFF
#cmdSetup Combobox Coupling DUPLEX
:read: 
:write: DXACDCCoupling (value)
:tip: DC coupling only if Distortion OFF
AC AC
DC DC

#cmdSetup combobox Store_in_Memory_# DUPLEX
:read: 
:write: DXStoreMemory
:buttontext: Store
:update:
1 01
2 02
3 03
4 04
5 05 

#cmdSetup combobox Recall_from_Memory_# DUPLEX
:read: 
:write: DXRecallMemory
:buttontext: Recall
:update: RF_Frequency_ RF_Level_ Frequency_Modulation_Level_ AF_Level_
1 01
2 02
3 03
4 04
5 05 

;------------------------------------------------------------------------------------
; TONES FUNCTIONS
;------------------------------------------------------------------------------------
#cmdSetup Info CTCSS TONES

#cmdSetup separator - TONES
2 100 Solid

#cmdSetup combobox Frequency TONES
:read: 
:write: CTCSSFrequency
:update:
67.0Hz 67.0HZ
71.9Hz 71.9HZ
82.5Hz 82.5HZ
88.5Hz 88.5HZ
94.8Hz 94.8HZ
103.5Hz 103.5HZ
123.0Hz 123.0HZ

#cmdSetup number Level TONES
:read:
:readmath: match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+")
:write: CTCSSLevel (value)KZ
kHz 0.1 30
:update:

#cmdSetup checkbox Send_Tone TONES
:read:
:write: CTCSSSendTone
ON - -
:update:

#cmdSetup buttons Return TONES
:read:
:readmath:
:write: CTCSSReturn
RETURN -
:update: 

#cmdSetup separator - TONES
2 100 Solid

;------------------------------------------------------------------------------------
; AUDIO TAB
;------------------------------------------------------------------------------------

#cmdSetup button Enable_Audio_Test AUDIO
:read: 
:write: EnableAudioTest
:tip: Connect a filter/amplifier between AFGEN OUTPUT and AF INPUT sockets

#cmdSetup checkbox Units AUDIO
:read:
:write: AUDIOUnits (value)
:tip: Units selection only if Distortion OFF
DBV/dBr DB DB
:update:

#cmdSetup number AF_Frequency_ AUDIO
:read: txrx? RD29
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: AUDIOAFFrequency (value)KZ
kHz 0.02 20
:update: AF_Frequency_

#cmdSetup number AF_Frequency_Delta AUDIO
:read: txrx? RD35
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:write: AUDIOAFFreqDelta (value)KZ
kHz 0.02 20 
:update: AF_Frequency_Delta

#cmdSetup buttons AF_Frequency_inc_dec AUDIO
:read: txrx? RD35
:readmath: getMatch(value,"[-+.0-9]+")
:write: AUDIOAFFreqIncDec (value)
INCREMENT FU
DECREMENT FD
:update: AF_Frequency_

#cmdSetup number AF_Level_ AUDIO
:read: txrx? RD30
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")*1000 : getMatch(value,"[-+.0-9]+"))
:write: AUDIOAFLevel (value)MV
mV 0 100000
:update: AF_Level_

#cmdSetup number AF_Level_Delta_ AUDIO
:read: txrx? RD36
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")*1000 : getMatch(value,"[-+.0-9]+"))
:write: AUDIOAFLevelDelta (value)MV
mV 0 2000
:update: AF_Level_Delta_

#cmdSetup buttons AF_Level_inc_dec_ AUDIO
:read: txrx? RD36
:readmath: getMatch(value,"[-+.0-9]+")
:write: AUDIOAFLevelIncDec (value)
INCREMENT LU
DECREMENT LD
:update: AF_Level_

#cmdSetup Combobox Filter AUDIO
:read:
:write: AUDIOAFFilter (value)
300Hz-3.4kHz 0
15/50kHz 1
300Hz 2

#cmdSetup Combobox Distortion AUDIO
:read:
:write: AUDIODistortion (value)
OFF 0
DISTN 3

; Switch to DC only when distortion is OFF
#cmdSetup Combobox Coupling AUDIO
:read: 
:write: ACDCCoupling (value)
:tip: DC coupling only if Distortion OFF
AC AC
DC DC

#cmdSetup combobox Store_in_Memory_# AUDIO
:read: 
:write: StoreMemory
:buttontext: Store
:update:
1 01
2 02
3 03
4 04
5 05 

#cmdSetup combobox Recall_from_Memory_# AUDIO
:read: 
:write: RecallMemory
:buttontext: Recall
:update: AF_Frequency_ AF_Frequency_Delta AF_Level_ AF_Level_Delta_
1 01
2 02
3 03
4 04
5 05 

;------------------------------------------------------------------------------------
; HELP TAB
;------------------------------------------------------------------------------------

#cmdSetup buttons Help HELP
:read:
:readmath:
:write: Help
HELP -
:update: 

#cmdSetup buttons Change_Parameters HELP
:read:
:readmath:
:write: ChangeParameters
CHANGE_PARAMETERS -
:update: 

#cmdSetup buttons Self_Test HELP
:read:
:readmath:
:write: SelfTest
SELF_TEST -
:update: 

#cmdSetup info Software_Version HELP
:read: txrx? VN
:readmath:
:write: SoftwareVersion
:update: 

#cmdSetup buttons Return HELP
:read:
:readmath:
:write: ReturnHelp
RETURN -
:update: 

;------------------------------------------------------------------------------------
; MEASUREMENTS TAB
;------------------------------------------------------------------------------------


#cmdSetup number TX_Frequency MEASUREMENTS
:read: txrx? RD1
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
MHz -1000 1000
:update: 

#cmdSetup number RF_Power MEASUREMENTS
:read: txrx? RD2
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
W 0 75
:update: 

#cmdSetup number Modulation_Frequency_ MEASUREMENTS
:read: txrx? RD3
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
kHz 0 30
:update: 

#cmdSetup number Modulation_Level MEASUREMENTS
:read: txrx? RD4
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
kHz 0 25
:update: 

#cmdSetup number AF_Frequency MEASUREMENTS
:read: txrx? RD5
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
kHz 0 50
:update: 

#cmdSetup number AF_Lev MEASUREMENTS
:read: txrx? RD6
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
mV 0 100000
:update: 

#cmdSetup number RX_Distortion(f=1kHz) MEASUREMENTS
:read: txrx? RD7
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
% 0 100
:update: 

#cmdSetup number TX_Distortion(f=1kHz) MEASUREMENTS
:read: txrx? RD8
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
% 0 100
:update: 

#cmdSetup number Modulation_Peak MEASUREMENTS
:read: txrx? RD9
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
kHz 0 100
:update: 

#cmdSetup number Modulation_Trough MEASUREMENTS
:read: txrx? RD10
:readmath: match(value,"NULL") ? 0 : (match(value,"^[-+.0-9]+(mW|Hz|VL|UV|V)$") ? getMatch(value,"[-+.0-9]+")/1000 : getMatch(value,"[-+.0-9]+"))
:buttontext: GET
kHz 0 100
:update: 


;------------------------------------------------------------------------------------
; ABOUT TAB
;------------------------------------------------------------------------------------

;some fun stuff 
;#cmdSetup button CLICK_ME! ABOUT
;:write: MIClickMe

;#cmdSetup buttons Return_to_measurements ABOUT
;:read:
;:readmath:
;:write: ReturnToMeasurements
;RETURN -
;:update:  