This blog documents focuses on the SCPI functionality of the electronic load that peteroakes, jc2048 and Jan Cumps designed. The interface works with software that can do serial communications on a COM port. This project comes with a LABView driver and 2 proto GUIs. |
SCPI Interface
SCPI Command | status | SCPI standard | Comment | Example |
---|---|---|---|---|
*IDN? | works | Standard SCPI, implemented by library | callsign | THEBREADBOARD,ELECTRONICLOAD,0,01.00 |
*CLS | check | Standard SCPI, implemented by library | ||
SYST:ERR? | works | Standard SCPI, implemented by library | ||
SYST:ERR:COUN? | works | Standard SCPI, implemented by library | ||
SYST:VERS? | works | Standard SCPI, implemented by library | SCPI Standard version | 1999.0 |
*RST | works | Standard SCPI, custom implementation needed | reset to a known status. Switch input off and set to constant current mode. Does not alter stored or temporary calibration settings. | |
*ESE | check | |||
*ESE? | check | |||
*ESR? | check | |||
*OPC | check | |||
*OPC? | check | |||
*SRE | check | |||
*SRE? | check | |||
*STB? | check | |||
*TST? | todo | Standard SCPI, custom implementation needed | Test instrument. Currently does nothing | |
*WAI | check | |||
<read voltage> MEASure:VOLTage:DC? | works | Query the voltage on the voltage sense inputs. | ||
<read current> | todo | |||
<set mode constant current, constant resistance, what have you, ...> [:SOURce]:FUNCtion
values: CURRent RESistance VOLTage POWer | wip | set the constant regulation mode | On reset, always constant current At this time supports constant current | FUNC CURRent FUNC RESistance FUNC VOLTage FUNC POWer |
[:SOURce]:FUNCtion? | wip | get the constant regulation mode | At this time supports constant current | FUNC? |
[:SOURce]:INPut[:STATe] <b> | works | Set the input state to ON or OFF | INP ON INP OFF | |
[:SOURce]:INPut[:STATe]? | works | Query the input state | INP? | |
<limits> | todo | |||
DEVElop:DAC# <16 bit value> | works for DAC1 | Development low level | Send the passed value to the DAC. Currently only for the first DAC | DEVE:DAC1 2000 DEVE:DAC1 #H4000 |
DEVElop:ADC#? DEVElop:ADC#:RAW? DEVElop:ADC#:VOLTage? | works for ADC1 | Development low level | Retrieve the last buffered ADC value. Currently only for ADC 1 - 3 | DEVE:ADC1? DEVE:ADC2:RAW? DEVE:ADC3:VOLT? |
[:SOURce]:CURRent[:LEVel][:IMMediate] | works | Constant Current Mode | Currently accepts RAW DAC value instead of a voltage | CURR 5 |
[:SOURce]:CURRent[:LEVel][:IMMediate]? | works | Retriev@e the set current level | CURR? | |
[:SOURce]:VOLTage[:LEVel][:IMMediate] | todo | Constant Voltage Mode | WIP. Mode not implemented yet | VOLT 2 |
CALibrate | wip | Calibration and Configuration | documented here: Programmable Electronic Load - Calibration Steps | |
For ref: this is what typical instrument (DMM) commands look like We may want to check the commands of a few existing loads, to see if there's a pattern or standard |
---|
/* DMM */ {.pattern = "MEASure:VOLTage:DC?", .callback = DMM_MeasureVoltageDcQ,}, {.pattern = "CONFigure:VOLTage:DC", .callback = DMM_ConfigureVoltageDc,}, {.pattern = "MEASure:VOLTage:DC:RATio?", .callback = SCPI_StubQ,}, {.pattern = "MEASure:VOLTage:AC?", .callback = DMM_MeasureVoltageAcQ,}, {.pattern = "MEASure:CURRent:DC?", .callback = SCPI_StubQ,}, {.pattern = "MEASure:CURRent:AC?", .callback = SCPI_StubQ,}, {.pattern = "MEASure:RESistance?", .callback = SCPI_StubQ,}, {.pattern = "MEASure:FRESistance?", .callback = SCPI_StubQ,}, {.pattern = "MEASure:FREQuency?", .callback = SCPI_StubQ,}, {.pattern = "MEASure:PERiod?", .callback = SCPI_StubQ,}, |
Error Handling
SCPI
good example: https://github.com/eez-open/psu-firmware/tree/master/eez_psu_sketch, in particular https://github.com/eez-open/psu-firmware/blob/master/eez_psu_sketch/scpi_user_config.h
Complete list: SCPI Errors
e.g.: this can be used to report an invalid function call (set constant voltage value when in constant current mode, ...):
-221 | std_settingsConflict | Settings conflict - Indicates that a legal program data element was parsed but could not be executed due to the current device state. |
catch in the SCPI interface:
missing parameter
parameter out of bounds
index out of bounds
- a non-implemented ADC channel:
DEVE:ADC5? SYST:ERR? -131,"Invalid suffix"
- a missing DAC value:
DEVE:DAC2 SYST:ERR? -109,"Missing parameter"
- more than 16 bits to the DAC:
DEVE:DAC1 66666 SYST:ERR? -224,"Illegal parameter value"
Top Comments