CAEN V767 128 Channel Gen. Purpose MH TDC - Physics
CAEN V767 128 Channel Gen. Purpose MH TDC - Physics
CAEN V767 128 Channel Gen. Purpose MH TDC - Physics
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
02/07/2003 <strong>V767</strong> User's Manual – Rev.4<br />
/* checks the Write OK bit */<br />
do<br />
{<br />
rdata = *opc_hs;<br />
time++;<br />
}<br />
while( (rdata != 0x02) && (time < TIMEOUT) );<br />
if(time == TIMEOUT) /* a time out error is occurred */<br />
{<br />
printf("Timeout error\n");<br />
return(-1);<br />
}<br />
delay(10); /* waits for 10 ms */<br />
*opc_reg = data; /* vme write access to opcode register */<br />
return(0);<br />
}<br />
/****************************************************************/<br />
/* this function allows to read an operand */<br />
/****************************************************************/<br />
int read_op (unsigned short *data)<br />
{<br />
unsigned short *opc_hs, *opc_reg;<br />
unsigned short rdata;<br />
int time=0;<br />
/* sets <strong>V767</strong> registers addresses */<br />
opc_hs = (unsigned short *)(<strong>V767</strong>_BASE_ADDRESS + 0x50);<br />
opc_reg = (unsigned short *)(<strong>V767</strong>_BASE_ADDRESS + 0x52);<br />
/* waits until a new read/write opcode operation is ready */<br />
do<br />
{<br />
rdata = *opc_hs;<br />
time++;<br />
}<br />
while( (rdata != 0x01) && (time < TIMEOUT) );<br />
if(time == TIMEOUT) /* a time out error is occurred */<br />
{<br />
printf("Timeout error\n");<br />
return(-1);<br />
}<br />
delay(10); /* waits for 10 ms */<br />
*data = *opc_reg; /* vme read access to opcode register */<br />
return(0);<br />
}<br />
NPO:<br />
00001/97:<strong>V767</strong>x.MUTx/04 Page 40 of 75