--- yoda/techmodel/forroutines/anticounter/ACcalib.c 2004/07/17 20:03:42 1.2 +++ yoda/techmodel/forroutines/anticounter/ACcalib.c 2004/08/25 10:14:28 1.3 @@ -1,19 +1,11 @@ #include #include "ACcalib.h" +// Program to read AC calibration data +// 0408 Petter Hofverberg, petter@particle.kth.se -int ACcalib(int length, unsigned short* datapointer, struct datastruct* calibpointer){ - -struct datastruct calibdata; - -//pointer to struct -struct datastruct *calibpointer; - -int fd,i,j,err,found; -unsigned short buffer[10000]; -unsigned short tmp1,tmp2; - - +int ACcalib(int length, unsigned short* datapointer, struct datastruct* calibpointer) +{ int iter=2; //point struc-pointer to calibdata @@ -48,7 +40,6 @@ else{ datapointer++; iter=iter+2;} - } //check errors @@ -63,7 +54,8 @@ calibdata.header=buffer[0]; for(i=0;i<5;i++) calibdata.status[i]=buffer[1+i]; for(i=0;i<8;i++) calibdata.temp[i]=buffer[6+i]; - for(i=0;i<16;i++) calibdata.DAC[i]=buffer[14+i]; + for(i=0;i<8;i++) calibdata.DAC1[i]=buffer[14+i]; + for(i=0;i<8;i++) calibdata.DAC2[i]=buffer[22+i]; for(i=0;i<6;i++) calibdata.regist[i]=buffer[30+i]; for(i=0;i<8;i++) calibdata.time[i]=buffer[36+i]; calibdata.n_tr=buffer[44]; @@ -74,12 +66,13 @@ calibdata.tail=buffer[8254]; calibdata.CRC=buffer[8255]; - /* + /* //debug printf("header: %hx\n",calibdata.header); printf("status: %hx\n",calibdata.status[0]); printf("temp: %hx\n",calibdata.temp[0]); - printf("DAC: %hx\n",calibdata.DAC[0]); + printf("DAC1: %hx\n",calibdata.DAC1[0]); + printf("DAC2: %hx\n",calibdata.DAC2[0]); printf("regist: %hx\n",calibdata.regist[0]); printf("time: %hx\n",calibdata.time[0]); printf("n_tr: %hx\n",calibdata.n_tr); @@ -94,3 +87,4 @@ return err; } +