diff --git a/servers/gpib_server_lin/src/gpib_functions.cpp b/servers/gpib_server_lin/src/gpib_functions.cpp index e3e3a38..d3e170e 100644 --- a/servers/gpib_server_lin/src/gpib_functions.cpp +++ b/servers/gpib_server_lin/src/gpib_functions.cpp @@ -39,6 +39,9 @@ const char * scopeLongDescription (const char * scopeType) { else if (strcmp("TDS744AOS", scopeType) == 0) { return "Tektronix 744A series"; } + else if (strcmp("TDS744COS", scopeType) == 0) { + return "Tektronix 744C series"; + } else { return "UNKNOWN"; } @@ -128,4 +131,4 @@ int gpib_read_binary(int ud, int max_num_bytes) { return -1; } return 0; -} \ No newline at end of file +} diff --git a/servers/gpib_server_lin/src/scope_functions.cpp b/servers/gpib_server_lin/src/scope_functions.cpp index 96030c4..33d6ebf 100644 --- a/servers/gpib_server_lin/src/scope_functions.cpp +++ b/servers/gpib_server_lin/src/scope_functions.cpp @@ -49,7 +49,8 @@ unsigned long scopeScreenWidth (const char * scopeType) { if (strcmp("HP54600OS", scopeType) == 0) { return 512; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { return 640; } else { @@ -61,7 +62,8 @@ unsigned long scopeScreenHeight (const char * scopeType) { if (strcmp("HP54600OS", scopeType) == 0) { return 280; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { return 480; } else { @@ -73,7 +75,8 @@ unsigned long scopeScreenSize (const char * scopeType) { if (strcmp("HP54600OS", scopeType) == 0) { return scopeScreenWidth(scopeType)*scopeScreenHeight(scopeType)*3; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { return scopeScreenWidth(scopeType)*scopeScreenHeight(scopeType)*3; } else { @@ -139,7 +142,7 @@ int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice) { int k; int m; - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Getting scope screenshot [Stage 2]\n\r"); if (strcmp("HP54600OS", scopeType) == 0) { if (gpib_read_binblock(gpibDevice, 19768, scopeType) == 0) { @@ -149,7 +152,8 @@ int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice) { return 1; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { gpib_read_binary(gpibDevice, scopeScreenSize(scopeType)); int bpp; @@ -188,7 +192,7 @@ int scope_reset(const char * funcgenType, int gpibDevice) { } int scope_get_screenshot(const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Getting scope screenshot [Stage 1]\n\r"); if (strcmp("HP54600OS", scopeType) == 0) { sprintf(falpha, "PRINT?"); @@ -202,7 +206,8 @@ int scope_get_screenshot(const char * scopeType, int gpibDevice) { return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "HARDCOPY:FORMAT BMPCOLOR"); if (gpib_write(gpibDevice, falpha) == 0) { #ifdef ENABLE_EXTRA_DEBUGGING @@ -240,7 +245,7 @@ int scope_get_screenshot(const char * scopeType, int gpibDevice) { } int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting scope timebase to %E\n\r", desired_timebase); if (strcmp("HP54600OS", scopeType) == 0) { sprintf(falpha, "TIM:RANG %E", desired_timebase); @@ -254,7 +259,8 @@ int scope_set_timebase(float desired_timebase,const char * scopeType, int gpibDe return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "HORIZONTAL:MAIN:SCALE %E", desired_timebase); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -285,7 +291,8 @@ int scope_get_timebase(double * retval, const char * scopeType, int gpibDevice) // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { // Send request printf("[INFO] Getting scope timebase\n\r"); sprintf(falpha,"HORIZONTAL:MAIN:SCALE?"); @@ -325,7 +332,7 @@ int scope_get_timebase(double * retval, const char * scopeType, int gpibDevice) } 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)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting scope volts/div on channel %d to %E\n\r", desired_channel, desired_volts); if (strcmp("HP54600OS", scopeType) == 0) { sprintf(falpha, "CHAN%d:RANG %E", desired_channel, desired_volts); @@ -339,7 +346,8 @@ int scope_set_volts_div(int desired_channel, double desired_volts, const char * return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "CH%d:SCALE %E", desired_channel, desired_volts); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -361,7 +369,7 @@ int scope_set_volts_div(int desired_channel, double desired_volts, const char * } int scope_set_acquisition(int status,const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting scope run status to %d\n\r", status); if (strcmp("HP54600OS", scopeType) == 0) { if (status == 0) { @@ -380,7 +388,8 @@ int scope_set_acquisition(int status,const char * scopeType, int gpibDevice) { return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "ACQUIRE:STATE %d", status); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -411,7 +420,8 @@ int scope_get_acquisition(int * retval, const char * scopeType, int gpibDevice) // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { // Send request printf("[INFO] Getting run state\n\r"); sprintf(falpha,"ACQUIRE:STATE?"); @@ -451,7 +461,7 @@ int scope_get_acquisition(int * retval, const char * scopeType, int gpibDevice) } int scope_set_channel_state(int desired_channel, int status,const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting channel %d state to %i\n\r", desired_channel, status); if (strcmp("HP54600OS", scopeType) == 0) { if (status == 0) { @@ -473,7 +483,8 @@ int scope_set_channel_state(int desired_channel, int status,const char * scopeTy return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { if (status == 0) { sprintf(falpha, "SELECT:CH%d OFF", desired_channel); } @@ -514,7 +525,8 @@ int scope_get_channel_state(int * retval, int desired_channel, const char * scop // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "SELECT:CH%d?", desired_channel); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -552,7 +564,7 @@ int scope_get_channel_state(int * retval, int desired_channel, const char * scop } int scope_set_trigger_channel(int desired_channel,const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting scope trigger channel to %d\n\r", desired_channel); if (strcmp("HP54600OS", scopeType) == 0) { sprintf(falpha, "TRIG:SOUR CHAN%d", desired_channel); @@ -566,7 +578,8 @@ int scope_set_trigger_channel(int desired_channel,const char * scopeType, int gp return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "TRIGGER:MAIN:EDGE:SOURCE CH%d", desired_channel); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -598,7 +611,8 @@ int scope_get_trigger_channel(int * retval, const char * scopeType, int gpibDevi // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "TRIGGER:MAIN:EDGE:SOURCE?"); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -646,7 +660,7 @@ int scope_get_trigger_channel(int * retval, const char * scopeType, int gpibDevi } int scope_set_trigger_level(float desired_level,const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting scope trigger level to %f\n\r", desired_level); if (strcmp("HP54600OS", scopeType) == 0) { sprintf(falpha, "TRIG:LEV %E", desired_level); @@ -660,7 +674,8 @@ int scope_set_trigger_level(float desired_level,const char * scopeType, int gpib return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "TRIGGER:MAIN:LEVEL %f", desired_level); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -691,7 +706,8 @@ int scope_get_trigger_level(double * retval, const char * scopeType, int gpibDev // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { // Send request printf("[INFO] Getting trigger level\n\r"); sprintf(falpha,"TRIGGER:MAIN:LEVEL?"); @@ -731,7 +747,7 @@ int scope_get_trigger_level(double * retval, const char * scopeType, int gpibDev } int scope_set_channel_position(int desired_channel, float desired_level,const char * scopeType, int gpibDevice) { - if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0)) { + if ((strcmp("HP54600OS", scopeType) == 0) || (strcmp("TDS744AOS", scopeType) == 0) || (strcmp("TDS744COS", scopeType) == 0)) { printf("[INFO] Setting scope channel %d level to %f\n\r", desired_channel, desired_level); if (strcmp("HP54600OS", scopeType) == 0) { sprintf(falpha, "CHAN%d:OFFS %E", desired_channel, desired_level); @@ -745,7 +761,8 @@ int scope_set_channel_position(int desired_channel, float desired_level,const ch return 2; } } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha, "CH%d:POSITION %f", desired_channel, desired_level); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -774,7 +791,8 @@ int scope_perform_initial_setup(const char * scopeType, int gpibDevice) { // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { sprintf(falpha,"HEAD OFF"); #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Writing: %s\n\r", falpha); @@ -843,7 +861,8 @@ clock_gettime(CLOCK_REALTIME, &tp1); // Not supported (yet) return -1; } - else if (strcmp("TDS744AOS", scopeType) == 0) { + else if ((strcmp("TDS744AOS", scopeType) == 0) + || (strcmp("TDS744COS", scopeType) == 0)) { // We need to get/parse the preamble, then obtain and adjust the trace data sprintf(falpha,"DATA:SOURCE CH%d", desired_channel); #ifdef ENABLE_EXTRA_DEBUGGING @@ -887,6 +906,9 @@ clock_gettime(CLOCK_REALTIME, &tp4); printf("[PROFILE] %f s\n\r", ((tp4.tv_nsec+(tp4.tv_sec*1e9))-(tp3.tv_nsec+(tp3.tv_sec*1e9)))/1e9); #endif TQString preamble(scope_segarray); + #ifdef ENABLE_EXTRA_TRACE_DEBUGGING + printf("[DEBG] Preamble: %s\n", preamble.ascii()); + #endif TQStringList resultPairs = TQStringList::split(";", preamble, FALSE); // Find/initialize critical data values double ymult = 0; @@ -897,16 +919,33 @@ printf("[PROFILE] %f s\n\r", ((tp4.tv_nsec+(tp4.tv_sec*1e9))-(tp3.tv_nsec+(tp3.t double xposition = 0; char* xunits = NULL; - if (resultPairs.count() > 15) { - ymult = resultPairs[13].toDouble(); - yoffset = resultPairs[14].toDouble()*ymult; - yposition = resultPairs[15].toDouble()*ymult; - yunits = strdup(resultPairs[12]); - xincr = resultPairs[9].toDouble(); - xposition = resultPairs[10].toDouble(); - xunits = strdup(resultPairs[8]); + if (strcmp("TDS744AOS", scopeType) == 0) { + if (resultPairs.count() > 15) { + ymult = resultPairs[13].toDouble(); + yoffset = resultPairs[14].toDouble()*ymult; + yposition = resultPairs[15].toDouble()*ymult; + yunits = strdup(resultPairs[12]); + xincr = resultPairs[9].toDouble(); + xposition = resultPairs[10].toDouble(); + xunits = strdup(resultPairs[8]); + } + } + else if (strcmp("TDS744COS", scopeType) == 0) { + if (resultPairs.count() > 15) { + ymult = resultPairs[13].toDouble(); + yoffset = resultPairs[14].toDouble()*ymult; + yposition = resultPairs[15].toDouble()*ymult; + yunits = strdup(resultPairs[12]); + xincr = resultPairs[9].toDouble(); + xposition = resultPairs[10].toDouble(); + xunits = strdup(resultPairs[8]); + } } + #ifdef ENABLE_EXTRA_TRACE_DEBUGGING + printf("[DEBG] Decoded preamble: xincr: %f ymult: %f\n", xincr, ymult); + #endif + // If the units are desired, comment out these lines... if (yunits) { free(yunits); @@ -944,15 +983,23 @@ printf("[PROFILE] %f s\n\r", ((tp6.tv_nsec+(tp6.tv_sec*1e9))-(tp5.tv_nsec+(tp5.t long pointCount = ai/2; double horizPos = 0.0; char yheaderlen[2]; + #ifdef ENABLE_EXTRA_TRACE_DEBUGGING + printf("[DEBG] Point count: %d\n", pointCount); + #endif yheaderlen[0] = scope_segarray[1]; yheaderlen[1] = 0; int data_offset = atoi(yheaderlen) + 2; for (array_pointer=0; array_pointer