
struct datastruct{
  unsigned short header[2];
  unsigned short status;
  unsigned short hitmap;      
  unsigned short regist[6];   
  unsigned short shift[16];     
  unsigned short counters[16];  
  unsigned short coinc[8];
  unsigned short trigg;    
  unsigned short clock[2];        
  unsigned short temp[2];    
  unsigned short DAC[16];
  unsigned short CRC;
};

//physics structure
datastruct physicsdata;

//pointer to struct
datastruct *physicspointer;

//read variables
int i,err,found;
unsigned short buffer[1000];
unsigned short tmp1,tmp2;

int flip(int i16)
{
  int temp;
  
  temp = 0;
  temp |= 0xFF00 & ((0x00FF & i16) << 8);
  temp |= 0x00FF & ((0xFF00 & i16) >> 8);
  return temp;
}


