
; TestController must be restarted before any changes in this file will be used.

; Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html

#metadef
#idString KORAD,KA3003P
#name Korad KA3003P
#handle KA3003
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 3.1
#removeLine 5A

#metadef
#idString KORAD,KA3005P 
#name Korad KA3005P
#handle KA3005
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 5.1

#metadef
#idString RND,320-KA3005P,
#name RND KA3005P
#handle KA3005
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 5.1

#metadef
#idString KORAD,KD3005P
#name Korad KD3005P
#handle KD3005
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 5.1

#metadef
#idString KORAD,KA3010P
#name Korad KA3010P
#handle KA3010
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 10.1

#metadef
#idString KORAD,KA6002P
#name Korad KA6002P
#handle KA6002
#sections single
#replaceText MaxVoltage 61
#replaceText MaxCurrent 2.1
#removeLine 5A

#metadef
#idString KORAD,KA6003P
#name Korad KA6003P
#handle KA6003
#sections single
#replaceText MaxVoltage 61
#replaceText MaxCurrent 3.1
#removeLine 5A

#metadef
#idString KORAD,KA6005P
#name Korad KA6005P
#handle KA6005
#sections single
#replaceText MaxVoltage 61
#replaceText MaxCurrent 5.1

#metadef
#idString KORAD,KD6005P
#name Korad KD6005P
#handle KD6005
#sections single
#replaceText MaxVoltage 61
#replaceText MaxCurrent 5.1

#metadef
#idString TENMA,72-2550
#name Tenma 72-2550
#handle T2550
#sections single
#replaceText MaxVoltage 61
#replaceText MaxCurrent 3.1
#removeLine 5A

#metadef
#idString TENMA,72-2540
#name Tenma 72-2540
#handle T2540
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 5.1

#metadef
#idString TENMA,72-2535
#name Tenma 72-2535
#handle T2535
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 3.1
#removeLine 5A

#metadef
#idString TENMA,72-2531
#name Tenma 72-2531
#handle T2531
#sections single
#replaceText MaxVoltage 31
#replaceText MaxCurrent 5.1




#meta

#idString KORAD KA3005P
#name Korad KA3005P
#handle KA3005
#port comfixedbaud
; Alternate port types: comnobaud or com, com lets the user define baudrate on the "Load devices" page
#baudrate 9600
#driver SCPIx
#help Korad KAxxxxP

#forceUpperCase 1

#notes On this power supply OCP will turn the output off on overload, instead of using constant current.
OVP will turn output off if over voltage is present on the input.

This supply has a couple of incompatible software versions, TC will not work with all of them.


; Define a version of the command with a space between command and parameters
#scpiCmd vset1 vset1:(value)
#scpiCmd iset1 iset1:(value)
#scpiCmd vset2 vset2:(value)
#scpiCmd iset2 iset2:(value)
#scpiCmd ocp ocp(value)
#scpiCmd ovp ovp(value)
#scpiCmd beep beep(value)
#scpiCmd lock  lock(value)
#scpiCmd out out(value)
#scpiCmd rcl rcl(value)
#scpiCmd sav sav(value)

; Split status byte into separate functions and redefine status command to return a number instead of a byte (That may be lost).
#scpiCmd status? txrx1bin? STATUS?\n;[30]
#scpiCmd statusbin? txrx1bin? STATUS?\n;[30]
:readmath: bin(value)
#scpiCmd out? txrx1bin? STATUS?\n;[30]
:readmath: int(value)&0x40!=0
#scpiCmd beep? txrx1bin? STATUS?\n;[30]
:readmath: int(value)&0x10!=0
#scpiCmd ovp? txrx1bin? STATUS?\n;[30]
:readmath: int(value)&0x80!=0
#scpiCmd ocp? txrx1bin? STATUS?\n;[30]
:readmath: int(value)&0x20!=0

; Fix *idn? by adding commas and swapping serial number and version
#scpiCmd *idn? *IDN?
:readmath: var v=split(value," ");v[0]+","+v[1]+","+replace(v[3],"SN:","")+","+replace(v[2],"V","");


; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6) 
; Format: #value ColumnName Unit Format {Selector}
; Selector is only used when column layout varies with mode, this often require the use of #cmdMode
#metaSection single
#value Voltage V D2
#value Current A D3
#metaSection dual
#value Voltage_1 V D2
#value Current_1 A D3
#value Voltage_2 V D2
#value Current_2 A D3
#metaSection

