devicename = optarg;
break;
default:
- printf("bad option %d\n",c);
+ //printf("bad option %d\n",c);
exit(1);
}
}
x = 0;
while(x2-x1 > 1){
x = (x1 + x2 + 1)/2;
- printf("trying %d\n",x);
+ DPRINT(3,"trying %d\n",x);
new_sv_init(&sv, setup->dev,0,chanspec);
setup->caldacs[dac].current = x;
y1 = y;
}
- measure_observable( setup, obs);
+ if(verbose>=3){
+ measure_observable( setup, obs);
+ }
}
DPRINT(0,"caldac[%d] set to %d\n",dac,x);
}
}
-#if 0
void cal_postgain_binary( calibration_setup_t *setup, int obs1, int obs2, int dac)
{
int x1, x2, x;
double y1, y2, y;
- new_sv_t sv;
- double target = setup->observables[obs1].target;
- unsigned int chanspec = setup->observables[obs].observe_insn.chanspec;
+ new_sv_t sv1, sv2;
+ double target = setup->observables[obs1].target - setup->observables[obs2].target;
+ unsigned int chanspec1 = setup->observables[obs1].observe_insn.chanspec;
+ unsigned int chanspec2 = setup->observables[obs2].observe_insn.chanspec;
- DPRINT(0,"binary: %s\n", setup->observables[obs].name);
- preobserve( setup, obs);
+ DPRINT(0,"postgain binary: %s, %s\n", setup->observables[obs1].name,
+ setup->observables[obs2].name);
x1 = 0;
x2 = setup->caldacs[dac].maxdata;
- new_sv_init(&sv, setup->dev,0,chanspec);
setup->caldacs[dac].current = x1;
update_caldac( setup, dac );
usleep(100000);
- new_sv_measure( setup->dev, &sv);
- y1 = sv.average;
+ preobserve( setup, obs1);
+ new_sv_init(&sv1, setup->dev,0,chanspec1);
+ new_sv_measure( setup->dev, &sv1);
+ y1 = sv1.average;
+ preobserve( setup, obs2);
+ new_sv_init(&sv2, setup->dev,0,chanspec2);
+ new_sv_measure( setup->dev, &sv2);
+ y1 -= sv2.average;
- new_sv_init(&sv, setup->dev,0,chanspec);
setup->caldacs[dac].current = x2;
update_caldac( setup, dac );
usleep(100000);
- new_sv_measure( setup->dev, &sv);
- y2 = sv.average;
+ preobserve( setup, obs1);
+ new_sv_init(&sv1, setup->dev,0,chanspec1);
+ new_sv_measure( setup->dev, &sv1);
+ y2 = sv1.average;
+ preobserve( setup, obs2);
+ new_sv_init(&sv2, setup->dev,0,chanspec2);
+ new_sv_measure( setup->dev, &sv2);
+ y2 -= sv2.average;
x = 0;
while(x2-x1 > 1){
x = (x1 + x2 + 1)/2;
- printf("trying %d\n",x);
+ DPRINT(3,"trying %d\n",x);
- new_sv_init(&sv, setup->dev,0,chanspec);
setup->caldacs[dac].current = x;
update_caldac( setup, dac );
usleep(100000);
- new_sv_measure( setup->dev, &sv);
- y = sv.average;
+ preobserve( setup, obs1);
+ new_sv_init(&sv1, setup->dev,0,chanspec1);
+ new_sv_measure( setup->dev, &sv1);
+ y = sv1.average;
+ preobserve( setup, obs2);
+ new_sv_init(&sv2, setup->dev,0,chanspec2);
+ new_sv_measure( setup->dev, &sv2);
+ y -= sv2.average;
if(fabs(y2 - target) > fabs(y1 - target)){
x2 = x;
y1 = y;
}
- measure_observable( setup, obs);
+ if(verbose>=3){
+ measure_observable( setup, obs1);
+ measure_observable( setup, obs2);
+ }
}
DPRINT(0,"caldac[%d] set to %d\n",dac,x);
if(verbose>=3){
- measure_observable( setup, obs);
+ measure_observable( setup, obs1);
+ measure_observable( setup, obs2);
}
}
-#endif
#if 0
void chan_cal(int adc,int cdac,int range,double target)
*
*/
- postgain_cal( setup, ni_zero_offset_low,ni_zero_offset_high,2);
+ cal_postgain_binary( setup, ni_zero_offset_low,ni_zero_offset_high,2);
postgain_cal( setup, ni_zero_offset_low,ni_zero_offset_high,3);
cal1( setup, ni_zero_offset_high,0);
-cal_binary( setup, ni_zero_offset_high,0);
cal1( setup, ni_zero_offset_high,1);
- cal1( setup, ni_reference_low,4);
+ cal_binary( setup, ni_reference_low,4);
cal1_fine( setup, ni_reference_low,4);
cal1( setup, ni_reference_low,5);
cal1( setup, ni_unip_offset_low,6);
cal1_fine( setup, ni_unip_offset_low,6);
- //cal1( setup, ni_unip_offset_low,7);
if(do_output){
cal1( setup, ni_ao0_zero_offset,12+11);
+ cal1_fine( setup, ni_ao0_zero_offset,12+11);
cal1( setup, ni_ao0_reference,12+7);
+ cal1_fine( setup, ni_ao0_reference,12+7);
cal1( setup, ni_ao0_reference,12+3);
cal1( setup, ni_ao1_zero_offset,12+1);
cal1( setup, ni_ao1_reference,12+9);
+ cal1_fine( setup, ni_ao1_reference,12+9);
cal1( setup, ni_ao1_reference,12+5);
}
return 0;
{
/* this is for the ad8804_debug caldac */
- postgain_cal( setup, ni_zero_offset_low,ni_zero_offset_high,4);
+ cal_postgain_binary( setup, ni_zero_offset_low,ni_zero_offset_high,4);
+ //cal_postgain_fine( setup, ni_zero_offset_low,ni_zero_offset_high,4);
cal1( setup, ni_zero_offset_high,8);
- cal1( setup, ni_reference_low,2);
+ cal_binary( setup, ni_reference_low,2);
+ cal1_fine( setup, ni_reference_low,2);
cal1( setup, ni_unip_offset_low,7);
+ cal1_fine( setup, ni_unip_offset_low,7);
if(do_output){
- cal1( setup, ni_ao0_zero_offset,6);
+ cal_binary( setup, ni_ao0_zero_offset,6);
+ cal1_fine( setup, ni_ao0_zero_offset,6);
//cal1( setup, ni_ao0_nonlinearity,10);
- cal1( setup, ni_ao0_reference,11);
- cal1( setup, ni_ao1_zero_offset,9);
+ cal_binary( setup, ni_ao0_reference,11);
+ cal1_fine( setup, ni_ao0_reference,11);
+ cal_binary( setup, ni_ao1_zero_offset,9);
+ cal1_fine( setup, ni_ao1_zero_offset,9);
//cal1( setup, ni_ao1_nonlinearity,1);
- cal1( setup, ni_ao1_reference,5);
+ cal_binary( setup, ni_ao1_reference,5);
+ cal1_fine( setup, ni_ao1_reference,5);
}
return 0;
}
Id: ni.c,v 1.27 2002/06/06 01:21:10 ds Exp
Comedi version: 0.7.64
ai, bipolar zero offset, low gain
-offset -0.017094( 0), target 0
-caldac[2] gain=4.26(26)e-8 V/bit S_min=3409.07 dof=254
-caldac[4] gain=-1.021498(59)e-3 V/bit S_min=50641.2 dof=254
-caldac[6] gain=1.02(19)e-8 V/bit S_min=4115.85 dof=254
-caldac[8] gain=-6.908(46)e-6 V/bit S_min=22241.7 dof=254
-caldac[10] gain=1.03(14)e-8 V/bit S_min=5691.07 dof=254
-caldac[11] gain=1.96(27)e-8 V/bit S_min=3408.86 dof=254
-caldac[12] gain=-1.49(30)e-8 V/bit S_min=2469.79 dof=254
-caldac[13] gain=-1.19(19)e-8 V/bit S_min=4105.45 dof=254
-caldac[15] gain=-1.31(20)e-8 V/bit S_min=5662.46 dof=254
+offset -0.017056(38), target 0
+caldac[2] gain=2.97(20)e-7 V/bit S_min=536.642 dof=254
+caldac[4] gain=-1.021835(57)e-3 V/bit S_min=54130.4 dof=254
+caldac[8] gain=-1.2997(61)e-5 V/bit S_min=26561.5 dof=254
ai, bipolar zero offset, high gain
-offset 6.83(11)e-5, target 0
-caldac[2] gain=-4.99(99)e-9 V/bit S_min=288.746 dof=254
-caldac[3] gain=-4.13(99)e-9 V/bit S_min=293.248 dof=254
-caldac[4] gain=-5.10962(97)e-6 V/bit S_min=727.711 dof=254
-caldac[7] gain=-6.78(99)e-9 V/bit S_min=248.96 dof=254
-caldac[8] gain=-1.39849(10)e-5 V/bit S_min=1288.88 dof=254
+offset 4.90(12)e-5, target 0
+caldac[2] gain=-4.44(99)e-9 V/bit S_min=257.513 dof=254
+caldac[4] gain=-5.11054(97)e-6 V/bit S_min=752.803 dof=254
+caldac[8] gain=-1.39886(10)e-5 V/bit S_min=1046.88 dof=254
+caldac[10] gain=-3.98(99)e-9 V/bit S_min=257.543 dof=254
ai, bipolar voltage reference, low gain
-offset 4.97306(19), target 5
-caldac[2] gain=-5.88719(73)e-4 V/bit S_min=29950 dof=254
-caldac[4] gain=-1.008969(59)e-3 V/bit S_min=56500.4 dof=254
-caldac[8] gain=-2.5583(73)e-5 V/bit S_min=14492.6 dof=254
+offset 4.974130(91), target 5
+caldac[2] gain=-5.88644(75)e-4 V/bit S_min=28704.1 dof=254
+caldac[4] gain=-1.008968(58)e-3 V/bit S_min=60152.7 dof=254
+caldac[8] gain=-2.2137(72)e-5 V/bit S_min=21093.8 dof=254
ai, unipolar zero offset, low gain
offset 0.014652( 0), target 0
-caldac[0] gain=3.23(13)e-9 V/bit S_min=65130.6 dof=254
-caldac[1] gain=2.52(13)e-9 V/bit S_min=65389.8 dof=254
-caldac[2] gain=1.19191(17)e-3 V/bit S_min=17850.7 dof=134
-caldac[3] gain=-3.00(25)e-9 V/bit S_min=32625.1 dof=254
-caldac[4] gain=-1.01486(15)e-3 V/bit S_min=25438.3 dof=137
-caldac[5] gain=1.05(13)e-9 V/bit S_min=65724 dof=254
-caldac[7] gain=-3.8387(11)e-4 V/bit S_min=31783.2 dof=157
-caldac[8] gain=-2.372(29)e-6 V/bit S_min=8736.21 dof=254
-caldac[9] gain= V/bit S_min=inf dof=254
-caldac[11] gain=-4.20(25)e-9 V/bit S_min=32487.9 dof=254
-caldac[12] gain= V/bit S_min=inf dof=254
+caldac[1] gain=8.7(11)e-9 V/bit S_min=9911.87 dof=254
+caldac[2] gain=1.19214(16)e-3 V/bit S_min=19202.5 dof=134
+caldac[4] gain=-1.01499(14)e-3 V/bit S_min=27878.2 dof=137
+caldac[6] gain=6.0(11)e-9 V/bit S_min=7052.48 dof=254
+caldac[7] gain=-3.8429(11)e-4 V/bit S_min=31899.2 dof=157
+caldac[8] gain=-5.384(41)e-6 V/bit S_min=17989.9 dof=254
+caldac[14] gain=-8.0(19)e-9 V/bit S_min=4127.49 dof=254
ao 0, zero offset, low gain
offset -0.017094( 0), target 0.002442
-caldac[0] gain=5.17(38)e-9 V/bit S_min=21570.8 dof=254
-caldac[1] gain=-2.62(25)e-9 V/bit S_min=32659.1 dof=254
-caldac[2] gain=5.35(68)e-9 V/bit S_min=17683.9 dof=254
-caldac[3] gain=-1.35(13)e-9 V/bit S_min=65678.3 dof=254
-caldac[4] gain=-1.021496(58)e-3 V/bit S_min=52710.9 dof=254
-caldac[6] gain=-7.78336(56)e-4 V/bit S_min=56693.3 dof=254
-caldac[8] gain=-2.424(30)e-6 V/bit S_min=7393.87 dof=254
-caldac[10] gain=-1.17403(57)e-4 V/bit S_min=48658.3 dof=254
-caldac[11] gain=-1.77(25)e-9 V/bit S_min=32718.1 dof=254
-caldac[12] gain=-2.57(25)e-9 V/bit S_min=32663.6 dof=254
-caldac[13] gain=-1.51(38)e-9 V/bit S_min=21743.2 dof=254
-caldac[14] gain=-2.74(13)e-9 V/bit S_min=65316.8 dof=254
-caldac[15] gain=-6.73(38)e-9 V/bit S_min=21440.4 dof=254
-ao 0, reference voltage, low gain
-offset -0.017094( 0), target -0.001221
-caldac[0] gain=1.31(25)e-9 V/bit S_min=32740.8 dof=254
-caldac[1] gain=-2.85(13)e-9 V/bit S_min=65278.1 dof=254
-caldac[2] gain=2.12(13)e-9 V/bit S_min=65510.3 dof=254
+caldac[0] gain=-8.6(13)e-10 V/bit S_min=65747.1 dof=254
+caldac[1] gain= V/bit S_min=inf dof=254
+caldac[2] gain= V/bit S_min=inf dof=254
caldac[3] gain= V/bit S_min=inf dof=254
-caldac[4] gain=-1.021433(59)e-3 V/bit S_min=51765.8 dof=254
-caldac[5] gain=-3.10(13)e-9 V/bit S_min=65185.4 dof=254
-caldac[6] gain=-7.78395(57)e-4 V/bit S_min=53236.3 dof=254
-caldac[8] gain=-1.950(26)e-6 V/bit S_min=7024.76 dof=254
-caldac[10] gain=-1.40592(61)e-4 V/bit S_min=43847.7 dof=254
-caldac[11] gain=-1.29133(55)e-4 V/bit S_min=52013 dof=254
-caldac[12] gain=-1.84(13)e-9 V/bit S_min=65578.8 dof=254
-caldac[13] gain= V/bit S_min=inf dof=254
-caldac[14] gain=-1.95(13)e-9 V/bit S_min=65552.5 dof=254
-caldac[15] gain=-1.97(25)e-9 V/bit S_min=32706.8 dof=254
+caldac[4] gain=-1.021999(59)e-3 V/bit S_min=50246.8 dof=254
+caldac[5] gain=-2.85(13)e-9 V/bit S_min=65278.1 dof=254
+caldac[6] gain=-7.78616(59)e-4 V/bit S_min=49456.5 dof=254
+caldac[7] gain= V/bit S_min=inf dof=254
+caldac[8] gain=-1.635(27)e-6 V/bit S_min=3285.84 dof=254
+caldac[9] gain=3.07(13)e-9 V/bit S_min=65196.1 dof=254
+caldac[10] gain=-1.17537(57)e-4 V/bit S_min=47442.2 dof=254
+caldac[11] gain= V/bit S_min=inf dof=254
+caldac[12] gain= V/bit S_min=inf dof=254
+caldac[14] gain= V/bit S_min=inf dof=254
+caldac[15] gain= V/bit S_min=inf dof=254
+ao 0, reference voltage, low gain
+offset -0.017056(38), target -0.001221
+caldac[0] gain=3.29(13)e-9 V/bit S_min=65108 dof=254
+caldac[1] gain=-1.65(13)e-9 V/bit S_min=65621.1 dof=254
+caldac[2] gain=3.21(38)e-9 V/bit S_min=21916.2 dof=254
+caldac[3] gain=7.0(13)e-10 V/bit S_min=65763.3 dof=254
+caldac[4] gain=-1.021806(59)e-3 V/bit S_min=51245.7 dof=254
+caldac[5] gain=1.17(25)e-9 V/bit S_min=33004.2 dof=254
+caldac[6] gain=-7.78596(58)e-4 V/bit S_min=53205.2 dof=254
+caldac[7] gain= V/bit S_min=inf dof=254
+caldac[8] gain=-1.867(28)e-6 V/bit S_min=4125.2 dof=254
+caldac[9] gain= V/bit S_min=inf dof=254
+caldac[10] gain=-1.40307(62)e-4 V/bit S_min=43005.2 dof=254
+caldac[11] gain=-1.28930(54)e-4 V/bit S_min=56133.7 dof=254
+caldac[12] gain= V/bit S_min=inf dof=254
+caldac[13] gain=5.3(13)e-10 V/bit S_min=65776.1 dof=254
+caldac[14] gain= V/bit S_min=inf dof=254
+caldac[15] gain=2.06(13)e-9 V/bit S_min=65524.7 dof=254
ao 1, zero offset, low gain
offset -0.012210( 0), target 0.002442
-caldac[1] gain=-1.14975(64)e-4 V/bit S_min=36050.3 dof=254
-caldac[2] gain=1.601(95)e-7 V/bit S_min=1003.46 dof=254
-caldac[4] gain=-1.021610(62)e-3 V/bit S_min=41708.9 dof=254
-caldac[8] gain=-7.944(52)e-6 V/bit S_min=18169.4 dof=254
-caldac[9] gain=-7.73938(62)e-4 V/b
+caldac[0] gain=1.17(13)e-8 V/bit S_min=6259.83 dof=254
+caldac[1] gain=-1.15386(64)e-4 V/bit S_min=36386.4 dof=254
+caldac[2] gain=1.81(16)e-8 V/bit S_min=4700.21 dof=254
+caldac[4] gain=-1.021992(62)e-3 V/bit S_min=44024.4 dof=254
+caldac[6] gain=-3.52(75)e-9 V/bit S_min=10728.8 dof=254
+caldac[8] gain=-4.004(38)e-6 V/bit S_min=12914.5 dof=254
+caldac[9] gain=-7.74236(62)e-4 V/bit S_min=44441.8 dof=254
+caldac[11] gain=-7.3(13)e-9 V/bit S_min=6313.25 dof=254
+caldac[12] gain=-1.04(11)e-8 V/bit S_min=6997.1 dof=254
+caldac[15] gain=-7.8(14)e-9 V/bit S_min=5714.44 dof=254
+ao 1, reference voltage, low gain
+offset -0.012248(38), target -0.001221
+caldac[1] gain=-1.39443(61)e-4 V/bit S_min=40670.9 dof=254
+caldac[2] gain=8.47(44)e-7 V/bit S_min=346.812 dof=254
+caldac[4] gain=-1.021785(64)e-3 V/bit S_min=40319.8 dof=254
+caldac[5] gain=-1.28948(64)e-4 V/bit S_min=34383.6 dof=254
+caldac[8] gain=-1.5068(70)e-5 V/bit S_min=19726.7 dof=254
+caldac[9] gain=-7.74319(64)e-4 V/bit S_min=42090.3 dof=254
+postgain: ai, bipolar zero offset, low gain; ai, bipolar zero offset, high gain
+caldac[4] gain=-1.021856(57)e-3 V/bit S_min=54116 dof=254
+caldac[4] gain=-5.11241(97)e-6 V/bit S_min=804.644 dof=254
+caldac[4] set to 112 (111.528)
+linear: ai, bipolar zero offset, high gain
+caldac[8] gain=-1.39852(10)e-5 V/bit S_min=1152.21 dof=254
+caldac[8] set to 137 (136.857)
+linear: ai, bipolar voltage reference, low gain
+caldac[2] gain=-5.88111(75)e-4 V/bit S_min=32338.3 dof=254
+caldac[2] set to 107 (107.032)
+linear: ai, unipolar zero offset, low gain
+caldac[7] gain=-3.8340(14)e-4 V/bit S_min=31150.3 dof=134
+caldac[7] set to 145 (145.125)
+linear: ao 0, zero offset, low gain
+caldac[6] gain=-7.81193(59)e-4 V/bit S_min=49408.3 dof=254
+caldac[6] set to 122 (121.992)
+linear: ao 0, reference voltage, low gain
+caldac[11] gain=-1.29021(55)e-4 V/bit S_min=51532.3 dof=254
+caldac[11] set to 152 (152.149)
+linear: ao 1, zero offset, low gain
+caldac[9] gain=-7.76801(61)e-4 V/bit S_min=45352.2 dof=254
+caldac[9] set to 127 (127.448)
+linear: ao 1, reference voltage, low gain
+caldac[5] gain=-1.28844(62)e-4 V/bit S_min=38678.7 dof=254
+caldac[5] set to 149 (148.733)
+ai, bipolar zero offset, low gain
+offset -2.366(54)e-3, target 0
+caldac[4] gain=-1.024297(58)e-3 V/bit S_min=54044.9 dof=254
+caldac[8] gain=-1.6330(79)e-5 V/bit S_min=12534.8 dof=254
+ai, bipolar zero offset, high gain
+offset -1.45(11)e-5, target 0
+caldac[2] gain=6.79(90)e-9 V/bit S_min=284.657 dof=254
+caldac[4] gain=-5.12071(98)e-6 V/bit S_min=692.976 dof=254
+caldac[8] gain=-1.40242(10)e-5 V/bit S_min=1141.14 dof=254
+ai, bipolar voltage reference, low gain
+offset 4.998817(38), target 5
+caldac[2] gain=-5.88265(75)e-4 V/bit S_min=32107.8 dof=254
+caldac[4] gain=-1.010429(58)e-3 V/bit S_min=58701.3 dof=254
+caldac[8] gain=-7.231(55)e-6 V/bit S_min=9875.11 dof=254
+ai, unipolar zero offset, low gain
+offset nan, target 0
+caldac[2] gain=1.19139(15)e-3 V/bit S_min=20993.8 dof=141
+caldac[4] gain=-1.01645(20)e-3 V/bit S_min=21632.1 dof=106
+caldac[7] gain=-3.8376(15)e-4 V/bit S_min=27467.5 dof=133
+ao 0, zero offset, low gain
+Segmentation fault