Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 262 → Rev 263

/cvi/apps/RedPitaya/soccli/redpitaya_gui.h
34,60 → 34,62
#define PANEL_SAMPLES 19 /* control type: numeric, callback function: (none) */
#define PANEL_NTOTAL 20 /* control type: numeric, callback function: (none) */
#define PANEL_NEVE 21 /* control type: numeric, callback function: (none) */
#define PANEL_CEVE 22 /* control type: numeric, callback function: (none) */
#define PANEL_ADC2 23 /* control type: graph, callback function: (none) */
#define PANEL_TDC2 24 /* control type: graph, callback function: (none) */
#define PANEL_ADC1 25 /* control type: graph, callback function: (none) */
#define PANEL_TDC1 26 /* control type: graph, callback function: (none) */
#define PANEL_DECIMATION 27 /* control type: ring, callback function: (none) */
#define PANEL_TRIGGER 28 /* control type: ring, callback function: (none) */
#define PANEL_OUTWAVE 29 /* control type: radioButton, callback function: (none) */
#define PANEL_ENABLEDOUTPUT 30 /* control type: radioButton, callback function: (none) */
#define PANEL_DEBUG 31 /* control type: radioButton, callback function: (none) */
#define PANEL_CH1 32 /* control type: radioButton, callback function: (none) */
#define PANEL_GRAPH 33 /* control type: graph, callback function: (none) */
#define PANEL_CH0 34 /* control type: radioButton, callback function: (none) */
#define PANEL_TEXTMSG 35 /* control type: textMsg, callback function: (none) */
#define PANEL_STDIO 36 /* control type: textBox, callback function: (none) */
#define PANEL_MAXX_3 37 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_3 38 /* control type: numeric, callback function: (none) */
#define PANEL_NCH_3 39 /* control type: numeric, callback function: (none) */
#define PANEL_MAXX_4 40 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_4 41 /* control type: numeric, callback function: (none) */
#define PANEL_NCH_4 42 /* control type: numeric, callback function: (none) */
#define PANEL_MAXX_2 43 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_2 44 /* control type: numeric, callback function: (none) */
#define PANEL_NCH_2 45 /* control type: numeric, callback function: (none) */
#define PANEL_MAXX_6 46 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_6 47 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_10 48 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_10 49 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_9 50 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_9 51 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_8 52 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_8 53 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_7 54 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_7 55 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_5 56 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_5 57 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_AUTOY_5 58 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_1 59 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_1 60 /* control type: numeric, callback function: (none) */
#define PANEL_AUTOY_4 61 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_NCH_1 62 /* control type: numeric, callback function: (none) */
#define PANEL_CONNECT 63 /* control type: textButton, callback function: StartCB */
#define PANEL_AUTOY_3 64 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_AUTOY_2 65 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_START 66 /* control type: textButton, callback function: StartCB */
#define PANEL_ADCTYPE 67 /* control type: binary, callback function: (none) */
#define PANEL_AUTOY 68 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_LOGY_4 69 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_LOGY_3 70 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_LOGY_2 71 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_EXCLUDE_2 72 /* control type: radioButton, callback function: (none) */
#define PANEL_EXCLUDE_1 73 /* control type: radioButton, callback function: (none) */
#define PANEL_LOGY_1 74 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_AUTOX 75 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_CTIME 22 /* control type: numeric, callback function: (none) */
#define PANEL_CDAQTIME 23 /* control type: numeric, callback function: (none) */
#define PANEL_CEVE 24 /* control type: numeric, callback function: (none) */
#define PANEL_ADC2 25 /* control type: graph, callback function: (none) */
#define PANEL_TDC2 26 /* control type: graph, callback function: (none) */
#define PANEL_ADC1 27 /* control type: graph, callback function: (none) */
#define PANEL_TDC1 28 /* control type: graph, callback function: (none) */
#define PANEL_DECIMATION 29 /* control type: ring, callback function: (none) */
#define PANEL_TRIGGER 30 /* control type: ring, callback function: (none) */
#define PANEL_OUTWAVE 31 /* control type: radioButton, callback function: (none) */
#define PANEL_ENABLEDOUTPUT 32 /* control type: radioButton, callback function: (none) */
#define PANEL_DEBUG 33 /* control type: radioButton, callback function: (none) */
#define PANEL_CH1 34 /* control type: radioButton, callback function: (none) */
#define PANEL_GRAPH 35 /* control type: graph, callback function: (none) */
#define PANEL_CH0 36 /* control type: radioButton, callback function: (none) */
#define PANEL_TEXTMSG 37 /* control type: textMsg, callback function: (none) */
#define PANEL_STDIO 38 /* control type: textBox, callback function: (none) */
#define PANEL_MAXX_3 39 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_3 40 /* control type: numeric, callback function: (none) */
#define PANEL_NCH_3 41 /* control type: numeric, callback function: (none) */
#define PANEL_MAXX_4 42 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_4 43 /* control type: numeric, callback function: (none) */
#define PANEL_NCH_4 44 /* control type: numeric, callback function: (none) */
#define PANEL_MAXX_2 45 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_2 46 /* control type: numeric, callback function: (none) */
#define PANEL_NCH_2 47 /* control type: numeric, callback function: (none) */
#define PANEL_MAXX_6 48 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_6 49 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_10 50 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_10 51 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_9 52 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_9 53 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_8 54 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_8 55 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_7 56 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_7 57 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_5 58 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_MINX_5 59 /* control type: numeric, callback function: SetGraphPropertiesCB */
#define PANEL_AUTOY_5 60 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_MAXX_1 61 /* control type: numeric, callback function: (none) */
#define PANEL_MINX_1 62 /* control type: numeric, callback function: (none) */
#define PANEL_AUTOY_4 63 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_NCH_1 64 /* control type: numeric, callback function: (none) */
#define PANEL_CONNECT 65 /* control type: textButton, callback function: StartCB */
#define PANEL_AUTOY_3 66 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_AUTOY_2 67 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_START 68 /* control type: textButton, callback function: StartCB */
#define PANEL_ADCTYPE 69 /* control type: binary, callback function: (none) */
#define PANEL_AUTOY 70 /* control type: radioButton, callback function: SetGraphPropertiesCB */
#define PANEL_LOGY_4 71 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_LOGY_3 72 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_LOGY_2 73 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_EXCLUDE_2 74 /* control type: radioButton, callback function: (none) */
#define PANEL_EXCLUDE_1 75 /* control type: radioButton, callback function: (none) */
#define PANEL_LOGY_1 76 /* control type: radioButton, callback function: SetGraphLogYCB */
#define PANEL_AUTOX 77 /* control type: radioButton, callback function: SetGraphPropertiesCB */
 
 
/* Control Arrays: */
/cvi/apps/RedPitaya/soccli/redpitaya_gui.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/RedPitaya/soccli/soccli.c
22,7 → 22,7
static int plothandle[2]= {0,0};
static int tdcplothandle[2]= {0,0};
static int adcplothandle[2]= {0,0};
static int excludefirst[2]= {0,0};
static int excludefirst[2]= {0,0};
int debug ;
int initialized = 0;
#define MAX_THREADS 10
30,6 → 30,8
int adctype;
float athreshold, twin0,twin1;
float timebins[0XFFFF];
float daqtime;
double starttime;
 
