From 71cb44945d394883e26b084faca3c45969b92770 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 1 Jan 2000 00:04:44 +0900 Subject: implement ampl-dependent arbitrary voltage output - for AVR-E5-B S/N 13618 --- device-functions.c | 62 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 27 deletions(-) (limited to 'device-functions.c') diff --git a/device-functions.c b/device-functions.c index 1cc4322..4e21c14 100644 --- a/device-functions.c +++ b/device-functions.c @@ -250,7 +250,7 @@ static int attenuator_count (int channel) int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int word_override,int range_override, int switch_range_only,int channel,float new_ampl,int called_from_set_pw) { - int word_out; /* what is sent to the DAC */ + int word_out, word_out_aux; /* what is sent to the DAC */ int relay_range,atten_range,old_range,old_actual_pol; /* selects relay range */ int UseNegData; /* if polarity is negative and separate piece-wise linear data is available for neg */ int point_found; @@ -307,7 +307,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w /* determine the previous relay range */ Set_VI_Control(pwl_ampl_values,channel,globals.ChannelState[channel].amplitude,&point_found, - &old_range,&atten_range,&UseNegData,&entry,&word_out,&old_actual_pol); + &old_range,&atten_range,&UseNegData,&entry,&word_out,&old_actual_pol,NULL); } word_out = -1; @@ -324,7 +324,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w /* set the amplitude controls now. */ int status; if ((status=Set_VI_Control(pwl_ampl_values,channel,new_ampl,&point_found, - &relay_range,&atten_range,&UseNegData,&entry,&word_out,&actual_pol))) { + &relay_range,&atten_range,&UseNegData,&entry,&word_out,&actual_pol,&word_out_aux))) { return status; } } @@ -349,10 +349,13 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w globals.Timers.Relay_Switching_Delay_in_Milliseconds=(long) (1000L * globals.Flash.extended_relay_delay_in_sec); } + if (globals.Flash.distort_enabled[channel]) { + printf ("distort %d\n",word_out_aux); + set_dac(globals.Flash.distort_dac[channel],word_out_aux); + } set_dac(globals.Flash.ampl_DAC[channel],word_out); - if (!channel) { if (!globals.Flash.ampl_ranges_for_ch2_only) { if ((globals.Flash.ChanKey_amplitude?globals.Flash.channels:1)<=1) { @@ -509,7 +512,7 @@ int Set_Pw(int check_possible_only,int word_override,int range_override,int chan } else { /* set the pw controls now. */ if ((status=Set_VI_Control(pwl_pw_values,channel,set_pw,&point_found, - &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol))) { + &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol,NULL))) { return status; } } @@ -621,7 +624,7 @@ int Set_Pw(int check_possible_only,int word_override,int range_override,int chan /* use CH2 calibration to do this */ if (globals.Flash.is_monocycle[0] && channel==0) { if ((status=Set_VI_Control(pwl_pw_values,1,set_pw,&point_found, - &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol))) { + &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol,NULL))) { return status; } set_dac(globals.Flash.monocycle_dac[0],word_out); @@ -672,7 +675,7 @@ int Set_Offset(int check_possible_only,int override_on,int word_override,int ran /* determine the previous relay range */ Set_VI_Control(pwl_os_values,channel,globals.ChannelState[channel].offset,&point_found, - &old_range,&dummy0,&dummy1,&dummy2,&word_out,&dummy3); + &old_range,&dummy0,&dummy1,&dummy2,&word_out,&dummy3,NULL); } if (override_on) { @@ -681,7 +684,7 @@ int Set_Offset(int check_possible_only,int override_on,int word_override,int ran } else { int status; if ((status=Set_VI_Control(pwl_os_values,channel,new_offset,&point_found, - &relay_range,&dummy0,&dummy2,&entry,&word_out,&actual_pol))) { + &relay_range,&dummy0,&dummy2,&entry,&word_out,&actual_pol,NULL))) { return status; } } @@ -757,7 +760,7 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i /* added Feb 23/05 */ /* determine the previous relay range */ Set_VI_Control(pwl_period_values,channel,1.0/globals.ChannelState[channel].frequency,&point_found, - &old_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol); + &old_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol,NULL); } /* find appropriate range/fine settings from piece-wise linear data in flash memory */ @@ -768,7 +771,7 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i /* set the amplitude controls now. */ int status; if ((status=Set_VI_Control(pwl_period_values,channel,1.0/set_freq,&point_found, - &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol))) { + &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol,NULL))) { return status; } } @@ -911,7 +914,7 @@ int Set_Delay(int check_possible_only,int word_override,int range_override,int c /* set the amplitude controls now. */ int status; if ((status=Set_VI_Control(pwl_delay_values,channel,setting,&point_found, - &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol))) { + &relay_range,&dummy,&UseNegData,&entry,&word_out,&actual_pol,NULL))) { g_print_debug("delay set status: %d",status); return status; } @@ -1678,7 +1681,7 @@ int Set_Amp_Calib(int channel,float meas_ampl) /* get current range and polarity settings */ Set_VI_Control(pwl_ampl_values,channel,globals.ChannelState[channel].amplitude,&point_found, - &relay_range,&atten_range,&UseNegData,&entry,&word_out,&actual_pol); + &relay_range,&atten_range,&UseNegData,&entry,&word_out,&actual_pol,NULL); if (fabs(globals.ChannelState[channel].amplitude)