Thanks HKJ, we are nearly there.
Turning ON and OFF the individual channels is working now. Your tip helped to get rid of the space in the SCPI command.
Only the indicator of the two buttonsOn controls (CH1_Output and CH2_Output) is not working yet.
Isolating the bit is done with :readmath:
The main question is how the value is returned from the power supply, if it is a binary value you need to use "#driver SCPIx" and a txrxbin command. If it is a number (hex or decimal) in ascii format you can work directly with it (You may need to add a 0x before a hex value).
The value of the status word that is returned is a hex number, and I am now able to isolate the CH1 and CH2 status bits from the returned hex value.
I have now the following definition for the Off and On buttons for CH1:
#cmdSetup buttonsOn CH1_Output
:read: SYST:STAT?
:readmath: binConvBit(value,4,1)
:write: OUTP CH1,#
:updatealloff:
:tip: Turn CH1 output On or Off
:color: (0,240,0)
Off OFF
On ON
When I open the Setup window, the indicator lights are ON for a fraction of a second, and then they are turned OFF again (actually the indicators become _very_ faint, i.e. hardly visible). This behavior is independent from the output state (ON or OFF) of CH1 and CH2.
When I click on the CH1_Output OFF button, the debug window shows following response:
;; SPD33: Tx <OUTP CH1,OFF>
;; SPD33: Tx <SYST:STAT?>
;; SPD33: Rx <0x4>
;; SPD33: Rx after :readmath: binConvBit(value,4,1) <0>
;; SPD33: Rx as number <0.0>
And when I click the CH1_Output ON button, I get following response:
;; SPD33: Tx <OUTP CH1,ON>
;; SPD33: Tx <SYST:STAT?>
;; SPD33: Rx <0x14>
;; SPD33: Rx after :readmath: binConvBit(value,4,1) <1>
;; SPD33: Rx as number <1.0>
So the CH1 output status bit is correctly isolated (value 0 when OFF, value 1 when ON), but the indicator light stays off.
The help for buttonsOn says:
buttonsOn
One or more buttons on a line with a indicator last on the line. A :read: tag is needed to get the status for the indicator, it will be on if the read value matches second parameter line. The rest is similar to buttons.
The read result is supposed to be a numeric result, use a :string: tag for a non-numeric result.
If I understand correctly the second parameter line is (correct me if I am wrong):
On ON
Do I somehow need to translate numerical value "1" to text string "ON" or vice versa for a correct comparison?
Can you advise?
Latest definition file is attached FYI.
UPDATE: Latest definition file is attached to
Reply #2094.