FILE *foutput;
int outwaveforms=0;
56,7 → 58,7
switch (type) {
case 0:
case 1:
sprintf(filename,"%s_%d.root",fname, hid);
sprintf(filename,"%s_%d.root",fname, hid);
fp =fopen(filename,"wb");
if (fp) {
H1D_Write2File(hid,fp);
77,7 → 79,7
fclose(fp);
printf("Histogram %d exported to %s\n", hid, filename);
}
 
break;
 
}
98,9 → 100,8
SetSleepPolicy(VAL_SLEEP_MORE);
CmtNewThreadPool (MAX_THREADS, &poolHandle);
 
//for (int i=0;i<1000;i++) H1D_Fill(1,i,i);
//H1D_Draw(1,panelHandle,PANEL_ADC1,&adcplothandle[0]);
printf("size of double = %d\n",sizeof(double));
//printf("size of double = %d\n",sizeof(double));
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
133,91 → 134,95
 
 
int CVICALLBACK SetGraphLogYCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int cid=0;
int logy=0;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panel,control, &logy);
switch (control){
case PANEL_LOGY_1: cid = PANEL_TDC1; break;
case PANEL_LOGY_2: cid = PANEL_ADC1; break;
case PANEL_LOGY_3: cid = PANEL_TDC2; break;
case PANEL_LOGY_4: cid = PANEL_ADC2; break;
}
if (logy) SetCtrlAttribute (panel, cid, ATTR_YMAP_MODE, VAL_LOG);
else SetCtrlAttribute (panel, cid, ATTR_YMAP_MODE, VAL_LINEAR);
break;
}
return 0;
void *callbackData, int eventData1, int eventData2) {
 
int cid=0;
int logy=0;
switch (event) {
case EVENT_COMMIT:
GetCtrlVal(panel,control, &logy);
switch (control) {
case PANEL_LOGY_1:
cid = PANEL_TDC1;
break;
case PANEL_LOGY_2:
cid = PANEL_ADC1;
break;
case PANEL_LOGY_3:
cid = PANEL_TDC2;
break;
case PANEL_LOGY_4:
cid = PANEL_ADC2;
break;
}
if (logy) SetCtrlAttribute (panel, cid, ATTR_YMAP_MODE, VAL_LOG);
else SetCtrlAttribute (panel, cid, ATTR_YMAP_MODE, VAL_LINEAR);
break;
}
return 0;
}
 
