]> sigrok.org Git - libsigrok.git/commitdiff
scpi-dmm: use different Agilent SCPI command for range and measurment
authorGerhard Sittig <redacted>
Sat, 22 May 2021 08:29:37 +0000 (10:29 +0200)
committerGerhard Sittig <redacted>
Tue, 1 Jun 2021 06:20:59 +0000 (08:20 +0200)
Don't use the "[SENS:]<mode>:RANGE..." request on Agilent protocol
speaking devices. Use "CONF:<mode> [<range>]" 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
src/hardware/scpi-dmm/protocol.c

index b0689516fb3cf417d2b11c1c6117c2ce3607896f..a462fdcf5ef6830fac9af99ce9c3cbb3189445c4 100644 (file)
@@ -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_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_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,
 };
 
        ALL_ZERO,
 };
 
index 97a783fe387f4aec29157c5cb250beb08463b021..1a967358907099261627d4d364c032b6329027ac 100644 (file)
@@ -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);
 
        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;
 
        if (ret != SR_OK)
                return ret;