|
|
@ -16,6 +16,8 @@ static char sbuf[256]; |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_CLS(const SCPI_argval_t *args) |
|
|
|
static void builtin_CLS(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// clear the registers
|
|
|
|
// clear the registers
|
|
|
|
SCPI_REG_SESR.u8 = 0; |
|
|
|
SCPI_REG_SESR.u8 = 0; |
|
|
|
SCPI_REG_OPER.u16 = 0; |
|
|
|
SCPI_REG_OPER.u16 = 0; |
|
|
@ -32,6 +34,8 @@ static void builtin_CLS(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_RST(const SCPI_argval_t *args) |
|
|
|
static void builtin_RST(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
if (scpi_user_RST) { |
|
|
|
if (scpi_user_RST) { |
|
|
|
scpi_user_RST(); |
|
|
|
scpi_user_RST(); |
|
|
|
} |
|
|
|
} |
|
|
@ -40,6 +44,8 @@ static void builtin_RST(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_TSTq(const SCPI_argval_t *args) |
|
|
|
static void builtin_TSTq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
if (scpi_user_TSTq) { |
|
|
|
if (scpi_user_TSTq) { |
|
|
|
scpi_user_TSTq(); |
|
|
|
scpi_user_TSTq(); |
|
|
|
} |
|
|
|
} |
|
|
@ -48,6 +54,8 @@ static void builtin_TSTq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_IDNq(const SCPI_argval_t *args) |
|
|
|
static void builtin_IDNq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
scpi_send_string(scpi_device_identifier()); |
|
|
|
scpi_send_string(scpi_device_identifier()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -61,6 +69,8 @@ static void builtin_ESE(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_ESEq(const SCPI_argval_t *args) |
|
|
|
static void builtin_ESEq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_SESR_EN.u8); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_SESR_EN.u8); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -68,6 +78,8 @@ static void builtin_ESEq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_ESRq(const SCPI_argval_t *args) |
|
|
|
static void builtin_ESRq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_SESR.u8); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_SESR.u8); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
|
|
|
|
|
|
|
@ -78,6 +90,8 @@ static void builtin_ESRq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_OPC(const SCPI_argval_t *args) |
|
|
|
static void builtin_OPC(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// implementation for instruments with no overlapping commands.
|
|
|
|
// implementation for instruments with no overlapping commands.
|
|
|
|
// Can be overridden in the user commands.
|
|
|
|
// Can be overridden in the user commands.
|
|
|
|
SCPI_REG_SESR.OPC = 1; |
|
|
|
SCPI_REG_SESR.OPC = 1; |
|
|
@ -87,6 +101,8 @@ static void builtin_OPC(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_OPCq(const SCPI_argval_t *args) |
|
|
|
static void builtin_OPCq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// implementation for instruments with no overlapping commands.
|
|
|
|
// implementation for instruments with no overlapping commands.
|
|
|
|
// Can be overridden in the user commands.
|
|
|
|
// Can be overridden in the user commands.
|
|
|
|
// (would be): sprintf(sbuf, "%d", SCPI_REG_SESR.OPC);
|
|
|
|
// (would be): sprintf(sbuf, "%d", SCPI_REG_SESR.OPC);
|
|
|
@ -104,6 +120,8 @@ static void builtin_SRE(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_SREq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SREq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_SRE.u8); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_SRE.u8); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -111,6 +129,8 @@ static void builtin_SREq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STBq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STBq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_STB.u8); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_STB.u8); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -118,12 +138,16 @@ static void builtin_STBq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_WAI(const SCPI_argval_t *args) |
|
|
|
static void builtin_WAI(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// no-op
|
|
|
|
// no-op
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void builtin_SYST_ERR_NEXTq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_ERR_NEXTq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
scpi_read_error(sbuf); |
|
|
|
scpi_read_error(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -132,6 +156,8 @@ static void builtin_SYST_ERR_NEXTq(const SCPI_argval_t *args) |
|
|
|
// optional
|
|
|
|
// optional
|
|
|
|
static void builtin_SYST_ERR_ALLq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_ERR_ALLq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
int cnt = 0; |
|
|
|
while (scpi_error_count()) { |
|
|
|
while (scpi_error_count()) { |
|
|
|
scpi_read_error(sbuf); |
|
|
|
scpi_read_error(sbuf); |
|
|
@ -145,6 +171,8 @@ static void builtin_SYST_ERR_ALLq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_SYST_ERR_CODE_NEXTq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_ERR_CODE_NEXTq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
scpi_read_error(sbuf); |
|
|
|
scpi_read_error(sbuf); |
|
|
|
|
|
|
|
|
|
|
|
// end at comma
|
|
|
|
// end at comma
|
|
|
@ -162,6 +190,8 @@ static void builtin_SYST_ERR_CODE_NEXTq(const SCPI_argval_t *args) |
|
|
|
// optional
|
|
|
|
// optional
|
|
|
|
static void builtin_SYST_ERR_CODE_ALLq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_ERR_CODE_ALLq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
int cnt = 0; |
|
|
|
int cnt = 0; |
|
|
|
while (scpi_error_count()) { |
|
|
|
while (scpi_error_count()) { |
|
|
|
scpi_read_error(sbuf); |
|
|
|
scpi_read_error(sbuf); |
|
|
@ -185,6 +215,8 @@ static void builtin_SYST_ERR_CODE_ALLq(const SCPI_argval_t *args) |
|
|
|
// optional
|
|
|
|
// optional
|
|
|
|
static void builtin_SYST_ERR_COUNq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_ERR_COUNq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", scpi_error_count()); |
|
|
|
sprintf(sbuf, "%d", scpi_error_count()); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -193,18 +225,24 @@ static void builtin_SYST_ERR_COUNq(const SCPI_argval_t *args) |
|
|
|
// optional, custom
|
|
|
|
// optional, custom
|
|
|
|
static void builtin_SYST_ERR_CLEAR(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_ERR_CLEAR(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
scpi_clear_errors(); |
|
|
|
scpi_clear_errors(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void builtin_SYST_VERSq(const SCPI_argval_t *args) |
|
|
|
static void builtin_SYST_VERSq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
scpi_send_string("1999.0"); // implemented SCPI version
|
|
|
|
scpi_send_string("1999.0"); // implemented SCPI version
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_OPER_EVENq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_OPER_EVENq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// read and clear
|
|
|
|
// read and clear
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_OPER.u16); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_OPER.u16); |
|
|
|
SCPI_REG_OPER.u16 = 0x0000; |
|
|
|
SCPI_REG_OPER.u16 = 0x0000; |
|
|
@ -215,6 +253,8 @@ static void builtin_STAT_OPER_EVENq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_OPER_CONDq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_OPER_CONDq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// read and keep
|
|
|
|
// read and keep
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_OPER.u16); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_OPER.u16); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
@ -230,6 +270,8 @@ static void builtin_STAT_OPER_ENAB(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_OPER_ENABq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_OPER_ENABq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_OPER_EN.u16); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_OPER_EN.u16); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -237,6 +279,8 @@ static void builtin_STAT_OPER_ENABq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_QUES_EVENq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_QUES_EVENq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// read and clear
|
|
|
|
// read and clear
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_QUES.u16); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_QUES.u16); |
|
|
|
SCPI_REG_QUES.u16 = 0x0000; |
|
|
|
SCPI_REG_QUES.u16 = 0x0000; |
|
|
@ -247,6 +291,8 @@ static void builtin_STAT_QUES_EVENq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_QUES_CONDq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_QUES_CONDq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// read and keep
|
|
|
|
// read and keep
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_QUES.u16); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_QUES.u16); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
@ -262,6 +308,8 @@ static void builtin_STAT_QUES_ENAB(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_QUES_ENABq(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_QUES_ENABq(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
sprintf(sbuf, "%d", SCPI_REG_QUES_EN.u16); |
|
|
|
sprintf(sbuf, "%d", SCPI_REG_QUES_EN.u16); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
scpi_send_string(sbuf); |
|
|
|
} |
|
|
|
} |
|
|
@ -269,6 +317,8 @@ static void builtin_STAT_QUES_ENABq(const SCPI_argval_t *args) |
|
|
|
|
|
|
|
|
|
|
|
static void builtin_STAT_PRES(const SCPI_argval_t *args) |
|
|
|
static void builtin_STAT_PRES(const SCPI_argval_t *args) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
(void)args; |
|
|
|
|
|
|
|
|
|
|
|
// Command required by SCPI spec, useless for this SCPI implementation.
|
|
|
|
// Command required by SCPI spec, useless for this SCPI implementation.
|
|
|
|
// This is meant to preset transition and filter registers, which are not used here.
|
|
|
|
// This is meant to preset transition and filter registers, which are not used here.
|
|
|
|
|
|
|
|
|
|
|
|