int CVICALLBACK SetGraphPropertiesCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
void *callbackData, int eventData1, int eventData2) {
 
float min, max;
int autoscale;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal(panelHandle,PANEL_MINX_5, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_5, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
float min, max;
int autoscale;
switch (event) {
case EVENT_COMMIT:
GetCtrlVal(panelHandle,PANEL_MINX_5, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_5, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
 
GetCtrlVal(panelHandle,PANEL_MINX_6, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_6, &max);
GetCtrlVal(panelHandle,PANEL_AUTOX, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_BOTTOM_XAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_BOTTOM_XAXIS, VAL_MANUAL, min, max);
GetCtrlVal(panelHandle,PANEL_MINX_7, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_7, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_2, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_TDC1, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_TDC1, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
GetCtrlVal(panelHandle,PANEL_MINX_8, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_8, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_3, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_ADC1, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_ADC1, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
GetCtrlVal(panelHandle,PANEL_MINX_9, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_9, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_4, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_TDC2, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_TDC2, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
GetCtrlVal(panelHandle,PANEL_MINX_6, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_6, &max);
GetCtrlVal(panelHandle,PANEL_AUTOX, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_BOTTOM_XAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_GRAPH, VAL_BOTTOM_XAXIS, VAL_MANUAL, min, max);
 
GetCtrlVal(panelHandle,PANEL_MINX_10, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_10, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_5, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_ADC2, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_ADC2, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
 
GetCtrlVal(panelHandle,PANEL_MINX_7, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_7, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_2, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_TDC1, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_TDC1, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
 
break;
}
return 0;
GetCtrlVal(panelHandle,PANEL_MINX_8, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_8, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_3, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_ADC1, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_ADC1, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
 
GetCtrlVal(panelHandle,PANEL_MINX_9, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_9, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_4, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_TDC2, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_TDC2, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
 
GetCtrlVal(panelHandle,PANEL_MINX_10, &min);
GetCtrlVal(panelHandle,PANEL_MAXX_10, &max);
GetCtrlVal(panelHandle,PANEL_AUTOY_5, &autoscale);
if (autoscale)
SetAxisScalingMode (panelHandle, PANEL_ADC2, VAL_LEFT_YAXIS, VAL_AUTOSCALE, min, max);
else
SetAxisScalingMode (panelHandle, PANEL_ADC2, VAL_LEFT_YAXIS, VAL_MANUAL, min, max);
 
 
 
break;
}
return 0;
}
 
 
266,13 → 271,13
SetCtrlAttribute (panelHandle, PANEL_TDC1, ATTR_YNAME, H1D_GetTitleY(3) );
SetCtrlAttribute (panelHandle, PANEL_TDC2, ATTR_XNAME, H1D_GetTitleX(4) );
SetCtrlAttribute (panelHandle, PANEL_TDC2, ATTR_YNAME, H1D_GetTitleY(4) );
SetGraphLogYCB( panelHandle, PANEL_LOGY_1, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_2, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_3, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_4, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_1, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_2, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_3, EVENT_COMMIT,NULL,0,0);
SetGraphLogYCB( panelHandle, PANEL_LOGY_4, EVENT_COMMIT,NULL,0,0);
 
SetGraphPropertiesCB( panelHandle, PANEL, EVENT_COMMIT,NULL,0,0);
 
SetCtrlAttribute (panelHandle, PANEL_GRAPH, ATTR_LABEL_TEXT , "sampling adc data");
SetCtrlAttribute (panelHandle, PANEL_GRAPH, ATTR_XNAME, "t(us)" );
SetCtrlAttribute (panelHandle, PANEL_GRAPH, ATTR_YNAME, "U(V)" );
280,7 → 285,7
GetCtrlVal(panelHandle,PANEL_TWIN0, &twin0);
GetCtrlVal(panelHandle,PANEL_TWIN1, &twin1);
GetCtrlVal(panelHandle,PANEL_ADCTYPE, &adctype);
GetCtrlVal(panelHandle,PANEL_ITRGLEVEL , &athreshold);
GetCtrlVal(panelHandle,PANEL_ITRGLEVEL , &athreshold);
return 0;
}
 
296,6 → 301,11
static float qdc = 0;
*ninfo = 0;
printf("Run HDR LEN=%d NEVE=%d dt=%f adc=%f qdc=%f\n", ibuf[0],ibuf[1],fbuf[2],adc,qdc);
daqtime += fbuf[2];
 
SetCtrlVal(panelHandle, PANEL_CDAQTIME,daqtime);
SetCtrlVal(panelHandle, PANEL_CTIME, Timer() -starttime);
daqtime =0;
while (nr<nb) {
 
int recid = *data++;
337,36 → 347,36
adc=10000;
qdc=0;
int nqdc=0;
int ntdc=0;
int ntdc=0;
for (int k=1; k<nsamples; k++) {
float t =timebins[k];
float tp=timebins[k-1];
if (fdata[k] < adc) adc = fdata[k];
if (t>twin0 && t<twin1 ) {
nqdc++;
nqdc++;
qdc+=fdata[k];
}
}
if (fdata[k]< athreshold && fdata[k-1]> athreshold) {
double t0= tp+(athreshold-fdata[k-1])/(fdata[k]-fdata[k-1])* (t-tp);
if (ntdc>0) H1D_Fill(3+id, t0,1);
if (ntdc==0 && !excludefirst[id]) H1D_Fill(3+id, t0,1);
finfo[*ninfo+4+ntdc]=t0;
ntdc++;
finfo[*ninfo+4+ntdc]=t0;
ntdc++;
}
}
if (nqdc) qdc/=nqdc;
//printf("adc %f qdc %f\n", adc,qdc);
info[*ninfo]=(ntdc+4)*sizeof(int); // len
info[*ninfo+1]=id | 0xF0000000; // recid
finfo[*ninfo+2]=adc;
finfo[*ninfo+3]=qdc;
*ninfo+= ntdc+4;
info[*ninfo]=(ntdc+4)*sizeof(int); // len
info[*ninfo+1]=id | 0xF0000000; // recid
finfo[*ninfo+2]=adc;
finfo[*ninfo+3]=qdc;
*ninfo+= ntdc+4;
 
if (adctype)
H1D_Fill(1+id, -adc,1);
else
H1D_Fill(1+id, -qdc,1);
 
nr+=4*nsamples;
data+=nsamples;
}
414,7 → 424,7
}
if (debug) printf("Received RECID %d HDRLEN %d == read %d\n", hdr[0], size, nb);
 
int ninfo=0;
int ninfo=0;
switch (hdr[0]) {
case 0:
data[nb]=0;
424,18 → 434,18
 
GetCtrlVal(panelHandle,PANEL_CEVE , &event);
GetCtrlVal(panelHandle,PANEL_NTOTAL , &ncalls);
 
event += analyse(nb,data, evinfo, &ninfo);
if (foutput) {
if (outwaveforms) fwrite(data, 1, nb, foutput);
fwrite(evinfo, 1, ninfo*sizeof(int), foutput);
time(&t1);
if ((t1-t0)>10000) {
for (int i=0;i<4;i++) H1D_Write2File(1+i,foutput);
time(&t0);
}
}
if (outwaveforms) fwrite(data, 1, nb, foutput);
fwrite(evinfo, 1, ninfo*sizeof(int), foutput);
time(&t1);
if ((t1-t0)>10000) {
for (int i=0; i<4; i++) H1D_Write2File(1+i,foutput);
 
time(&t0);
}
}
SetCtrlVal(panelHandle,PANEL_CEVE , event);
if (event>=ncalls) StartCB (panelHandle, PANEL_START, EVENT_COMMIT, NULL,1,0);
 
451,17 → 461,23
return 0;
}
 
int rpdecimation(int i){
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;
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;
 
}
 
494,7 → 510,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;
506,8 → 522,8
 
double level =0;
GetCtrlVal(panel,PANEL_TRGLEVEL , &level);
 
 
switch (control) {
case PANEL_CONNECT: {
int state;
523,14 → 539,16
case PANEL_START: {
int state;
GetCtrlVal(panel,PANEL_START, &state);
GetCtrlVal(panel,PANEL_EXCLUDE_1, &excludefirst[0]);
GetCtrlVal(panel,PANEL_EXCLUDE_1, &excludefirst[0]);
GetCtrlVal(panel,PANEL_EXCLUDE_2, &excludefirst[1]);
if (state && eventData1==0) {
histoinit();
/* decimation n (=1,8,64...) : frequency = 125/n MHz*/
starttime=Timer();
daqtime =0;
/* 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);
printf("decimation %d\n", decimation);
SetCtrlVal(panel,PANEL_CEVE , 0);
ctrl_c=0;
hdr[0] = 0;
548,8 → 566,8
hdr[0] = 1;
hdr[1] = 2*sizeof(int);
ClientTCPWrite(chandle,&hdr[0],hdr[1],5000); // stop the transfer
printf("INFO Stopping the acquisition\n");
SetCtrlVal(panel,PANEL_START, 0);
printf("INFO Stopping the acquisition\n");
SetCtrlVal(panel,PANEL_START, 0);
if (foutput) fclose(foutput);
foutput=NULL;
}
/cvi/apps/RedPitaya/soccli/soccli.cws
1,6 → 1,6
[Workspace Header]
Version = 1302
Pathname = "/c/home/CVI/RedPitaya/soccli/soccli.cws"
Pathname = "/c/home/cvi/apps/RedPitaya/soccli/soccli.cws"
CVI Dir = "/c/program files (x86)/national instruments/cvi2013"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
CVI Pub Local Dir = "/C/ProgramData/National Instruments/CVI2013"
12,14 → 12,14
Number of Projects = 2
Active Project = 1
Project 0001 = "soccli.prj"
Project 0002 = "/c/home/CVI/RedPitaya/RedPitaya.prj"
Project 0002 = "/c/home/cvi/apps/RedPitaya/RedPitaya.prj"
Project 0002 Folder User Interface Files Collapsed = True
Project 0002 FolderId 0 Collapsed = True
Drag Bar Left = 202
Window Top = 137
Window Left = 83
Window Bottom = 846
Window Right = 1538
Window Top = 95
Window Left = 80
Window Bottom = 804
Window Right = 1535
Maximized = False
Maximized Children = True
Max32 Number Of Errors = 20
33,7 → 33,7
Hide Windows = False
Break At First Statement = False
Sort Type = "File Name"
Number of Opened Files = 8
Number of Opened Files = 3
Window Confinement Region Enabled = True
MainColumnWidth = 185
FileDateColumnWidth = 70
58,128 → 58,80
Batch Build Debug = False
 
[File 0001]
Path = "/c/home/CVI/instr/HISTO/H1D.fp"
Path = "/c/home/cvi/instr/HISTO/H1D.fp"
File Type = "Function Panel"
Disk Date = 3572599564
Disk Date = 3574750011
In Projects = "1,"
 
[File 0002]
Path = "/c/home/CVI/RedPitaya/soccli/soccli.c"
Path = "/c/home/cvi/apps/RedPitaya/soccli/soccli.c"
File Type = "CSource"
Disk Date = 3574749869
Disk Date = 3574773250
In Projects = "1,"
Window Top = 33
Window Left = 10
Window Z-Order = 1
Source Window State = "0,525,525,525,10,62,62,0,0,152,26,588,0,548,87,2,111,0,412,0,349,595,1,9601,"
Window Z-Order = 2
Source Window State = "0,361,361,361,26,31,31,0,3,69,24,348,0,361,26,1,117,0,418,0,349,595,1,9601,"
 
[File 0003]
Path = "/c/home/CVI/RedPitaya/soccli/redpitaya_gui.uir"
Path = "/c/home/cvi/apps/RedPitaya/soccli/redpitaya_gui.uir"
File Type = "User Interface Resource"
Disk Date = 3574749504
Disk Date = 3574773016
In Projects = "1,"
Window Top = 64
Window Left = 26
Window Height = 232
Window Width = 595
Window Z-Order = 2
Window Z-Order = 1
 
[File 0004]
Path = "/c/home/CVI/RedPitaya/RedPitaya_ui.uir"
Path = "/c/home/cvi/apps/RedPitaya/RedPitaya_ui.uir"
File Type = "User Interface Resource"
Disk Date = 3570150778
Disk Date = 3574750015
In Projects = "2,"
Window Top = 64
Window Left = 26
Window Height = 323
Window Width = 683
Window Z-Order = 6
 
[File 0005]
Path = "/c/home/CVI/RedPitaya/RedPitaya.c"
Path = "/c/home/cvi/apps/RedPitaya/RedPitaya.c"
File Type = "CSource"
Disk Date = 3572435669
Disk Date = 3574750015
In Projects = "2,"
Window Top = 126
Window Left = 58
Window Z-Order = 8
Source Window State = "1,43,43,43,0,26,26,0,0,80,0,0,0,0,0,18,112,0,131,17,258,683,1,0,"
Source Window State = "1,43,43,43,0,26,26,0,0,0,0,0,0,0,0,0,112,0,131,17,258,683,1,0,"
 
[File 0006]
Path = "/c/home/CVI/instr/HISTO/H1D.c"
File Type = "CSource"
Disk Date = 3574395592
In Projects = ""
Window Top = 126
Window Left = 58
Window Z-Order = 3
Source Window State = "1,107,107,107,0,11,11,0,0,80,0,0,0,0,0,23,96,0,107,0,323,683,1,0,"
 
[File 0007]
Path = "/c/home/CVI/instr/DRS/drs4.c"
File Type = "CSource"
Disk Date = 3572599563
In Projects = ""
Window Top = 126
Window Left = 58
Window Z-Order = 7
Source Window State = "1,542,542,542,8,54,8,0,3,80,0,0,0,0,0,18,528,0,542,54,258,683,1,0,"
 
[File 0008]
Path = "/c/home/CVI/RedPitaya/soccli/mH1D.h"
Path = "/c/home/cvi/apps/RedPitaya/soccli/soccli.h"
File Type = "Include"
Disk Date = 3572872297
In Projects = ""
Window Top = 33
Window Left = 10
Window Z-Order = 5
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,23,0,0,25,56,323,683,1,0,"
 
[File 0009]
Path = "/c/home/CVI/instr/HISTO/H1D.h"
File Type = "Include"
Disk Date = 3573119642
In Projects = ""
Window Top = 64
Window Left = 26
Window Z-Order = 4
Source Window State = "1,39,39,39,0,54,54,0,0,80,0,0,0,0,0,23,28,0,36,0,323,683,1,0,"
 
[File 0010]
Path = "/c/home/CVI/RedPitaya/soccli/soccli.h"
File Type = "Include"
Disk Date = 3572536657
In Projects = "1,"
Source Window State = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
 
[File 0011]
Path = "/c/home/CVI/RedPitaya/soccli/H1Dload.cxx"
[File 0007]
Path = "/c/home/cvi/apps/RedPitaya/soccli/H1Dload.cxx"
File Type = "Unknown"
Disk Date = 3574312155
In Projects = "1,"
 
[File 0012]
Path = "/c/home/CVI/RedPitaya/RedPitaya_ui.h"
[File 0008]
Path = "/c/home/cvi/apps/RedPitaya/RedPitaya_ui.h"
File Type = "Include"
Disk Date = 3570148232
Disk Date = 3574750015
In Projects = "2,"
Source Window State = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
 
[File 0013]
Path = "/c/home/CVI/RedPitaya/plottdc.cxx"
[File 0009]
Path = "/c/home/cvi/apps/RedPitaya/plottdc.cxx"
File Type = "Unknown"
Disk Date = 3572604225
Disk Date = 3574750015
In Projects = "2,"
 
[Tab Order]
Tab 0001 = "/c/home/CVI/RedPitaya/soccli/soccli.c"
Tab 0002 = "/c/home/CVI/RedPitaya/soccli/redpitaya_gui.uir"
Tab 0003 = "/c/home/CVI/RedPitaya/RedPitaya.c"
Tab 0004 = "/c/home/CVI/instr/DRS/drs4.c"
Tab 0005 = "/c/home/CVI/instr/HISTO/H1D.c"
Tab 0006 = "/c/home/CVI/RedPitaya/RedPitaya_ui.uir"
Tab 0007 = "/c/home/CVI/RedPitaya/soccli/mH1D.h"
Tab 0008 = "/c/home/CVI/instr/HISTO/H1D.h"
Tab 0001 = "/c/home/cvi/apps/RedPitaya/soccli/redpitaya_gui.uir"
Tab 0002 = "/c/home/cvi/apps/RedPitaya/soccli/soccli.c"
 
[Default Build Config 0001 Debug]
Generate Browse Info = False
/cvi/apps/RedPitaya/soccli/soccli.prj
1,6 → 1,6
[Project Header]
Version = 1302
Pathname = "/c/home/CVI/RedPitaya/soccli/soccli.prj"
Pathname = "/c/home/cvi/apps/RedPitaya/soccli/soccli.prj"
Project Label = "soccli"
CVI Dir = "/c/program files (x86)/national instruments/cvi2013"
CVI Shared Dir = "/C/Program Files (x86)/National Instruments/Shared/CVI"
35,7 → 35,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "soccli.c"
Path = "/c/home/CVI/RedPitaya/soccli/soccli.c"
Path = "/c/home/cvi/apps/RedPitaya/soccli/soccli.c"
Exclude = False
Compile Into Object File = False
Project Flags = 0
48,7 → 48,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "soccli.h"
Path = "/c/home/CVI/RedPitaya/soccli/soccli.h"
Path = "/c/home/cvi/apps/RedPitaya/soccli/soccli.h"
Exclude = False
Project Flags = 0
Folder = "Include Files"
60,7 → 60,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "redpitaya_gui.uir"
Path = "/c/home/CVI/RedPitaya/soccli/redpitaya_gui.uir"
Path = "/c/home/cvi/apps/RedPitaya/soccli/redpitaya_gui.uir"
Exclude = False
Project Flags = 0
Folder = "User Interface Files"
71,8 → 71,8
Res Id = 4
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../instr/HISTO/H1D.fp"
Path = "/c/home/CVI/instr/HISTO/H1D.fp"
Path Rel Path = "../../../instr/HISTO/H1D.fp"
Path = "/c/home/cvi/instr/HISTO/H1D.fp"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
84,7 → 84,7
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "H1Dload.cxx"
Path = "/c/home/CVI/RedPitaya/soccli/H1Dload.cxx"
Path = "/c/home/cvi/apps/RedPitaya/soccli/H1Dload.cxx"
Exclude = False
Project Flags = 0
Folder = "Not In A Folder"
407,19 → 407,19
Executable File_Debug Is Rel = True
Executable File_Debug Rel To = "Project"
Executable File_Debug Rel Path = "soccli.exe"
Executable File_Debug = "/c/home/CVI/RedPitaya/soccli/soccli.exe"
Executable File_Debug = "/c/home/cvi/apps/RedPitaya/soccli/soccli.exe"
Executable File_Release Is Rel = True
Executable File_Release Rel To = "Project"
Executable File_Release Rel Path = "soccli.exe"
Executable File_Release = "/c/home/CVI/RedPitaya/soccli/soccli.exe"
Executable File_Release = "/c/home/cvi/apps/RedPitaya/soccli/soccli.exe"
Executable File_Debug64 Is Rel = True
Executable File_Debug64 Rel To = "Project"
Executable File_Debug64 Rel Path = "soccli.exe"
Executable File_Debug64 = "/c/home/CVI/RedPitaya/soccli/soccli.exe"
Executable File_Debug64 = "/c/home/cvi/apps/RedPitaya/soccli/soccli.exe"
Executable File_Release64 Is Rel = True
Executable File_Release64 Rel To = "Project"
Executable File_Release64 Rel Path = "soccli.exe"
Executable File_Release64 = "/c/home/CVI/RedPitaya/soccli/soccli.exe"
Executable File_Release64 = "/c/home/cvi/apps/RedPitaya/soccli/soccli.exe"
Icon File Is Rel = False
Icon File = ""
Application Title = ""