/[PAMELA software]/yoda/techmodel/forroutines/anticounter/ACcalib.c
ViewVC logotype

Diff of /yoda/techmodel/forroutines/anticounter/ACcalib.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by kusanagi, Sat Jul 17 20:03:42 2004 UTC revision 2.0 by kusanagi, Tue Sep 21 20:51:02 2004 UTC
# Line 1  Line 1 
1  #include <stdio.h>  #include <stdio.h>
2  #include "ACcalib.h"  #include "ACcalib.h"
3    
4    // Program to read AC calibration data
5    // 0408 Petter Hofverberg, petter@particle.kth.se
6    
7  int ACcalib(int length, unsigned short* datapointer, struct datastruct* calibpointer){  int ACcalib(int length, unsigned short* datapointer, struct datastruct* calibpointer)
8    {
 struct datastruct calibdata;  
   
 //pointer to struct  
 struct datastruct *calibpointer;  
   
 int fd,i,j,err,found;  
 unsigned short buffer[10000];  
 unsigned short tmp1,tmp2;  
   
   
9    int iter=2;    int iter=2;
10    
11    //point struc-pointer to calibdata    //point struc-pointer to calibdata
# Line 48  unsigned short tmp1,tmp2; Line 40  unsigned short tmp1,tmp2;
40        else{        else{
41        datapointer++;        datapointer++;
42        iter=iter+2;}        iter=iter+2;}
   
43      }      }
44    
45    //check errors    //check errors
# Line 63  unsigned short tmp1,tmp2; Line 54  unsigned short tmp1,tmp2;
54    calibdata.header=buffer[0];    calibdata.header=buffer[0];
55    for(i=0;i<5;i++) calibdata.status[i]=buffer[1+i];    for(i=0;i<5;i++) calibdata.status[i]=buffer[1+i];
56    for(i=0;i<8;i++) calibdata.temp[i]=buffer[6+i];    for(i=0;i<8;i++) calibdata.temp[i]=buffer[6+i];
57    for(i=0;i<16;i++) calibdata.DAC[i]=buffer[14+i];    for(i=0;i<8;i++) calibdata.DAC1[i]=buffer[14+i];
58      for(i=0;i<8;i++) calibdata.DAC2[i]=buffer[22+i];
59    for(i=0;i<6;i++) calibdata.regist[i]=buffer[30+i];    for(i=0;i<6;i++) calibdata.regist[i]=buffer[30+i];
60    for(i=0;i<8;i++) calibdata.time[i]=buffer[36+i];    for(i=0;i<8;i++) calibdata.time[i]=buffer[36+i];
61    calibdata.n_tr=buffer[44];    calibdata.n_tr=buffer[44];
# Line 74  unsigned short tmp1,tmp2; Line 66  unsigned short tmp1,tmp2;
66    calibdata.tail=buffer[8254];    calibdata.tail=buffer[8254];
67    calibdata.CRC=buffer[8255];    calibdata.CRC=buffer[8255];
68        
69    /*    /*  
70    //debug    //debug
71    printf("header: %hx\n",calibdata.header);    printf("header: %hx\n",calibdata.header);
72    printf("status: %hx\n",calibdata.status[0]);    printf("status: %hx\n",calibdata.status[0]);
73    printf("temp: %hx\n",calibdata.temp[0]);    printf("temp: %hx\n",calibdata.temp[0]);
74    printf("DAC: %hx\n",calibdata.DAC[0]);    printf("DAC1: %hx\n",calibdata.DAC1[0]);
75      printf("DAC2: %hx\n",calibdata.DAC2[0]);
76    printf("regist: %hx\n",calibdata.regist[0]);    printf("regist: %hx\n",calibdata.regist[0]);
77    printf("time: %hx\n",calibdata.time[0]);    printf("time: %hx\n",calibdata.time[0]);
78    printf("n_tr: %hx\n",calibdata.n_tr);    printf("n_tr: %hx\n",calibdata.n_tr);
# Line 94  unsigned short tmp1,tmp2; Line 87  unsigned short tmp1,tmp2;
87    
88    return err;    return err;
89  }  }
90    

Legend:
Removed from v.1.2  
changed lines
  Added in v.2.0

  ViewVC Help
Powered by ViewVC 1.1.23