current_cal++;
}
- if( setup->da_subdev >= 0 )
+ if( setup->da_subdev >= 0 && setup->do_output)
{
for( range = 0; range < num_ao_ranges; range++ )
{
ADC_GAIN,
};
- cal1( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_COARSE );
- cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_COARSE );
-
- cal1( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_FINE );
- cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_FINE );
-
- cal1( setup, OBS_7V_RANGE_10V_BIP_1XXX, ADC_GAIN );
- cal1_fine( setup, OBS_7V_RANGE_10V_BIP_1XXX, ADC_GAIN );
+ cal_binary( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_COARSE );
+ cal_binary( setup, OBS_0V_RANGE_10V_BIP_1XXX, ADC_OFFSET_FINE );
+ cal_binary( setup, OBS_7V_RANGE_10V_BIP_1XXX, ADC_GAIN );
- if( setup->da_subdev >= 0 )
+ if( setup->da_subdev >= 0 && setup->do_output )
{
- cal1( setup, OBS_DAC0_GROUND_1XXX, DAC0_OFFSET );
- cal1( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_COARSE );
- cal1( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_FINE );
+ cal_binary( setup, OBS_DAC0_GROUND_1XXX, DAC0_OFFSET );
+ cal_binary( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_COARSE );
+ cal_binary( setup, OBS_DAC0_HIGH_1XXX, DAC0_GAIN_FINE );
- cal1( setup, OBS_DAC1_GROUND_1XXX, DAC1_OFFSET );
- cal1( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_COARSE );
- cal1( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_FINE );
+ cal_binary( setup, OBS_DAC1_GROUND_1XXX, DAC1_OFFSET );
+ cal_binary( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_COARSE );
+ cal_binary( setup, OBS_DAC1_HIGH_1XXX, DAC1_GAIN_FINE );
}
return 0;
ADC_PREGAIN_OFFSET,
};
- cal1( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_PREGAIN_OFFSET );
- cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_PREGAIN_OFFSET );
-
- cal1( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_POSTGAIN_OFFSET );
- cal1_fine( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_POSTGAIN_OFFSET );
-
- cal1( setup, OBS_7V_RANGE_10V_BIP_1602_16, ADC_GAIN );
- cal1_fine( setup, OBS_7V_RANGE_10V_BIP_1602_16, ADC_GAIN );
+ cal_binary( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_PREGAIN_OFFSET );
+ cal_binary( setup, OBS_0V_RANGE_10V_BIP_1602_16, ADC_POSTGAIN_OFFSET );
+ cal_binary( setup, OBS_7V_RANGE_10V_BIP_1602_16, ADC_GAIN );
return 0;
}
update_caldac( setup, ADC_OFFSET_64XX, adc_offset_for_ao );
update_caldac( setup, ADC_GAIN_64XX, adc_gain_for_ao );
- for( i = 0; i < num_ao_ranges ; i++ )
+ for( i = 0; i < num_ao_ranges && setup->do_output; i++ )
{
prep_dac_caldacs_64xx( setup, 0, i );
update_caldac( setup, ADC_OFFSET_COARSE_60XX, adc_offset_coarse_for_ao );
update_caldac( setup, ADC_GAIN_FINE_60XX, adc_gain_fine_for_ao );
update_caldac( setup, ADC_GAIN_COARSE_60XX, adc_gain_coarse_for_ao );
- for( i = 0; i < num_ao_ranges ; i++ )
+ for( i = 0; i < num_ao_ranges && setup->do_output; i++ )
{
prep_dac_caldacs_60xx( setup, 0, i );
A little auto-calibration utility, for boards
that support it.
- Right now, it only supports NI E series boards,
- but it should be easily portable.
-
A few things need improvement here:
- current system gets "close", but doesn't
do any fine-tuning
setup->observables[obs].preobserve_insn.subdev,
CR_CHAN( setup->observables[obs].preobserve_insn.chanspec ),
CR_RANGE( setup->observables[obs].preobserve_insn.chanspec ));
+ assert( range );
maxdata = comedi_get_maxdata( setup->dev,
setup->observables[obs].preobserve_insn.subdev,
CR_CHAN(setup->observables[obs].preobserve_insn.chanspec));
-
+ assert( maxdata > 0 );
data = comedi_from_phys(target,range,maxdata);
setup->observables[obs].preobserve_data[0] = data;
{ "DAQCard-ai-16e-4", STATUS_DONE, cal_ni_daqcard_ai_16e_4, ni_setup_observables },
{ "pci-6110", STATUS_DONE, cal_ni_pci_611x, ni_setup_observables_611x },
{ "pci-6111", STATUS_DONE, cal_ni_pci_611x, ni_setup_observables_611x },
- { "DAQCard-6062e", STATUS_SOME, cal_ni_daqcard_6062e, ni_setup_observables },
+ { "DAQCard-6062E", STATUS_SOME, cal_ni_daqcard_6062e, ni_setup_observables },
+ { "DAQCard-6024E", STATUS_UNKNOWN, NULL, ni_setup_observables },
#if 0
// { "at-mio-16de-10", cal_ni_unknown },
{ "at-mio-64e-3", cal_ni_16e_1 },
// { "pci-6713", cal_ni_unknown },
// { "pxi-6070e", cal_ni_unknown },
// { "pxi-6052e", cal_ni_unknown },
-// { "DAQCard-6024e", cal_ni_unknown },
#endif
};
#define n_boards (sizeof(boards)/sizeof(boards[0]))
int ni_setup( calibration_setup_t *setup , const char *device_name )
{
- ni_setup_board( setup, device_name );
+ int retval;
+
+ retval = ni_setup_board( setup, device_name );
+ if( retval < 0 ) return retval;
setup_caldacs( setup, setup->caldac_subdev );
return 0;