--- yoda/techmodel/forroutines/anticounter/ACphysics.c 2004/07/08 12:48:23 1.1 +++ yoda/techmodel/forroutines/anticounter/ACphysics.c 2004/07/17 20:03:42 1.2 @@ -3,16 +3,29 @@ #include #include "ACphysics.h" -int ACphysics(unsigned short* datapointer,struct datastruct* physicspointer) -{ +int ACphysics(int length,unsigned short* datapointer,struct datastruct* physicspointer){ - *physicspointer=physicsdata; +//physics structure +struct datastruct physicsdata; +//pointer to struct +struct datastruct *physicspointer; + +//read variables +int i,err,found; +unsigned short buffer[100]; +unsigned short tmp1,tmp2; + + int iter=2; + + *physicspointer=physicsdata; + //look for header AC11, then cut out the event to a temp buffer - while(found==0) + while(found==0 && iter=length) + err=2; + else if(buffer[1]==0xAC22) err=0; else err=1; @@ -56,7 +73,7 @@ for(i=0;i<2;i++) physicsdata.temp[i]=buffer[53+i]; for(i=0;i<8;i++) physicsdata.DAC[i]=buffer[55+i]; physicsdata.CRC=buffer[63]; - + return err; }