|
|
|
@ -273,6 +273,55 @@ int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDe
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int scope_get_timebase(double * retval, const char * scopeType, int gpibDevice) {
|
|
|
|
|
char floatstring[1024];
|
|
|
|
|
long ai;
|
|
|
|
|
int max_num_bytes = 0;
|
|
|
|
|
|
|
|
|
|
if (strcmp("HP54600OS", scopeType) == 0) {
|
|
|
|
|
// FIXME
|
|
|
|
|
// Not supported (yet)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp("TDS744AOS", scopeType) == 0) {
|
|
|
|
|
// Send request
|
|
|
|
|
printf("[INFO] Getting scope timebase\n\r");
|
|
|
|
|
sprintf(falpha,"HORIZONTAL:MAIN:SCALE?");
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Writing: %s\n\r", falpha);
|
|
|
|
|
#endif
|
|
|
|
|
if (gpib_write(gpibDevice, falpha) == 0) {
|
|
|
|
|
max_num_bytes = 24; // Request more bytes than are possible to ensure no bytes are left behind
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Read response
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Trying to read %i bytes from GPIB device...\n", max_num_bytes);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
ai = gpib_read_array(gpibDevice, max_num_bytes, floatstring);
|
|
|
|
|
if (ai == -1) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
floatstring[ai]=0;
|
|
|
|
|
*retval = atof(floatstring)*10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_EXTRA_DEBUGGING
|
|
|
|
|
printf("[DEBG] Read %li bytes from GPIB device\n", ai);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int scope_set_volts_div(int desired_channel, double desired_volts, const char * scopeType, int gpibDevice) {
|
|
|
|
|
if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) {
|
|
|
|
|
printf("[INFO] Setting scope volts/div on channel %d to %E\n\r", desired_channel, desired_volts);
|
|
|
|
|