From b74cc88d328eb3b7d2c0c1df8fed84131815a9f3 Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sat, 22 May 2021 10:29:37 +0200 Subject: [PATCH] scpi-dmm: use different Agilent SCPI command for range and measurment Don't use the "[SENS:]:RANGE..." request on Agilent protocol speaking devices. Use "CONF: []" instead. This was tested with all devices which reference this model. In theory there is the question whether previously configured ranges should be re-used when (exclusively) the MQ is switched. It's assumed that this is not useful, instead users or their applications should select the function first and optionally pick the range then. Re-use of e.g. 10k resistance range when switching to capacitance might be seen as confusing (and results in errors in the device). Use the combination of INIT and FETCH? to get measurements. The READ? request is more complex and might "undo" what INIT already initiated. This improves perception of the 34405A meter's operation. --- src/hardware/scpi-dmm/api.c | 5 ++--- src/hardware/scpi-dmm/protocol.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/hardware/scpi-dmm/api.c b/src/hardware/scpi-dmm/api.c index b0689516..a462fdcf 100644 --- a/src/hardware/scpi-dmm/api.c +++ b/src/hardware/scpi-dmm/api.c @@ -54,12 +54,11 @@ static const struct scpi_command cmdset_agilent[] = { { DMM_CMD_QUERY_FUNC, "CONF?", }, { DMM_CMD_START_ACQ, "INIT", }, { DMM_CMD_STOP_ACQ, "ABORT", }, - { DMM_CMD_QUERY_VALUE, "READ?", }, + { DMM_CMD_QUERY_VALUE, "FETCH?", }, { DMM_CMD_QUERY_PREC, "CONF?", }, { DMM_CMD_QUERY_RANGE_AUTO, "%s:RANGE:AUTO?", }, { DMM_CMD_QUERY_RANGE, "%s:RANGE?", }, - { DMM_CMD_SETUP_RANGE_AUTO, "%s:RANGE:AUTO ON", }, - { DMM_CMD_SETUP_RANGE, "%s:RANGE %s", }, + { DMM_CMD_SETUP_RANGE, "CONF:%s %s", }, ALL_ZERO, }; diff --git a/src/hardware/scpi-dmm/protocol.c b/src/hardware/scpi-dmm/protocol.c index 97a783fe..1a967358 100644 --- a/src/hardware/scpi-dmm/protocol.c +++ b/src/hardware/scpi-dmm/protocol.c @@ -237,9 +237,8 @@ SR_PRIV int scpi_dmm_set_range_from_text(const struct sr_dev_inst *sdi, is_auto = g_ascii_strcasecmp(range, "auto") == 0; scpi_dmm_cmd_delay(sdi->conn); - ret = sr_scpi_cmd(sdi, devc->cmdset, 0, NULL, - is_auto ? DMM_CMD_SETUP_RANGE_AUTO : DMM_CMD_SETUP_RANGE, - item->scpi_func_setup, is_auto ? "" : range); + ret = sr_scpi_cmd(sdi, devc->cmdset, 0, NULL, DMM_CMD_SETUP_RANGE, + item->scpi_func_setup, is_auto ? "AUTO" : range); if (ret != SR_OK) return ret; -- 2.30.2