static scpi_result_t DMM_MeasureVoltageAcQ(scpi_t * context) { scpi_number_t param1, param2; char bf[15]; // read first parameter if present if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m1, FALSE)) { // do something, if parameter not present } // read second paraeter if present if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m2, FALSE)) { // do something, if parameter not present } SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m1, bf, 15); printf( "\tP1=%s\r\n", bf); SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m2, bf, 15); printf( "\tP2=%s\r\n", bf); SCPI_ResultDouble(context, 0); return SCPI_RES_OK; }
scpi_result_t DMM_MeasureVoltageAcQ(scpi_t * context) { scpi_number_t param1, param2; char bf[15]; fprintf(stderr, "meas:volt:ac\r\n"); // debug command name // read first parameter if present if (!SCPI_ParamNumber(context, ¶m1, false)) { // do something, if parameter not present } // read second paraeter if present if (!SCPI_ParamNumber(context, ¶m2, false)) { // do something, if parameter not present } SCPI_NumberToStr(context, ¶m1, bf, 15); fprintf(stderr, "\tP1=%s\r\n", bf); SCPI_NumberToStr(context, ¶m2, bf, 15); fprintf(stderr, "\tP2=%s\r\n", bf); SCPI_ResultDouble(context, 0); return SCPI_RES_OK; }
static scpi_result_t DMM_MeasureVoltageAcQ(scpi_t * context) { scpi_number_t param1, param2; char bf[15]; fprintf(stderr, "meas:volt:ac\r\n"); /* debug command name */ /* read first parameter if present */ if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m1, FALSE)) { /* do something, if parameter not present */ } /* read second paraeter if present */ if (!SCPI_ParamNumber(context, scpi_special_numbers_def, ¶m2, FALSE)) { /* do something, if parameter not present */ } SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m1, bf, 15); fprintf(stderr, "\tP1=%s\r\n", bf); SCPI_NumberToStr(context, scpi_special_numbers_def, ¶m2, bf, 15); fprintf(stderr, "\tP2=%s\r\n", bf); SCPI_ResultDouble(context, 0); return SCPI_RES_OK; }
int dscpi_output_load_inner(scpi_t *context, int output) { scpi_number_t load; if (!SCPI_ParamNumber(context, &load, true)) { return SCPI_RES_ERR; } /* gw instek actually only allows a choice, but I haven't tried using number params */ if (output) { SCPI_ResultString(context, "output2_load"); } else { SCPI_ResultString(context, "output1_load"); } if (load.type == SCPI_NUM_INF) { SCPI_ResultString(context, "infinite"); } else if (load.type == SCPI_NUM_DEF) { SCPI_ResultString(context, "default"); } else if (load.type == SCPI_NUM_NUMBER) { if (load.unit == SCPI_UNIT_NONE) { load.unit = SCPI_UNIT_OHM; } SCPI_NumberToStr(context, &load, numbuf, sizeof (numbuf)); printf("setting load %d to %s\n", output + 1, numbuf); SCPI_ResultString(context, numbuf); } else { printf("invalid number argument\n"); return SCPI_RES_ERR; } return SCPI_RES_OK; }
int dscpi_apply_sin_inner(scpi_t *context, int output) { scpi_number_t freq; scpi_number_t ampl; scpi_number_t offset; if (!SCPI_ParamNumber(context, &freq, false)) { /* you can only get here if you gave it a bad pointer */ } else { if (freq.type == SCPI_NUM_DEF) { freq.value = 1000; freq.type = SCPI_NUM_NUMBER; freq.unit = SCPI_UNIT_HERTZ; } if (freq.unit == SCPI_UNIT_NONE) { freq.unit = SCPI_UNIT_HERTZ; } /* handle minimum, maximum, regular*/ } if (!SCPI_ParamNumber(context, &l, false)) { /* bad pointers */ } else { if (ampl.type == SCPI_NUM_DEF) { ampl.type = SCPI_NUM_NUMBER; ampl.unit = SCPI_UNIT_VOLT; ampl.value = 0.1; // 100 mV by default } if (ampl.unit == SCPI_UNIT_NONE) { ampl.unit = SCPI_UNIT_VOLT; } /* handle minimum, maximum, */ /* TODO somehow work out how to handle Vrms units here ?*/ } if (!SCPI_ParamNumber(context, &offset, false)) { /* bad pointers */ } else { if (offset.type == SCPI_NUM_DEF) { offset.type = SCPI_NUM_NUMBER; offset.unit = SCPI_UNIT_VOLT; offset.value = 0; } if (offset.unit == SCPI_UNIT_NONE) { offset.unit = SCPI_UNIT_VOLT; } /* handle minimum, maximum */ } if (output) { SCPI_ResultString(context, "source_apply2_sin"); } else { SCPI_ResultString(context, "source_apply1_sin"); } SCPI_NumberToStr(context, &freq, numbuf, sizeof (numbuf)); printf("setting output %d to sin wave freq: %s", output + 1, numbuf); SCPI_ResultString(context, numbuf); SCPI_NumberToStr(context, &l, numbuf, sizeof (numbuf)); printf("ampl: %s", numbuf); SCPI_ResultString(context, numbuf); SCPI_NumberToStr(context, &offset, numbuf, sizeof (numbuf)); printf("offset: %s", numbuf); SCPI_ResultString(context, numbuf); return SCPI_RES_OK; }