From: Frank Mori Hess Date: Tue, 29 Apr 2003 01:50:46 +0000 (+0000) Subject: offset unipolar ground observable targets half a bit above zero X-Git-Tag: r0_7_21~200 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=78f9e1b83dbdc68d4e63bfbbe80ede73172cf76e;p=comedilib.git offset unipolar ground observable targets half a bit above zero --- diff --git a/comedi_calibrate/ni.c b/comedi_calibrate/ni.c index a8c3ba9..f6f1ee1 100644 --- a/comedi_calibrate/ni.c +++ b/comedi_calibrate/ni.c @@ -268,6 +268,14 @@ static void ni_setup_observables( calibration_setup_t *setup ) o->target = voltage_reference; if(unipolar_lowgain>=0){ + comedi_range *range; + int max_data; + + range = comedi_get_range( setup->dev, setup->ad_subdev, 0, unipolar_lowgain ); + assert( range != NULL ); + max_data = comedi_get_maxdata( setup->dev, setup->ad_subdev, 0 ); + assert( max_data > 0 ); + o = setup->observables + ni_unip_zero_offset_low; o->name = "ai, unipolar zero offset, low gain"; o->observe_insn = tmpl; @@ -275,7 +283,7 @@ static void ni_setup_observables( calibration_setup_t *setup ) CR_PACK(REF_GND_GND,unipolar_lowgain,AREF_OTHER) | CR_ALT_SOURCE | CR_ALT_FILTER; o->reference_source = REF_GND_GND; - o->target = 0.0; + o->target = comedi_to_phys( 1, range, max_data ) / 2.0; o = setup->observables + ni_unip_reference_low; o->name = "ai, unipolar voltage reference, low gain"; @@ -289,6 +297,14 @@ static void ni_setup_observables( calibration_setup_t *setup ) if(unipolar_highgain >= 0) { + comedi_range *range; + int max_data; + + range = comedi_get_range( setup->dev, setup->ad_subdev, 0, unipolar_highgain ); + assert( range != NULL ); + max_data = comedi_get_maxdata( setup->dev, setup->ad_subdev, 0 ); + assert( max_data > 0 ); + o = setup->observables + ni_unip_zero_offset_high; o->name = "ai, unipolar zero offset, high gain"; o->observe_insn = tmpl; @@ -296,7 +312,7 @@ static void ni_setup_observables( calibration_setup_t *setup ) CR_PACK(REF_GND_GND,unipolar_highgain,AREF_OTHER) | CR_ALT_SOURCE | CR_ALT_FILTER; o->reference_source = REF_GND_GND; - o->target = 0.0; + o->target = comedi_to_phys( 1, range, max_data ) / 2.0; } if(setup->da_subdev>=0){