tweaks, and always reset fine caldacs before adjusting corresponding
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 23 Jul 2003 20:00:49 +0000 (20:00 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 23 Jul 2003 20:00:49 +0000 (20:00 +0000)
coarse caldac

comedi_calibrate/cal_common.c
comedi_calibrate/ni.c

index b3854e7d404f2aff4dc06dae82cd8867875fb96d..a1c4704184aaa0ab768413e64bd297f61acb2d98 100644 (file)
@@ -239,7 +239,7 @@ static void generic_do_adc_postgain_offset( calibration_setup_t *setup, const ge
                highgain = get_bipolar_highgain( setup->dev, setup->ad_subdev );
        }
        generic_prep_adc_caldacs( setup, layout, channel, highgain );
-       if( unipolar && setup->old_calibration == NULL )
+       if( unipolar )
        {
                /* Need to make sure we aren't stuck on zero for unipolar,
                 * by setting pregain offset to maximum.  Use bipolar lowgain
index 294dec04301257c4f4eefb03a958f354886dc0b9..0a3ee4f896fc9524e7ae502e9cd89e6e8ff99a9e 100644 (file)
@@ -1211,15 +1211,18 @@ static int cal_ni_generic( calibration_setup_t *setup, const ni_caldac_layout_t
 
        current_cal = sc_alloc_calibration_setting( setup );
        current_cal->subdevice = setup->ad_subdev;
+       reset_caldac( setup, layout->adc_gain_fine );
        generic_do_relative( setup, current_cal, ni_zero_offset_low,
                ni_reference_low, layout->adc_gain );
+       reset_caldac( setup, layout->adc_postgain_offset_fine );
        generic_do_relative( setup, current_cal, ni_zero_offset_low,
                ni_zero_offset_high, layout->adc_postgain_offset );
+       generic_do_relative( setup, current_cal, ni_zero_offset_low,
+               ni_zero_offset_high, layout->adc_postgain_offset_fine );
+       reset_caldac( setup, layout->adc_pregain_offset_fine );
        generic_do_cal( setup, current_cal, ni_zero_offset_high, layout->adc_pregain_offset );
        generic_do_relative( setup, current_cal, ni_zero_offset_low,
                ni_reference_low, layout->adc_gain_fine );
-       generic_do_relative( setup, current_cal, ni_zero_offset_low,
-               ni_zero_offset_high, layout->adc_postgain_offset_fine );
        generic_do_cal( setup, current_cal, ni_zero_offset_high,
                layout->adc_pregain_offset_fine );
        sc_push_channel( current_cal, SC_ALL_CHANNELS );
@@ -1248,19 +1251,21 @@ static int cal_ni_generic( calibration_setup_t *setup, const ni_caldac_layout_t
                }else
                {
                        prep_adc_caldacs_generic( setup, layout, ai_unipolar_lowgain );
-                       if( setup->old_calibration == NULL )
-                               generic_peg( setup, ni_unip_zero_offset_low,
-                                       layout->adc_pregain_offset, 1 );
+                       generic_peg( setup, ni_unip_zero_offset_low,
+                               layout->adc_pregain_offset, 1 );
+                       reset_caldac( setup, layout->adc_gain_fine );
                        generic_do_relative( setup, current_cal, ni_unip_zero_offset_low,
                                ni_unip_reference_low, layout->adc_gain );
+                       reset_caldac( setup, layout->adc_postgain_offset_fine );
                        generic_do_relative( setup, current_cal, ni_unip_zero_offset_low,
                                ni_unip_zero_offset_high, layout->adc_postgain_offset );
+                       generic_do_relative( setup, current_cal, ni_unip_zero_offset_low,
+                               ni_unip_zero_offset_high, layout->adc_postgain_offset_fine );
+                       reset_caldac( setup, layout->adc_pregain_offset_fine );
                        generic_do_cal( setup, current_cal, ni_unip_zero_offset_high,
                                layout->adc_pregain_offset );
                        generic_do_relative( setup, current_cal, ni_unip_zero_offset_low,
                                ni_unip_reference_low, layout->adc_gain_fine );
-                       generic_do_relative( setup, current_cal, ni_unip_zero_offset_low,
-                               ni_unip_zero_offset_high, layout->adc_postgain_offset_fine );
                        generic_do_cal( setup, current_cal, ni_unip_zero_offset_high,
                                layout->adc_pregain_offset_fine );
                }
@@ -1292,6 +1297,7 @@ static int cal_ni_generic( calibration_setup_t *setup, const ni_caldac_layout_t
                                layout->dac_linearity[ channel ] );
                        generic_do_cal( setup, current_cal, ni_ao_zero_offset( channel ),
                                layout->dac_offset[ channel ] );
+                       reset_caldac( setup, layout->dac_gain_fine[ channel ] );
                        generic_do_cal( setup, current_cal, ni_ao_reference( channel ),
                                layout->dac_gain[ channel ] );
                        generic_do_cal( setup, current_cal, ni_ao_reference( channel ),