@ -49,7 +49,8 @@ unsigned long scopeScreenWidth (const char * scopeType) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
return 512 ;
return 512 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
return 640 ;
return 640 ;
}
}
else {
else {
@ -61,7 +62,8 @@ unsigned long scopeScreenHeight (const char * scopeType) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
return 280 ;
return 280 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
return 480 ;
return 480 ;
}
}
else {
else {
@ -73,7 +75,8 @@ unsigned long scopeScreenSize (const char * scopeType) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
return scopeScreenWidth ( scopeType ) * scopeScreenHeight ( scopeType ) * 3 ;
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 ;
return scopeScreenWidth ( scopeType ) * scopeScreenHeight ( scopeType ) * 3 ;
}
}
else {
else {
@ -139,7 +142,7 @@ int scope_get_screenshot_stage2(const char * scopeType, int gpibDevice) {
int k ;
int k ;
int m ;
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 " ) ;
printf ( " [INFO] Getting scope screenshot [Stage 2] \n \r " ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( gpib_read_binblock ( gpibDevice , 19768 , 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 ;
return 1 ;
}
}
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
gpib_read_binary ( gpibDevice , scopeScreenSize ( scopeType ) ) ;
gpib_read_binary ( gpibDevice , scopeScreenSize ( scopeType ) ) ;
int bpp ;
int bpp ;
@ -188,7 +192,7 @@ int scope_reset(const char * funcgenType, int gpibDevice) {
}
}
int scope_get_screenshot ( const char * scopeType , 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 " ) ;
printf ( " [INFO] Getting scope screenshot [Stage 1] \n \r " ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
sprintf ( falpha , " PRINT? " ) ;
sprintf ( falpha , " PRINT? " ) ;
@ -202,7 +206,8 @@ int scope_get_screenshot(const char * scopeType, int gpibDevice) {
return 2 ;
return 2 ;
}
}
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
sprintf ( falpha , " HARDCOPY:FORMAT BMPCOLOR " ) ;
sprintf ( falpha , " HARDCOPY:FORMAT BMPCOLOR " ) ;
if ( gpib_write ( gpibDevice , falpha ) = = 0 ) {
if ( gpib_write ( gpibDevice , falpha ) = = 0 ) {
# ifdef ENABLE_EXTRA_DEBUGGING
# 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 ) {
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 ) ;
printf ( " [INFO] Setting scope timebase to %E \n \r " , desired_timebase ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
sprintf ( falpha , " TIM:RANG %E " , desired_timebase ) ;
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 ;
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 ) ;
sprintf ( falpha , " HORIZONTAL:MAIN:SCALE %E " , desired_timebase ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
// Send request
// Send request
printf ( " [INFO] Getting scope timebase \n \r " ) ;
printf ( " [INFO] Getting scope timebase \n \r " ) ;
sprintf ( falpha , " HORIZONTAL:MAIN:SCALE? " ) ;
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 ) {
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 ) ;
printf ( " [INFO] Setting scope volts/div on channel %d to %E \n \r " , desired_channel , desired_volts ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
sprintf ( falpha , " CHAN%d:RANG %E " , desired_channel , desired_volts ) ;
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 ;
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 ) ;
sprintf ( falpha , " CH%d:SCALE %E " , desired_channel , desired_volts ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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 ) {
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 ) ;
printf ( " [INFO] Setting scope run status to %d \n \r " , status ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( status = = 0 ) {
if ( status = = 0 ) {
@ -380,7 +388,8 @@ int scope_set_acquisition(int status,const char * scopeType, int gpibDevice) {
return 2 ;
return 2 ;
}
}
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
sprintf ( falpha , " ACQUIRE:STATE %d " , status ) ;
sprintf ( falpha , " ACQUIRE:STATE %d " , status ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
// Send request
// Send request
printf ( " [INFO] Getting run state \n \r " ) ;
printf ( " [INFO] Getting run state \n \r " ) ;
sprintf ( falpha , " ACQUIRE:STATE? " ) ;
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 ) {
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 ) ;
printf ( " [INFO] Setting channel %d state to %i \n \r " , desired_channel , status ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( status = = 0 ) {
if ( status = = 0 ) {
@ -473,7 +483,8 @@ int scope_set_channel_state(int desired_channel, int status,const char * scopeTy
return 2 ;
return 2 ;
}
}
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
if ( status = = 0 ) {
if ( status = = 0 ) {
sprintf ( falpha , " SELECT:CH%d OFF " , desired_channel ) ;
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)
// Not supported (yet)
return - 1 ;
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 ) ;
sprintf ( falpha , " SELECT:CH%d? " , desired_channel ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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 ) {
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 ) ;
printf ( " [INFO] Setting scope trigger channel to %d \n \r " , desired_channel ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
sprintf ( falpha , " TRIG:SOUR CHAN%d " , desired_channel ) ;
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 ;
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 ) ;
sprintf ( falpha , " TRIGGER:MAIN:EDGE:SOURCE CH%d " , desired_channel ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
sprintf ( falpha , " TRIGGER:MAIN:EDGE:SOURCE? " ) ;
sprintf ( falpha , " TRIGGER:MAIN:EDGE:SOURCE? " ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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 ) {
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 ) ;
printf ( " [INFO] Setting scope trigger level to %f \n \r " , desired_level ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
sprintf ( falpha , " TRIG:LEV %E " , desired_level ) ;
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 ;
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 ) ;
sprintf ( falpha , " TRIGGER:MAIN:LEVEL %f " , desired_level ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
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)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
// Send request
// Send request
printf ( " [INFO] Getting trigger level \n \r " ) ;
printf ( " [INFO] Getting trigger level \n \r " ) ;
sprintf ( falpha , " TRIGGER:MAIN:LEVEL? " ) ;
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 ) {
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 ) ;
printf ( " [INFO] Setting scope channel %d level to %f \n \r " , desired_channel , desired_level ) ;
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
sprintf ( falpha , " CHAN%d:OFFS %E " , desired_channel , desired_level ) ;
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 ;
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 ) ;
sprintf ( falpha , " CH%d:POSITION %f " , desired_channel , desired_level ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
@ -774,7 +791,8 @@ int scope_perform_initial_setup(const char * scopeType, int gpibDevice) {
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
sprintf ( falpha , " HEAD OFF " ) ;
sprintf ( falpha , " HEAD OFF " ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# ifdef ENABLE_EXTRA_DEBUGGING
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
printf ( " [DEBG] Writing: %s \n \r " , falpha ) ;
@ -843,7 +861,8 @@ clock_gettime(CLOCK_REALTIME, &tp1);
// Not supported (yet)
// Not supported (yet)
return - 1 ;
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
// We need to get/parse the preamble, then obtain and adjust the trace data
sprintf ( falpha , " DATA:SOURCE CH%d " , desired_channel ) ;
sprintf ( falpha , " DATA:SOURCE CH%d " , desired_channel ) ;
# ifdef ENABLE_EXTRA_DEBUGGING
# 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 ) ;
printf ( " [PROFILE] %f s \n \r " , ( ( tp4 . tv_nsec + ( tp4 . tv_sec * 1e9 ) ) - ( tp3 . tv_nsec + ( tp3 . tv_sec * 1e9 ) ) ) / 1e9 ) ;
# endif
# endif
TQString preamble ( scope_segarray ) ;
TQString preamble ( scope_segarray ) ;
# ifdef ENABLE_EXTRA_TRACE_DEBUGGING
printf ( " [DEBG] Preamble: %s \n " , preamble . ascii ( ) ) ;
# endif
TQStringList resultPairs = TQStringList : : split ( " ; " , preamble , FALSE ) ;
TQStringList resultPairs = TQStringList : : split ( " ; " , preamble , FALSE ) ;
// Find/initialize critical data values
// Find/initialize critical data values
double ymult = 0 ;
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 ;
double xposition = 0 ;
char * xunits = NULL ;
char * xunits = NULL ;
if ( resultPairs . count ( ) > 15 ) {
if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
ymult = resultPairs [ 13 ] . toDouble ( ) ;
if ( resultPairs . count ( ) > 15 ) {
yoffset = resultPairs [ 14 ] . toDouble ( ) * ymult ;
ymult = resultPairs [ 13 ] . toDouble ( ) ;
yposition = resultPairs [ 15 ] . toDouble ( ) * ymult ;
yoffset = resultPairs [ 14 ] . toDouble ( ) * ymult ;
yunits = strdup ( resultPairs [ 12 ] ) ;
yposition = resultPairs [ 15 ] . toDouble ( ) * ymult ;
xincr = resultPairs [ 9 ] . toDouble ( ) ;
yunits = strdup ( resultPairs [ 12 ] ) ;
xposition = resultPairs [ 10 ] . toDouble ( ) ;
xincr = resultPairs [ 9 ] . toDouble ( ) ;
xunits = strdup ( resultPairs [ 8 ] ) ;
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 the units are desired, comment out these lines...
if ( yunits ) {
if ( yunits ) {
free ( 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 ;
long pointCount = ai / 2 ;
double horizPos = 0.0 ;
double horizPos = 0.0 ;
char yheaderlen [ 2 ] ;
char yheaderlen [ 2 ] ;
# ifdef ENABLE_EXTRA_TRACE_DEBUGGING
printf ( " [DEBG] Point count: %d \n " , pointCount ) ;
# endif
yheaderlen [ 0 ] = scope_segarray [ 1 ] ;
yheaderlen [ 0 ] = scope_segarray [ 1 ] ;
yheaderlen [ 1 ] = 0 ;
yheaderlen [ 1 ] = 0 ;
int data_offset = atoi ( yheaderlen ) + 2 ;
int data_offset = atoi ( yheaderlen ) + 2 ;
for ( array_pointer = 0 ; array_pointer < pointCount ; array_pointer + + ) {
for ( array_pointer = 0 ; array_pointer < pointCount ; array_pointer + + ) {
TQ_INT16 tempvalue ;
TQ_INT16 tempvalue ;
tempvalue = scope_segarray [ ( array_pointer * 2 ) + 1 + data_offset ] ; // LSB
tempvalue = ( unsigned char ) scope_segarray [ ( array_pointer * 2 ) + 1 + data_offset ] ; // LSB
tempvalue = tempvalue | ( scope_segarray [ ( array_pointer * 2 ) + 0 + data_offset ] < < 8 ) ; // MSB
tempvalue = tempvalue | ( ( unsigned char ) scope_segarray [ ( array_pointer * 2 ) + 0 + data_offset ] < < 8 ) ; // MSB
scope_raw_trace_data [ array_pointer ] = tempvalue ;
scope_raw_trace_data [ array_pointer ] = tempvalue ;
scope_raw_trace_data [ array_pointer ] = ( scope_raw_trace_data [ array_pointer ] * ymult ) - yoffset ;
scope_raw_trace_data [ array_pointer ] = ( scope_raw_trace_data [ array_pointer ] * ymult ) - yoffset ;
# ifdef ENABLE_EXTRA_TRACE_DEBUGGING
if ( array_pointer < 512 ) {
printf ( " [DEBG] Array [%d]: %04x (%f) [%02x/%02x] \n " , array_pointer , tempvalue , scope_raw_trace_data [ array_pointer ] , ( unsigned char ) scope_segarray [ ( array_pointer * 2 ) + 0 + data_offset ] , ( unsigned char ) scope_segarray [ ( array_pointer * 2 ) + 1 + data_offset ] ) ;
}
# endif
scope_raw_position_data [ array_pointer ] = horizPos ;
scope_raw_position_data [ array_pointer ] = horizPos ;
horizPos = horizPos + xincr ;
horizPos = horizPos + xincr ;
}
}
@ -988,7 +1035,8 @@ int scope_get_number_of_horizontal_divisions(const char * scopeType, int gpibDev
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
return 8 ;
return 8 ;
}
}
else {
else {
@ -1002,7 +1050,8 @@ int scope_get_number_of_vertical_divisions(const char * scopeType, int gpibDevic
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
return 10 ;
return 10 ;
}
}
else {
else {
@ -1014,7 +1063,8 @@ int scope_get_number_of_channels(const char * scopeType, int gpibDevice) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
if ( strcmp ( " HP54600OS " , scopeType ) = = 0 ) {
return 2 ;
return 2 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
return 4 ;
return 4 ;
}
}
else {
else {
@ -1032,7 +1082,8 @@ int scope_get_channel_volts_div(double * retval, int desired_channel, const char
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
// Send request
// Send request
printf ( " [INFO] Getting scope volts per division for channel %d \n \r " , desired_channel ) ;
printf ( " [INFO] Getting scope volts per division for channel %d \n \r " , desired_channel ) ;
sprintf ( falpha , " CH%d:SCALE? " , desired_channel ) ;
sprintf ( falpha , " CH%d:SCALE? " , desired_channel ) ;
@ -1081,7 +1132,8 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
double xincr ;
double xincr ;
// Send request
// Send request
@ -1177,7 +1229,8 @@ int scope_get_channel_sample_count(unsigned long * retval, int desired_channel,
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
// Send request
// Send request
printf ( " [INFO] Getting number of samples in trace for channel %d \n \r " , desired_channel ) ;
printf ( " [INFO] Getting number of samples in trace for channel %d \n \r " , desired_channel ) ;
sprintf ( falpha , " DATA:SOURCE CH%d " , desired_channel ) ;
sprintf ( falpha , " DATA:SOURCE CH%d " , desired_channel ) ;
@ -1242,7 +1295,8 @@ int scope_get_probe_attenuation_multiplier(double * retval, int desired_channel,
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
// Send request
// Send request
printf ( " [INFO] Getting trigger level for channel %d \n \r " , desired_channel ) ;
printf ( " [INFO] Getting trigger level for channel %d \n \r " , desired_channel ) ;
sprintf ( falpha , " CH%d:PROBE? " , desired_channel ) ;
sprintf ( falpha , " CH%d:PROBE? " , desired_channel ) ;
@ -1287,7 +1341,8 @@ int scope_get_permitted_volts_div_settings_at_1x(int * number_of_values, double
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
* number_of_values = 13 ;
* number_of_values = 13 ;
double * values = ( double * ) malloc ( sizeof ( double ) * ( * number_of_values ) ) ;
double * values = ( double * ) malloc ( sizeof ( double ) * ( * number_of_values ) ) ;
values [ 0 ] = 1e-3 ;
values [ 0 ] = 1e-3 ;
@ -1317,7 +1372,8 @@ int scope_get_permitted_seconds_div_settings(int * number_of_values, double ** r
// Not supported (yet)
// Not supported (yet)
return - 1 ;
return - 1 ;
}
}
else if ( strcmp ( " TDS744AOS " , scopeType ) = = 0 ) {
else if ( ( strcmp ( " TDS744AOS " , scopeType ) = = 0 )
| | ( strcmp ( " TDS744COS " , scopeType ) = = 0 ) ) {
* number_of_values = 28 ;
* number_of_values = 28 ;
double * values = ( double * ) malloc ( sizeof ( double ) * ( * number_of_values ) ) ;
double * values = ( double * ) malloc ( sizeof ( double ) * ( * number_of_values ) ) ;
values [ 0 ] = 1.25e-8 ;
values [ 0 ] = 1.25e-8 ;