diff options
author | Mike <mjc@avtechpulse.com> | 2000-01-01 01:42:04 +0900 |
---|---|---|
committer | Mike <mjc@avtechpulse.com> | 2000-01-01 01:42:04 +0900 |
commit | d7f742964e475804daf0211ea0825efa4bf4bf64 (patch) | |
tree | ae3fcf045dfcef228e4eefd5ff3c888055d347e2 /device-functions.c | |
parent | 5abd33ec6a84efd1c963f8e5d7680ac2dd32a915 (diff) |
make force_output_fully_off work properly for 2-channel unitsINSTRUMENT_6_4_07b
Diffstat (limited to 'device-functions.c')
-rw-r--r-- | device-functions.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/device-functions.c b/device-functions.c index d32c933..b54e14b 100644 --- a/device-functions.c +++ b/device-functions.c @@ -435,13 +435,9 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w I2C_Write(PCF8574+Octal_Relay_Driver, atten_ctl); } - if ( (globals.Registers.last_relay_driver_settings[3] != atten_ctl)) { - - globals.Registers.last_relay_driver_settings[3] = atten_ctl; - - if (globals.ChannelState[channel].output_state==output_on) { - globals.Flags.force_output_fully_off=YES; - } + if ( (globals.Registers.last_relay_driver_settings[3+channel] != atten_ctl)) { + globals.Registers.last_relay_driver_settings[3+channel] = atten_ctl; + globals.Flags.force_output_fully_off=YES; } g_print_debug("ampl range %d, word %d\n",relay_range,word_out); @@ -451,7 +447,7 @@ int Set_Amplitude(int check_possible_only,int pol_override,int override_on,int w globals.ChannelState[channel].amplitude=new_ampl; Set_Update_Chans(); - if ((relay_range!=old_range) && (globals.ChannelState[channel].output_state==output_on)) { + if (relay_range!=old_range) { globals.Flags.force_output_fully_off=YES; } @@ -703,7 +699,7 @@ int Set_Offset(int check_possible_only,int override_on,int word_override,int ran globals.ChannelState[channel].offset=new_offset; Set_Update_Chans(); - if ((relay_range!=old_range) && (globals.ChannelState[channel].output_state==output_on)) { + if (relay_range!=old_range) { globals.Flags.force_output_fully_off=YES; } @@ -795,7 +791,7 @@ int Set_frequency(int check_possible_only,int word_override,int range_override,i set_shiftreg_bits(SR_2, XTR_POS + 1, THREE_BITS, relay_range); - if ((relay_range!=old_range) && (globals.ChannelState[channel].output_state==output_on)) { + if (relay_range!=old_range) { globals.Flags.force_output_fully_off=YES; } } @@ -3909,8 +3905,6 @@ int Set_rise_time(int check_possible_only,int word_override,int range_override,i } } - - if (globals.Registers.last_rise_time_relay_setting != range_control) { /* update range hardware */ if (globals.ChannelState[channel].trigger_source!=source_hold) { @@ -4611,8 +4605,20 @@ void Main_update_shift_registers() } - /* physically turn off output for amplitude range changes */ - /* i.e., short output in 155's */ + /* physically turn off output for amplitude range changes + but don't bother if all outputs are off */ + + int outputs_on; + outputs_on = 0; + for (i = 0; i < max_channels; i++) { + if (globals.ChannelState[i].output_state==output_on) { + ++outputs_on; + } + } + if (outputs_on == 0) { + globals.Flags.force_output_fully_off=NO; + } + if (globals.Flags.force_output_fully_off==YES) for (i=0; i<(globals.Flash.ChanKey_frequency?globals.Flash.channels:1); ++i) { temp_output_state[i]=globals.ChannelState[i].output_state; @@ -4623,7 +4629,9 @@ void Main_update_shift_registers() bus_setpin(out_CLOCK_LINE, 1); bus_setpin(out_STROBE_LINE, 0); + g_print_debug ("\n\r-----------\n\r"); for (i=(num_out_SRs-1); i>=0; --i) { + g_print_debug ("SR %d = %lx hex\n\r",i,globals.Registers.shift_reg_out[i]); switch (i) { case 0: case 1: |