diff options
-rw-r--r-- | device-functions.c | 61 | ||||
-rw-r--r-- | error_utils.c | 43 | ||||
-rw-r--r-- | flash.c | 35 | ||||
-rw-r--r-- | globals.h | 10 | ||||
-rw-r--r-- | version.h | 2 |
5 files changed, 95 insertions, 56 deletions
diff --git a/device-functions.c b/device-functions.c index 0551cbf..c185e6b 100644 --- a/device-functions.c +++ b/device-functions.c @@ -333,7 +333,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_ampl; } } @@ -519,7 +519,7 @@ int Set_Pw(int check_possible_only,int word_override,int range_override,int chan if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_pw; } } @@ -690,7 +690,7 @@ int Set_Offset(int check_possible_only,int override_on,int word_override,int ran if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_os; } } @@ -777,7 +777,7 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_freq; } } @@ -874,7 +874,7 @@ int Set_Delay(int check_possible_only,int word_override,int range_override,int c } setting = set_delay; - + if (!globals.Flash.volt_ctrl_delay[channel]) { /* tweak depending on polarity */ adj_setting = set_delay; @@ -916,7 +916,7 @@ int Set_Delay(int check_possible_only,int word_override,int range_override,int c if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_delay; } } @@ -3419,55 +3419,50 @@ int Check_MinMax_Cal(int channel,int parameter) /* see if new point prevents zero, min, max, or current value from being obtained */ switch (parameter) { case (pwl_ampl_values): - status=Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0) - || Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0) - || Set_Amplitude(1,0,0,0,0,0,channel,rst_ampl_value(channel),0); + if (status=Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.min_ampl[channel],0)) return status; + if (status=Set_Amplitude(1,0,0,0,0,0,channel,globals.Flash.max_ampl[channel],0)) return status; + if (status=Set_Amplitude(1,0,0,0,0,0,channel,rst_ampl_value(channel),0)) return status; break; case (pwl_os_values): - status=Set_Offset(1,0,0,0,channel,globals.Flash.min_offset[channel]) - || Set_Offset(1,0,0,0,channel,globals.Flash.max_offset[channel]) - || Set_Offset(1,0,0,0,channel,0.0); + if (status=Set_Offset(1,0,0,0,channel,globals.Flash.min_offset[channel])) return status; + if (status=Set_Offset(1,0,0,0,channel,globals.Flash.max_offset[channel])) return status; + if (status=Set_Offset(1,0,0,0,channel,0.0)) return status; break; case pwl_pw_values: - status=Set_Pw(1,0,0,channel,globals.Flash.min_pw[channel],0) - || Set_Pw(1,0,0,channel,globals.Flash.max_pw[channel],0); + if (status=Set_Pw(1,0,0,channel,globals.Flash.min_pw[channel],0)) return status; + if (status=Set_Pw(1,0,0,channel,globals.Flash.max_pw[channel],0)) return status; break; case pwl_delay_values: - status=Set_Delay(1,0,0,channel,globals.Flash.min_delay[channel]) - || Set_Delay(1,0,0,channel,globals.Flash.max_delay[channel]); + if (status=Set_Delay(1,0,0,channel,globals.Flash.min_delay[channel])) return status; + if (status=Set_Delay(1,0,0,channel,globals.Flash.max_delay[channel])) return status; break; case pwl_period_values: - status=Set_frequency(1,0,0,channel,globals.Flash.min_freq[channel]) - || Set_frequency(1,0,0,channel,globals.Flash.max_freq[channel]); + if (status=Set_frequency(1,0,0,channel,globals.Flash.min_freq[channel])) return status; + if (status=Set_frequency(1,0,0,channel,globals.Flash.max_freq[channel])) return status; break; case pwl_burst_values: - status=Set_Burst_Time(1,0,0,channel,globals.Flash.min_burst_gap[channel]) - || Set_Burst_Time(1,0,0,channel,globals.Flash.max_burst_gap[channel]); + if (status=Set_Burst_Time(1,0,0,channel,globals.Flash.min_burst_gap[channel])) return status; + if (status=Set_Burst_Time(1,0,0,channel,globals.Flash.max_burst_gap[channel])) return status; break; case pwl_rise_time_values: - status=Set_rise_time(1,0,0,channel,globals.Flash.min_rise_time[channel]) - || Set_rise_time(1,0,0,channel,globals.Flash.max_rise_time[channel]); + if (status=Set_rise_time(1,0,0,channel,globals.Flash.min_rise_time[channel])) return status; + if (status=Set_rise_time(1,0,0,channel,globals.Flash.max_rise_time[channel])) return status; break; case pwl_slew_values: - status=Set_slew(1,0,0,channel,globals.Flash.min_slew[channel]) - || Set_slew(1,0,0,channel,globals.Flash.max_slew[channel]); + if (status=Set_slew(1,0,0,channel,globals.Flash.min_slew[channel])) return status; + if (status=Set_slew(1,0,0,channel,globals.Flash.max_slew[channel])) return status; break; } - if (status) { - /* change the error code to a calibration-related one */ - status=CalibrationMinMaxError; - } - - return status; + return OK; } @@ -3598,7 +3593,7 @@ int Set_Burst_Time(int check_possible_only,int word_override,int range_override, if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_burst; } } @@ -3705,7 +3700,7 @@ int Set_rise_time(int check_possible_only,int word_override,int range_override,i if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_rise; } } @@ -3881,7 +3876,7 @@ int Set_slew(int check_possible_only,int word_override,int range_override,int ch if (point_found) { return OK; } else { - return CalibrationMinMaxError; + return CalibrationMinMaxError_slew; } } diff --git a/error_utils.c b/error_utils.c index 9965b23..38a83ff 100644 --- a/error_utils.c +++ b/error_utils.c @@ -57,7 +57,14 @@ void set_gpib_error_flags (int error_num) case queue_overflow: case CalibrationPercentError: case CalibrationZeroError: - case CalibrationMinMaxError: + case CalibrationMinMaxError_ampl: + case CalibrationMinMaxError_pw: + case CalibrationMinMaxError_os: + case CalibrationMinMaxError_freq: + case CalibrationMinMaxError_delay: + case CalibrationMinMaxError_burst: + case CalibrationMinMaxError_rise: + case CalibrationMinMaxError_slew: case CalibrationClosenessError: case CalibrationRangeError: case CalibrationPolarityError: @@ -462,10 +469,40 @@ void get_error_text(gchar **response, int error_num) format_error_text(response,-340,"Zero point can not be changed."); break; - case CalibrationMinMaxError: - format_error_text(response,-340,"Would prevent operation at the minimum or maximum settings."); + case CalibrationMinMaxError_ampl: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum amplitude."); break; + case CalibrationMinMaxError_pw: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum pulse width."); + break; + + case CalibrationMinMaxError_os: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum offset."); + break; + + case CalibrationMinMaxError_freq: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum frequency."); + break; + + case CalibrationMinMaxError_delay: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum delay."); + break; + + case CalibrationMinMaxError_burst: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum burst separation."); + break; + + case CalibrationMinMaxError_rise: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum rise time."); + break; + + case CalibrationMinMaxError_slew: + format_error_text(response,-340,"Would prevent operation at the minimum or maximum slew rate."); + break; + + + case CalibrationClosenessError: format_error_text(response,-340,"Too few calibration points, or they are too closely spaced."); break; @@ -545,49 +545,50 @@ static void initFlashValues(FlashStruct *mem) mem->slew_pwl_time[i][j][k][m]=0.0; mem->slew_pwl_Vc_norm4095[i][j][k][m]=0; - int temp_int, temp_int_burst_period; + int temp_int; if (m==0) { - /* these values have been determined by experiment */ - temp_int = temp_int_burst_period = dac_max; + /* These values have been determined by experiment. */ + /* Double CH2 delays for -KMPF */ + + temp_int = dac_max; mem->period_pwl_time[i][j][k][m]=(47e-9*power_of_ten)+41e-9; mem->pw_pwl_time[i][j][k][m]=(6e-9*power_of_ten)+20e-9; - mem->delay_pwl_time[i][j][k][m]=(6e-9*power_of_ten)+10e-9; + mem->delay_pwl_time[i][j][k][m]=((6e-9*power_of_ten)+10e-9) * (i+1.0); mem->burst_pwl_time[i][j][k][m]=(22e-9*power_of_ten)+25e-9; } else if (m==1) { - temp_int = temp_int_burst_period = dac_max/2.15; + temp_int = dac_max/2.15; mem->period_pwl_time[i][j][k][m]=(100e-9*power_of_ten)+50e-9; mem->pw_pwl_time[i][j][k][m]=(14e-9*power_of_ten)+25e-9; - mem->delay_pwl_time[i][j][k][m]=(14e-9*power_of_ten)+30e-9; + mem->delay_pwl_time[i][j][k][m]=((14e-9*power_of_ten)+30e-9) * (i+1.0); mem->burst_pwl_time[i][j][k][m]=(33e-9*power_of_ten)+10e-9; } else if (m==2) { - temp_int = temp_int_burst_period = dac_max/4.6; + temp_int = dac_max/4.6; mem->period_pwl_time[i][j][k][m]=(230e-9*power_of_ten)+100e-9; mem->pw_pwl_time[i][j][k][m]=(28e-9*power_of_ten)+50e-9; - mem->delay_pwl_time[i][j][k][m]=(28e-9*power_of_ten)+60e-9; + mem->delay_pwl_time[i][j][k][m]=((28e-9*power_of_ten)+60e-9) * (i+1.0); mem->burst_pwl_time[i][j][k][m]=(50e-9*power_of_ten)+10e-9; } else if (m==3) { - temp_int = temp_int_burst_period = dac_max / 10; + temp_int = dac_max / 10; mem->period_pwl_time[i][j][k][m]=(470e-9*power_of_ten)+160e-9; mem->pw_pwl_time[i][j][k][m]=(70e-9*power_of_ten)+80e-9; - mem->delay_pwl_time[i][j][k][m]=(70e-9*power_of_ten)+90e-9; + mem->delay_pwl_time[i][j][k][m]=((70e-9*power_of_ten))+90e-9 * (i+1.0); mem->burst_pwl_time[i][j][k][m]=(110e-9*power_of_ten)+10e-9; } else if (m==4) { - temp_int = 0; - temp_int_burst_period = dac_max / 20 ; + temp_int = dac_max / 20 ; mem->period_pwl_time[i][j][k][m]=(900e-9*power_of_ten)+200e-9; - mem->pw_pwl_time[i][j][k][m]=0.0; - mem->delay_pwl_time[i][j][k][m]=0.0; + mem->pw_pwl_time[i][j][k][m]=(140e-9*power_of_ten)+80e-9; + mem->delay_pwl_time[i][j][k][m]=((140e-9*power_of_ten)+90e-9) * (i+1.0); mem->burst_pwl_time[i][j][k][m]=(220e-9*power_of_ten)+10e-9; } else { temp_int = 0; - temp_int_burst_period = 0; + mem->pw_pwl_time[i][j][k][m]=0.0; mem->delay_pwl_time[i][j][k][m]=0.0; mem->period_pwl_time[i][j][k][m]=0.0; @@ -596,8 +597,8 @@ static void initFlashValues(FlashStruct *mem) mem->pw_pwl_Vc_norm4095[i][j][k][m]=temp_int; mem->delay_pwl_Vc_norm4095[i][j][k][m]=temp_int; - mem->period_pwl_Vc_norm4095[i][j][k][m]=temp_int_burst_period; - mem->burst_pwl_Vc_norm4095[i][j][k][m]=temp_int_burst_period; + mem->period_pwl_Vc_norm4095[i][j][k][m]=temp_int; + mem->burst_pwl_Vc_norm4095[i][j][k][m]=temp_int; } } power_of_ten*=10.0; @@ -58,7 +58,6 @@ #define amplitude_confined_values 40 #define HardwareError 41 #define CalibrationZeroError 42 -#define CalibrationMinMaxError 43 #define CalibrationClosenessError 44 #define CalibrationTimingProblem 45 #define CalibrationRangeError 46 @@ -98,7 +97,14 @@ #define rise_time_confined_values 83 #define zero_equiv_ampl_negative 84 #define amplitude_gap 85 - +#define CalibrationMinMaxError_ampl 86 +#define CalibrationMinMaxError_pw 87 +#define CalibrationMinMaxError_os 88 +#define CalibrationMinMaxError_freq 89 +#define CalibrationMinMaxError_delay 90 +#define CalibrationMinMaxError_burst 91 +#define CalibrationMinMaxError_rise 92 +#define CalibrationMinMaxError_slew 93 #define YES 1 #define NO 0 @@ -1,2 +1,2 @@ -#define FW_VERSION "6.2.24" +#define FW_VERSION "6.2.25" #define SCPI_version "1996.0" |