scpi-dmm: Added minimal support for HP34401A (PR #36)
This commit is contained in:
parent
cf6beeb20d
commit
a16198316f
|
@ -49,6 +49,34 @@ static const struct scpi_command cmdset_agilent[] = {
|
|||
ALL_ZERO,
|
||||
};
|
||||
|
||||
/*
|
||||
* cmdset_hp is used for the 34401A, which was added to this code after the
|
||||
* 34405A and 34465A. It differs in starting the measurement with INIT: using
|
||||
* MEAS without a trailing '?' (as used for the 34405A) is not valid for the
|
||||
* 34401A and gives an error.
|
||||
* I'm surprised the same instruction sequence doesn't work and INIT may
|
||||
* work for both, but I don't have the others to re-test.
|
||||
*
|
||||
* On the 34401A,
|
||||
* MEAS <optional parameters> ? configures, arms, triggers and waits
|
||||
* for a reading
|
||||
* CONF <parameters> configures
|
||||
* INIT prepares for triggering (trigger mode is not set, assumed
|
||||
* internal - external might time out)
|
||||
* *OPC waits for completion, and
|
||||
* READ? retrieves the result
|
||||
*/
|
||||
static const struct scpi_command cmdset_hp[] = {
|
||||
{ DMM_CMD_SETUP_REMOTE, "\n", },
|
||||
{ DMM_CMD_SETUP_FUNC, "CONF:%s", },
|
||||
{ DMM_CMD_QUERY_FUNC, "CONF?", },
|
||||
{ DMM_CMD_START_ACQ, "INIT", },
|
||||
{ DMM_CMD_STOP_ACQ, "ABORT", },
|
||||
{ DMM_CMD_QUERY_VALUE, "READ?", },
|
||||
{ DMM_CMD_QUERY_PREC, "CONF?", },
|
||||
ALL_ZERO,
|
||||
};
|
||||
|
||||
static const struct mqopt_item mqopts_agilent_34405a[] = {
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_DC, "VOLT:DC", "VOLT ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT:AC ", NO_DFLT_PREC, },
|
||||
|
@ -62,18 +90,41 @@ static const struct mqopt_item mqopts_agilent_34405a[] = {
|
|||
{ SR_MQ_FREQUENCY, 0, "FREQ", "FREQ ", NO_DFLT_PREC, },
|
||||
};
|
||||
|
||||
static const struct mqopt_item mqopts_agilent_34401a[] = {
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_DC, "VOLT:DC", "VOLT ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT:AC ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_CURRENT, SR_MQFLAG_DC, "CURR:DC", "CURR ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_CURRENT, SR_MQFLAG_AC, "CURR:AC", "CURR:AC ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_RESISTANCE, 0, "RES", "RES ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_RESISTANCE, SR_MQFLAG_FOUR_WIRE, "FRES", "FRES ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_CONTINUITY, 0, "CONT", "CONT", -1, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_DC | SR_MQFLAG_DIODE, "DIOD", "DIOD", -4, },
|
||||
{ SR_MQ_FREQUENCY, 0, "FREQ", "FREQ ", NO_DFLT_PREC, },
|
||||
{ SR_MQ_TIME, 0, "PER", "PER ", NO_DFLT_PREC, },
|
||||
};
|
||||
|
||||
SR_PRIV const struct scpi_dmm_model models[] = {
|
||||
{
|
||||
"Agilent", "34405A",
|
||||
1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
0,
|
||||
},
|
||||
{
|
||||
"Keysight", "34465A",
|
||||
1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
0,
|
||||
},
|
||||
{
|
||||
"HP", "34401A",
|
||||
1, 6, cmdset_hp, ARRAY_AND_SIZE(mqopts_agilent_34401a),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
/* 34401A: typ. 1020ms for AC readings (default is 1000ms). */
|
||||
1000 * 1500,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -129,7 +180,8 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
|
|||
sdi->driver = &scpi_dmm_driver_info;
|
||||
sdi->inst_type = SR_INST_SCPI;
|
||||
sr_scpi_hw_info_free(hw_info);
|
||||
|
||||
if (model->read_timeout_us) /* non-default read timeout */
|
||||
scpi->read_timeout_us = model->read_timeout_us;
|
||||
devc = g_malloc0(sizeof(*devc));
|
||||
sdi->priv = devc;
|
||||
devc->num_channels = model->num_channels;
|
||||
|
|
|
@ -386,6 +386,9 @@ SR_PRIV int scpi_dmm_get_meas_agilent(const struct sr_dev_inst *sdi, size_t ch)
|
|||
case SR_MQ_FREQUENCY:
|
||||
unit = SR_UNIT_HERTZ;
|
||||
break;
|
||||
case SR_MQ_TIME:
|
||||
unit = SR_UNIT_SECOND;
|
||||
break;
|
||||
default:
|
||||
return SR_ERR_NA;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ struct scpi_dmm_model {
|
|||
int (*get_measurement)(const struct sr_dev_inst *sdi, size_t ch);
|
||||
const uint32_t *devopts;
|
||||
size_t devopts_size;
|
||||
unsigned int read_timeout_us; /* If zero, use default from src/scpi/scpi.c. */
|
||||
};
|
||||
|
||||
struct dev_context {
|
||||
|
|
Loading…
Reference in New Issue