; How to poll for data, this is used for table and #values?
; a #askMode, #cmdMode and #prepareSample is used before this is string is used.
; Number of returned values must match number of columns defined with #value
; This is a single line command
#metaSection single
#askValues VOUT1?;IOUT1?
#metaSection dual
#askValues VOUT1?;IOUT1?;VOUT2?;IOUT2?
#metaSection 

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

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

; Mode change have a longer delay on reading values (seconds)
#modeChangeDelay 10


; String to ask about actual meter mode, it is mostly used for DMM's
; This is a single line command
;#askMode 


; When one of these commands are used through the command interface a new configuration will be done before using #askMode
; Only one word for each #mayModifyMode
; Specify command without initial colon and in the shortest possible form
;#mayModifyMode 

; Prepare the meter to response to #askValues
;#prepareSample arm:sour imm;:arm:count 1;:trig:sour imm;:trig:count 1;:trig:samp:count 1;init

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

; Final command to meter before breaking connection
#finalCmd OUT0;LOCK0
#outputOff OUT0

#metaSection single
#interfaceType PS
#metaSection dual
#interfaceType PS PS:2
#metaSection
#interface setVoltage VSET(channel):(value)
#interface setCurrent ISET(channel):(value)
#interface setOVP OVP(value)
#interface setOCP OCP(value)
#interface setOn OUT(value)
#interface getVoltage VSET(channel)?
#interface getCurrent ISET(channel)?
#interface getOVP OVP?
#interface getOCP OCP?
#interface getOn OUT?
#interface readVoltage 0
#interface readCurrent 1

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

; Setup menu functions
; The parameters on the first line is: type name page 
; Settings on the following lines are:
; read: SCPI to read value from device, is used to synchronize when opening setup page or setting equal named fields. Not always used
; readformat: Parse read value.
; write: Send the value to device, this field is used in combination with data fields in the details to send updates to device.
; tip: Add this tip to all components for this input field.
#cmdSetup radio Voltage Main
:read: VSET1?
:write: OUT0;VSET1:#;OUT1
:update: Output
:tip: Setup this voltage, turn output on
3.3V 3.3
5V 5.0
12V 12.0
24V 24.0

#cmdSetup radio Current Main
:read: ISET1?
:write: ISET1:#
:tip: Output will current limit at this current
100mA 0.1
300mA 0.3
1A 1.0
3A 3.0
5A 5.0

#cmdSetup buttonsOn Output Main
:read: out?
:write: OUT#
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

#metaSection single
#cmdSetup number Voltage Main
:read: VSET1?
:write: VSET1:#
:tip: Setup this voltage, do not turn output on/off
Volt 0 MaxVoltage

#cmdSetup number Current Main
:read: ISET1?
:write: ISET1:#
:tip: Setup this current, do not turn output on/off
Amps 0 MaxCurrent

#metaSection dual

#cmdSetup number Voltage_1 Main
:read: VSET1?
:write: VSET1:#
:tip: Setup this voltage, do not turn output on/off
Volt 0 MaxVoltage

#cmdSetup number Current_1 Main
:read: ISET1?
:write: ISET1:#
:tip: Setup this current, do not turn output on/off
Amps 0 MaxCurrent


#cmdSetup number Voltage_2 Main
:read: VSET2?
:write: VSET2:#
:tip: Setup this voltage, do not turn output on/off
Volt 0 MaxVoltage

#cmdSetup number Current_2 Main
:read: ISET2?
:write: ISET2:#
:tip: Setup this current, do not turn output on/off
Amps 0 MaxCurrent

#metaSection

#cmdSetup buttonsOn OVP Other
:read: ovp?
:color: cyan
:write: OVP#
Disable 0
Enable 1

#cmdSetup buttonsOn OCP Other
:read: ocp?
:color: cyan
:write: OCP#
Disable 0
Enable 1

#cmdSetup buttonsOn Beep Other
:read: beep?
:color: blue
:write: BEEP#
Disable 0
Enable 1

#cmdSetup buttons Lock Other
:write: LOCK#
Off 0
On 1

#cmdSetup buttons Load Other
:write: RCL#
:update: Current Voltage
M1 1
M2 2
M3 3
M4 4
M5 5

#cmdSetup buttons Save Other
:write: SAV#
M1 1
M2 2
M3 3
M4 4
M5 5
