; HP 6624A four channel power supply (40W x 4)
; Tested with AR488 GPIB adapter
;
; Revision 0.9 	15 May 2022		Basic functions working 
; Revision 1.0 	17 May 2022		Added interface commands 

#idString HEWLETT-PACKARD,HP6624A,
#name HP 6624A
#handle HP6624A
#port GPIB
#driver Ascii
#author Chernobyl

#scpiCmd model? txrx? ID?
#scpiCmd getDeviceSW? txrx? ROM?
#verifyDevice HP6624A model?

; A list of possible column name with unit and formatter (SI, Time, Int, D0..D6)
#value V1 Volts D3 
#value I1 Amp D3 
#value V2 Volts D3 
#value I2 Amp D3 
#value V3 Volts D3 
#value I3 Amp D3 
#value V4 Volts D3 
#value I4 Amp D3 

; 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.

; Synthetic Commands
#scpiCmd READ:DATA? txrx? ++read eoi
#scpiCmd setV tx VSET(channel),(value)
#scpiCmd setC tx ISET(channel),(value)
#scpiCmd setOutput tx OUT(channel),(value)
#scpiCmd getV? txrx? VOUT?(channel)
#scpiCmd getC? txrx? IOUT?(channel)
#scpiCmd getOut? txrx? OUT?(channel) 
#scpiCmd setV1 tx VSET1,(value)
#scpiCmd setC1 tx ISET1,(value)
#scpiCmd setV2 tx VSET2,(value)
#scpiCmd setC2 tx ISET2,(value)
#scpiCmd setV3 tx VSET3,(value)
#scpiCmd setC3 tx ISET3,(value)
#scpiCmd setV4 tx VSET4,(value)
#scpiCmd setC4 tx ISET4,(value)
#scpiCmd setOut1 tx OUT1,(value)
#scpiCmd setOut2 tx OUT2,(value)
#scpiCmd setOut3 tx OUT3,(value)
#scpiCmd setOut4 tx OUT4,(value)
#scpiCmd getVS1? txrx? VSET?1
#scpiCmd getCS1? txrx? ISET?1
#scpiCmd getVS2? txrx? VSET?2
#scpiCmd getCS2? txrx? ISET?2
#scpiCmd getVS3? txrx? VSET?3
#scpiCmd getCS3? txrx? ISET?3
#scpiCmd getVS4? txrx? VSET?4
#scpiCmd getCS4? txrx? ISET?4
#scpiCmd getV1? txrx? VOUT?1
#scpiCmd getC1? txrx? IOUT?1
#scpiCmd getV2? txrx? VOUT?2
#scpiCmd getC2? txrx? IOUT?2
#scpiCmd getV3? txrx? VOUT?3
#scpiCmd getC3? txrx? IOUT?3
#scpiCmd getV4? txrx? VOUT?4
#scpiCmd getC4? txrx? IOUT?4
#scpiCmd getOut1? txrx? OUT?1
#scpiCmd getOut2? txrx? OUT?2
#scpiCmd getOut3? txrx? OUT?3
#scpiCmd getOut4? txrx? OUT?4


; 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
#askValues getV1?;getC1?;getV2?;getC2?;getV3?;getC3?;getV4?;getC4?

; Format of answer: f=float, u=remove trailing letters, x=skip
#askValuesReadFormat

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

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

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

; String to ask about actual meter mode, 
; 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

; Initial commands to meter when establishing connection
#initCmd tx CLR; tx SRQ 3

; Final command to meter before breaking connection
;#finalCmd

#outputOff tx OUT1,0;tx OUT2,0;tx OUT3,0;tx OUT4,0

; 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 

#interfaceType PS PS:2 PS:3 PS:4
#interface setVoltage setV(channel) (value)
#interface setCurrent setC(channel) (value)
#interface setOn setOutput(channel) (value)
#interface getVoltage getV?(channel)
#interface getCurrent getC?(channel)
#interface getOn getOut?(channel) 
#interface readVoltage 0 2 4 5
#interface readCurrent 1 3 5 7

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

#cmdSetup color - Channel_1
(255,255,16)

#cmdSetup radio Voltage Channel_1
:read: getVS1?
:write: setV1 (value)
:tip: Setup this voltage, turn output on
3.3V 3.3
5V 5
12V 12
15V 15
20V 20

#cmdSetup radio Current Channel_1
:read: getCS1?
:write: setC1 (value)
:tip: Output will current limit at this current
500mA 0.5
1A 1
2A 2
2.5A 2.5
5A 5

#cmdSetup buttonsOn Output Channel_1
:read: getOut1?
:write: setOut1
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

#cmdSetup number Voltage Channel_1
:read: getVS1?
:write: setV1 (value)
:tip: Setup this voltage, do not turn output on/off
Volt 0 20.5

#cmdSetup number Current Channel_1
:read: getCS1?
:write: setC1 (value)
:tip: Setup this current, do not turn output on/off
Amps 0.1 5.1

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

#cmdSetup color - Channel_2
(250,141,247)

#cmdSetup radio Voltage Channel_2
:read: getVS2?
:write: setV2 (value)
:tip: Setup this voltage, turn output on
3.3V 3.3
5V 5
12V 12
15V 15
20V 20

#cmdSetup radio Current Channel_2
:read: getCS2?
:write: setC2 (value)
:tip: Output will current limit at this current
500mA 0.5
1A 1
2A 2
2.5A 2.5
5A 5

#cmdSetup buttonsOn Output Channel_2
:read: getOut2?
:write: setOut2
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

#cmdSetup number Voltage Channel_2
:read: getVS2?
:write: setV2 (value)
:tip: Setup this voltage, do not turn output on/off
Volt 0 20.5

#cmdSetup number Current Channel_2
:read: getCS2?
:write: setC2 (value)
:tip: Setup this current, do not turn output on/off
Amps 0.1 5.1

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

#cmdSetup color - Channel_3
(9,255,249)

#cmdSetup radio Voltage Channel_3
:read: getVS3?
:write: setV3 (value)
:tip: Setup this voltage, turn output on
12V 12
24V 24
30V 30
48V 48

#cmdSetup radio Current Channel_3
:read: getCS3?
:write: setC3 (value)
:tip: Output will current limit at this current
500mA 0.5
1A 1
2A 2

#cmdSetup buttonsOn Output Channel_3
:read: getOut3?
:write: setOut3
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

#cmdSetup number Voltage Channel_3
:read: getVS1?
:write: setV3 (value)
:tip: Setup this voltage, do not turn output on/off
Volt 0 50.5

#cmdSetup number Current Channel_3
:read: getCS3?
:write: setC3 (value)
:tip: Setup this current, do not turn output on/off
Amps 0.1 2.1


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

#cmdSetup color - Channel_4
(1,254,58)

#cmdSetup radio Voltage Channel_4
:read: getVS4?
:write: setV4 (value)
:tip: Setup this voltage, turn output on
12V 12
24V 24
30V 30
48V 48

#cmdSetup radio Current Channel_4
:read: getCS4?
:write: setC4 (value)
:tip: Output will current limit at this current
500mA 0.5
1A 1
2A 2

#cmdSetup buttonsOn Output Channel_4
:read: getOut4?
:write: setOut4
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

#cmdSetup number Voltage Channel_4
:read: getVS4?
:write: setV4 (value)
:tip: Setup this voltage, do not turn output on/off
Volt 0 50.5

#cmdSetup number Current Channel_4
:read: getCS4?
:write: setC4 (value)
:tip: Setup this current, do not turn output on/off
Amps 0.1 2.1

