7,7 → 7,7 |
#include <signal.h> |
#include <ctype.h> |
#include <time.h> |
//#include "../include/wusbxx_dll.h" /* the header of the shared library */ |
#include "../include/wusbxx_dll.h" /* the header of the shared library */ |
#include "../include/daq.h" |
|
//#define DEBUG /* vkljuci dodatni izpis */ |
26,11 → 26,11 |
//#define NADCCH 8 |
int ctrlc=0; |
char *ccserial=(char*)"CC0126"; |
int devDetect; // variable to tell if we detect any devices |
//int devDetect; // variable to tell if we detect any devices |
|
int daq::connect(){ |
// odpri daq |
/* xxusb_device_type devices[100]; |
xxusb_device_type devices[100]; |
//struct usb_device *dev; |
devDetect = xxusb_devices_find(devices); |
// printf("Detected devices: %d\n", devDetect); |
44,16 → 44,16 |
printf("daq::connect()\n"); |
} |
else |
*/ printf("daq::connect() - No devices were detected!\n"); |
printf("daq::connect() - No devices were detected!\n"); |
return 0; |
} |
|
int daq::init(int chan = 0){ |
|
// int i; |
// long k; |
int i; |
long k; |
|
/* DBGFUNI(xxusb_register_write(udev,1,0x0)); // Stop DAQ mode |
DBGFUNI(xxusb_register_write(udev,1,0x0)); // Stop DAQ mode |
while (xxusb_usbfifo_read(udev, (int*) stackdump,BUFF_L,100)>0); |
|
CCCZ; |
115,27 → 115,26 |
// ret[0] = CAMAC_register_read(udev,1,&k); |
// printf("k (return %d) -> 0x%08lX\n",ret[0],k); |
|
*/ printf("daq::init()\n"); |
printf("daq::init()\n"); |
return 0; |
} |
|
int daq::start(){ |
// xxusb_register_write(udev,1,0x1); // Start DAQ mode |
xxusb_register_write(udev,1,0x1); // Start DAQ mode |
printf("daq::start()\n"); |
return 0; |
} |
|
int daq::stop(){ |
// xxusb_register_write(udev,1,0x0); // Stop DAQ mode |
// while (xxusb_usbfifo_read(udev,(int *)stackdump,BUFF_L,30)>0); |
xxusb_register_write(udev,1,0x0); // Stop DAQ mode |
while (xxusb_usbfifo_read(udev,(int *)stackdump,BUFF_L,30)>0); |
printf("daq::stop()\n"); |
return 0; |
} |
|
int daq::event(unsigned int *data, int maxn){ |
// int ib,count; |
int count; |
/* int events,evsize; |
int ib,count; |
int events,evsize; |
short ret; |
|
ib=0; |
150,7 → 149,7 |
DBG(printf("Event:%d EvSize:%d\n", events, evsize);) |
for (int i=0;i<(NTDCCH+NADCCH);i++,ib++) data[count++] =stackdata[ib++]&0xffff; |
if (stackdata[ib++]!=0xfafb){ |
printf("Error!\n");, |
printf("Error!\n"); |
return 0; |
} |
events--; |
160,14 → 159,14 |
printf("Error!\n"); |
return 0; |
} |
*/ |
count = 1; |
|
// count = 1; |
return count; |
} |
|
int daq::disconnect(){ |
// zapri daq |
// WUSBXX_close(); |
WUSBXX_close(); |
printf("daq::disconnect()\n"); |
return 0; |
} |
204,7 → 203,7 |
|
|
// intercept routine |
if (signal (SIGINT, CatchSig) == SIG_E,RR) perror ("sigignore"); |
if (signal (SIGINT, CatchSig) == SIG_ERR) perror ("sigignore"); |
|
#define BSIZE 10000 |
int i,ieve,nc,nb; |
212,8 → 211,8 |
int hdr[4]={1,(NTDCCH+NADCCH+4)*sizeof(int)}; |
unsigned short adc; |
unsigned int data[BSIZE]; |
daq *d= new daq();, |
time_t time_check;, |
daq *d= new daq(); |
time_t time_check; |
|
// odpremo datoteko za pisanje |
FILE *fp=fopen(fname,"w"); |