From 260c25ebe511f9a3ee6454c4e897947fc8eef1f0 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 24 Apr 2014 00:11:08 -0500 Subject: Add GETPERMITTEDSDIVS command to gpib server --- servers/gpib_server_lin/src/scope_functions.cpp | 83 +++++++++++++++++++------ 1 file changed, 64 insertions(+), 19 deletions(-) (limited to 'servers/gpib_server_lin/src/scope_functions.cpp') diff --git a/servers/gpib_server_lin/src/scope_functions.cpp b/servers/gpib_server_lin/src/scope_functions.cpp index 2cedf45..5b3e34c 100644 --- a/servers/gpib_server_lin/src/scope_functions.cpp +++ b/servers/gpib_server_lin/src/scope_functions.cpp @@ -378,7 +378,7 @@ int scope_get_acquisition(int * retval, const char * scopeType, int gpibDevice) #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; @@ -387,7 +387,7 @@ int scope_get_acquisition(int * retval, const char * scopeType, int gpibDevice) floatstring[ai]=0; *retval = atoi(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -479,7 +479,7 @@ int scope_get_channel_state(int * retval, int desired_channel, const char * scop #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; @@ -488,7 +488,7 @@ int scope_get_channel_state(int * retval, int desired_channel, const char * scop floatstring[ai]=0; *retval = atoi(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -563,7 +563,7 @@ int scope_get_trigger_channel(int * retval, const char * scopeType, int gpibDevi #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; @@ -582,7 +582,7 @@ int scope_get_trigger_channel(int * retval, const char * scopeType, int gpibDevi return -1; } } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -658,7 +658,7 @@ int scope_get_trigger_level(double * retval, const char * scopeType, int gpibDev #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; @@ -667,7 +667,7 @@ int scope_get_trigger_level(double * retval, const char * scopeType, int gpibDev floatstring[ai]=0; *retval = atof(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -990,7 +990,7 @@ int scope_get_channel_volts_div(double * retval, int desired_channel, const char #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; @@ -999,7 +999,7 @@ int scope_get_channel_volts_div(double * retval, int desired_channel, const char floatstring[ai]=0; *retval = atof(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -1057,7 +1057,7 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch #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; @@ -1066,7 +1066,7 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch floatstring[ai]=0; xincr = atof(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -1086,7 +1086,7 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch #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; @@ -1095,7 +1095,7 @@ int scope_get_channel_seconds_div(double * retval, int desired_channel, const ch floatstring[ai]=0; *retval = ((atof(floatstring)*xincr)/scope_get_number_of_vertical_divisions(scopeType, gpibDevice)); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -1151,7 +1151,7 @@ int scope_get_channel_sample_count(unsigned long * retval, int desired_channel, #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; @@ -1160,7 +1160,7 @@ int scope_get_channel_sample_count(unsigned long * retval, int desired_channel, floatstring[ai]=0; *retval = atof(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -1200,7 +1200,7 @@ int scope_get_probe_attenuation_multiplier(double * retval, int desired_channel, #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; @@ -1209,7 +1209,7 @@ int scope_get_probe_attenuation_multiplier(double * retval, int desired_channel, floatstring[ai]=0; *retval = atof(floatstring); } - + #ifdef ENABLE_EXTRA_DEBUGGING printf("[DEBG] Read %li bytes from GPIB device\n", ai); #endif @@ -1249,4 +1249,49 @@ int scope_get_permitted_volts_div_settings_at_1x(int * number_of_values, double else { return -1; } -} \ No newline at end of file +} + +int scope_get_permitted_seconds_div_settings(int * number_of_values, double ** retarray, const char * scopeType, int gpibDevice) { + if (strcmp("HP54600OS", scopeType) == 0) { + // FIXME + // Not supported (yet) + return -1; + } + else if (strcmp("TDS744AOS", scopeType) == 0) { + *number_of_values = 28; + double* values = (double*)malloc(sizeof(double)*(*number_of_values)); + values[0] = 1.25e-8; + values[1] = 2.5e-8; + values[2] = 5e-8; + values[3] = 1e-7; + values[4] = 2e-7; + values[5] = 5e-7; + values[6] = 1e-6; + values[7] = 2e-6; + values[8] = 5e-6; + values[9] = 1e-5; + values[10] = 2e-5; + values[11] = 5e-5; + values[12] = 1e-4; + values[13] = 2e-4; + values[14] = 5e-4; + values[15] = 1e-3; + values[16] = 2e-3; + values[17] = 5e-3; + values[18] = 1e-2; + values[19] = 2e-2; + values[20] = 5e-2; + values[21] = 1e-1; + values[22] = 2e-1; + values[23] = 5e-1; + values[24] = 1e0; + values[25] = 2e0; + values[26] = 5e0; + values[27] = 1e1; + *retarray = values; + return 0; + } + else { + return -1; + } +} -- cgit v1.2.3