357,8 → 357,20 |
return 0; |
} |
|
int rpdecimation(int i){ |
|
switch (i){ |
case 1: return 0; |
case 8: return 1; |
case 64: return 2; |
case 1024: return 3; |
case 8192: return 4; |
case 65536: return 5; |
} |
return 0; |
|
} |
|
int CVICALLBACK StartCB (int panel, int control, int event, |
void *callbackData, int eventData1, int eventData2) { |
char ip[0xFF]; |
372,7 → 384,7 |
unsigned short nsamples; |
int delay; |
int nbefore; |
unsigned short decimation; |
unsigned int decimation; |
unsigned short neve; |
int output; |
switch (event) { |
388,7 → 400,7 |
GetCtrlVal(panel,PANEL_DEBUG , &debug); |
GetCtrlVal(panel,PANEL_NBEFORE , &nbefore); |
GetCtrlVal(panel,PANEL_ENABLEDOUTPUT, &output); |
GetCtrlVal(panel,PANEL_OUTWAVE, &outwaveforms); |
GetCtrlVal(panel,PANEL_OUTWAVE, &outwaveforms); |
GetCtrlVal(panel,PANEL_FILENAME, filename); |
|
delay= MINTRGDELAY + nsamples - nbefore + 1; |
419,15 → 431,16 |
GetCtrlVal(panel,PANEL_START, &state); |
if (state && eventData1==0) { |
histoinit(); |
for (int i=0; i<nsamples; i++) timebins[i]=(i-nbefore)*8*decimation/1000.; |
/* decimation n (=1,8,64...) : frequency = 125/n MHz*/ |
for (int i=0; i<nsamples; i++) timebins[i]=(i-nbefore)* (float)decimation /125.; |
if (output) foutput = fopen(filename, "wb"); |
|
printf("decimation %d\n", decimation); |
SetCtrlVal(panel,PANEL_CEVE , 0); |
ctrl_c=0; |
hdr[0] = 0; |
hdr[1] = 7*sizeof(int); |
hdr[2] = delay; |
hdr[3] = decimation; |
hdr[3] = rpdecimation(decimation); |
hdr[4] = level * 1000; |
sbuff[0] = neve; |
sbuff[1] = nsamples; |