diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-24 10:35:28 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-08-24 10:35:28 -0400 |
commit | 7aff20bd82aa1e78caeea5e9f6a45edc0a2b6335 (patch) | |
tree | c2b5e63a9b8db56a2fd3728dc29b8b04ceaa7642 /device-functions.c | |
parent | c116bc537041827e438cec9d49c5249c33f0377e (diff) |
fix int/short issues in calibration routines
Diffstat (limited to 'device-functions.c')
-rw-r--r-- | device-functions.c | 147 |
1 files changed, 76 insertions, 71 deletions
diff --git a/device-functions.c b/device-functions.c index 002bfe8..a158f33 100644 --- a/device-functions.c +++ b/device-functions.c @@ -2250,12 +2250,12 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) { int polarity,range,entry,status,i,num_in_range,num_of_ranges; float temp1[10]; - int temp2[10]; + short temp2[10]; int index; int max_points,max_polarity,max_ranges; - int *pointer_int1; + short *pointer_short1; float *pointer_float1; - int eprom_loc,size_of_float1,size_of_int1; + int eprom_loc,size_of_float1,size_of_short1; int true_channel; true_channel=channel; @@ -2266,91 +2266,91 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) case (pwl_ampl_values): max_polarity=ampl_polarities; max_ranges=ampl_ranges; - pointer_int1=&globals.Flash.ampl_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.ampl_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.ampl_pwl_amp[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.ampl_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.ampl_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.ampl_pwl_amp); break; case (pwl_os_values): max_polarity=os_polarities; max_ranges=os_ranges; - pointer_int1=&globals.Flash.os_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.os_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.os_pwl_amp[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.os_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.os_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.os_pwl_amp); break; case pwl_pw_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_int1=&globals.Flash.pw_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.pw_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.pw_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.pw_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.pw_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.pw_pwl_time); break; case pwl_delay_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_int1=&globals.Flash.delay_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.delay_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.delay_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.delay_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.delay_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.delay_pwl_time); break; case pwl_period_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_int1=&globals.Flash.period_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.period_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.period_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.period_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.period_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.period_pwl_time); break; case pwl_burst_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_int1=&globals.Flash.burst_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.burst_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.burst_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.burst_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.burst_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.burst_pwl_time); break; case pwl_rise_time_values: max_polarity=ampl_polarities; max_ranges=ampl_ranges; - pointer_int1=&globals.Flash.rise_time_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.rise_time_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.rise_time_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.rise_time_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.rise_time_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.rise_time_pwl_time); break; case pwl_slew_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_int1=&globals.Flash.slew_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.slew_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.slew_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.slew_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.slew_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.slew_pwl_time); break; case pwl_vcc1_values: max_polarity=1; max_ranges=1; - pointer_int1=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.vcc1_pwl_amp[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.vcc1_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.vcc1_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.vcc1_pwl_amp); true_channel=0; break; case pwl_vcc2_values: max_polarity=1; max_ranges=1; - pointer_int1=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.vcc2_pwl_amp[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.vcc2_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.vcc2_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.vcc2_pwl_amp); true_channel=0; break; case pwl_load_type_values: max_polarity=load_type_polarities; max_ranges=load_type_ranges; - pointer_int1=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0]; + pointer_short1=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0]; pointer_float1=&globals.Flash.load_type_pwl_time[0][0][0][0]; - size_of_int1=sizeof(globals.Flash.load_type_pwl_Vc_norm4095); + size_of_short1=sizeof(globals.Flash.load_type_pwl_Vc_norm4095); size_of_float1=sizeof(globals.Flash.load_type_pwl_time); break; } @@ -2370,17 +2370,17 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) /* backup calibration values */ for (i=0; i<max_points; i++) { temp1[i]=pointer_float1[index+i]; - temp2[i]=pointer_int1[index+i]; + temp2[i]=pointer_short1[index+i]; } /* move the data, overwriting the deleted point */ for (i=entry; i<max_points-1; i++) { *(float *)(&pointer_float1[index+i])=pointer_float1[index+i+1]; - *(int *)(&pointer_int1[index+i])=pointer_int1[index+i+1]; + *(short *)(&pointer_short1[index+i])=pointer_short1[index+i+1]; } *(float *)(&pointer_float1[index+points_in_range-1])=0.0; - *(int *)(&pointer_int1[index+points_in_range-1])=0; + *(short *)(&pointer_short1[index+points_in_range-1])=0; /* see if new point prevents min/max from being obtained */ status=Check_MinMax_Cal(channel,parameter); @@ -2389,7 +2389,7 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) /* revert to original calibration */ for (i=0; i<max_points; i++) { *(float *)(&pointer_float1[index+i])=temp1[i]; - *(int *)(&pointer_int1[index+i])=temp2[i]; + *(short *)(&pointer_short1[index+i])=temp2[i]; } } @@ -2401,8 +2401,8 @@ int Set_VI_Del_Cal(int parameter,int channel,int calibration_point_number) Menu_Update_Display(); - eprom_loc = (char *) pointer_int1 - (char *) &(globals.Flash.flash_start); - writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_int1); + eprom_loc = (char *) pointer_short1 - (char *) &(globals.Flash.flash_start); + writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_short1); eprom_loc = (char *) pointer_float1 - (char *) &(globals.Flash.flash_start); writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_float1); @@ -2421,7 +2421,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int int max_points,max_polarity,max_ranges; float *pwl_amp; - int *pwl_vc; + short *pwl_vc; int index,use_range; int range_i,entry_i; float inverse_word_out; @@ -2431,7 +2431,6 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int float pw_distort_val; float ampl_for_distort_calc; - int top_range_only; int starting_range; @@ -2654,6 +2653,7 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int } + /* if top_range_only=false, the first match (i.e. in the lowest range) is used. */ /* if top_range_only=true, the last match (i.e. in the highest range) is used. */ @@ -2663,20 +2663,23 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int tweaked_use_ampl = use_ampl; for (range_i=starting_range; (range_i<max_ranges) && (!*point_found || top_range_only); ++range_i) { /* use non-all-zero ranges */ -//printf ("range_i %d\r\n",range_i); + g_print_debug("range_i %d\r\n",range_i); /* apply pw ampl/pol tweaks */ if (parameter == pwl_pw_values) { tweaked_use_ampl = use_ampl + globals.Flash.pw_range_pol_tweaks[channel][range_i][pw_polarity]; } for (entry_i=0; (entry_i<max_points-1) && (!*point_found || top_range_only); ++entry_i) { -//printf ("entry_i %d\r\n",entry_i); + g_print_debug("entry_i %d\r\n",entry_i); index=true_channel*max_ranges*max_polarity*max_points +(range_i)*max_polarity*max_points +(*UseNegData)*max_points +(entry_i); + g_print_debug("values %e - %e, %d - %d\r\n", pwl_amp[index], pwl_amp[index+1], pwl_vc[index], pwl_vc[index+1] ); + + if ( (fabs(pwl_amp[index]-pwl_amp[index+1])>smallest_allowed_number) && ( ((tweaked_use_ampl>=pwl_amp[index]) && (tweaked_use_ampl<=pwl_amp[index+1])) @@ -2737,6 +2740,8 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int } } + g_print_debug("word_out %d\r\n", *word_out); + /* The amplitude/os settings must lie within the calibration points. */ /* However, the timing data is allowed to lie outside the upper end, */ /* because the reciprocal relationship allows an asymptotic extension to infinity, */ @@ -2818,13 +2823,13 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) float temp_y_float[points_in_range+1]; float temp_x_float[points_in_range+1]; - int temp_x_int[points_in_range+1]; + int temp_x_short[points_in_range+1]; int index,actual_pol; float *pointer_y_float; - int *pointer_x_int; + short *pointer_x_short; - int eprom_loc,size_of_y_float,size_of_x_int; + int eprom_loc,size_of_y_float,size_of_x_short; int true_channel; @@ -2841,9 +2846,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) max_polarity=ampl_polarities; max_ranges=ampl_ranges; - pointer_x_int=&globals.Flash.ampl_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.ampl_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.ampl_pwl_amp[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.ampl_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.ampl_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.ampl_pwl_amp); Set_VI_Control(pwl_ampl_values,channel,globals.ChannelState[channel].amplitude,&point_found, @@ -2861,9 +2866,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case (pwl_os_values): max_polarity=os_polarities; max_ranges=os_ranges; - pointer_x_int=&globals.Flash.os_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.os_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.os_pwl_amp[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.os_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.os_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.os_pwl_amp); old_val=globals.ChannelState[channel].offset; @@ -2873,9 +2878,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_pw_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_x_int=&globals.Flash.pw_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.pw_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.pw_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.pw_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.pw_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.pw_pwl_time); old_val=globals.ChannelState[channel].pw; Set_VI_Control(pwl_pw_values,channel,old_val,&point_found, @@ -2884,9 +2889,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_delay_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_x_int=&globals.Flash.delay_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.delay_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.delay_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.delay_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.delay_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.delay_pwl_time); old_val=globals.ChannelState[channel].delay; Set_VI_Control(pwl_delay_values,channel,old_val,&point_found, @@ -2895,9 +2900,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_period_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_x_int=&globals.Flash.period_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.period_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.period_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.period_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.period_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.period_pwl_time); old_val=1.0/globals.ChannelState[channel].frequency; Set_VI_Control(pwl_period_values,channel,old_val,&point_found, @@ -2906,9 +2911,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_burst_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_x_int=&globals.Flash.burst_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.burst_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.burst_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.burst_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.burst_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.burst_pwl_time); old_val=globals.ChannelState[channel].burst_time; Set_VI_Control(pwl_burst_values,channel,old_val,&point_found, @@ -2917,9 +2922,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_rise_time_values: max_polarity=ampl_polarities; max_ranges=ampl_ranges; - pointer_x_int=&globals.Flash.rise_time_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.rise_time_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.rise_time_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.rise_time_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.rise_time_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.rise_time_pwl_time); old_val=globals.ChannelState[channel].rise_time; Set_VI_Control(pwl_rise_time_values,channel,old_val,&point_found, @@ -2928,9 +2933,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_slew_values: max_polarity=timing_polarities; max_ranges=timing_ranges; - pointer_x_int=&globals.Flash.slew_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.slew_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.slew_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.slew_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.slew_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.slew_pwl_time); old_val=globals.ChannelState[channel].slew; Set_VI_Control(pwl_slew_values,channel,old_val,&point_found, @@ -2940,9 +2945,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) max_polarity=1; max_ranges=1; true_channel=0; - pointer_x_int=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.vcc1_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.vcc1_pwl_amp[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.vcc1_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.vcc1_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.vcc1_pwl_amp); old_val=globals.ChannelState[true_channel].vcc1; Set_VI_Control(pwl_vcc1_values,channel,old_val,&point_found, @@ -2952,9 +2957,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) max_polarity=1; max_ranges=1; true_channel=0; - pointer_x_int=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.vcc2_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.vcc2_pwl_amp[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.vcc2_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.vcc2_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.vcc2_pwl_amp); old_val=globals.ChannelState[true_channel].vcc2; Set_VI_Control(pwl_vcc2_values,channel,old_val,&point_found, @@ -2963,9 +2968,9 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) case pwl_load_type_values: max_polarity=load_type_polarities; max_ranges=load_type_ranges; - pointer_x_int=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0]; + pointer_x_short=&globals.Flash.load_type_pwl_Vc_norm4095[0][0][0][0]; pointer_y_float=&globals.Flash.load_type_pwl_time[0][0][0][0]; - size_of_x_int=sizeof(globals.Flash.load_type_pwl_Vc_norm4095); + size_of_x_short=sizeof(globals.Flash.load_type_pwl_Vc_norm4095); size_of_y_float=sizeof(globals.Flash.load_type_pwl_time); old_val=globals.ChannelState[channel].load_type; Set_VI_Control(pwl_load_type_values,channel,old_val,&point_found, @@ -2976,7 +2981,7 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) temp_y_float[max_points]=0.0; /* Adding a cal point may temporarily result in 11 data points. */ temp_x_float[max_points]=0.0; /* One is eventually discarded. */ - temp_x_int[max_points]=0; + temp_x_short[max_points]=0; index=true_channel*max_ranges*max_polarity*max_points @@ -2987,7 +2992,7 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) /* make a copy of the calibration data in this range */ for (i=0; i<max_points; i++) { temp_y_float[i]=pointer_y_float[index+i]; /* work on this data */ - temp_x_int[i]=pointer_x_int[index+i]; + temp_x_short[i]=pointer_x_short[index+i]; } @@ -3009,10 +3014,10 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) return CalibrationPercentError; } /* check for overly-close data points */ - if ( word_out==temp_x_int[entry] ) { + if ( word_out==temp_x_short[entry] ) { return CalibrationClosenessError; } - if ( word_out==temp_x_int[entry+1]) { + if ( word_out==temp_x_short[entry+1]) { return CalibrationClosenessError; } @@ -3021,15 +3026,15 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) /* move old data over */ for (i=max_points-1; i>entry; i--) { temp_y_float[i+1]=temp_y_float[i]; - temp_x_int[i+1]=temp_x_int[i]; + temp_x_short[i+1]=temp_x_short[i]; } /* add the new data */ temp_y_float[entry+1]=abs_cal_point; - temp_x_int[entry+1]=word_out; + temp_x_short[entry+1]=word_out; for (i=0; i<=max_points; ++i) { - temp_x_float[i]=(float) temp_x_int[i]; + temp_x_float[i]=(float) temp_x_short[i]; } @@ -3058,7 +3063,7 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) for (i=delete_point; i<max_points; i++) { temp_y_float[i]=temp_y_float[i+1]; temp_x_float[i]=temp_x_float[i+1]; - temp_x_int[i]=temp_x_int[i+1]; + temp_x_short[i]=temp_x_short[i+1]; } } @@ -3066,11 +3071,11 @@ int Set_VI_Add_Cal(int parameter,int channel,float cal_point) /* store new calibration data for this range */ for (i=0; i<max_points; i++) { *(float *)(&pointer_y_float[index+i])=temp_y_float[i]; - *(int *)(&pointer_x_int[index+i])=temp_x_int[i]; + *(short *)(&pointer_x_short[index+i])=temp_x_short[i]; } - eprom_loc = (char *) pointer_x_int - (char *) &(globals.Flash.flash_start); - writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_x_int); + eprom_loc = (char *) pointer_x_short - (char *) &(globals.Flash.flash_start); + writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_x_short); eprom_loc = (char *) pointer_y_float - (char *) &(globals.Flash.flash_start); writeUserBlock(eprom_loc,&globals.Flash.flash_start + eprom_loc,size_of_y_float); |