Rev 217 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 217 | Rev 265 | ||
---|---|---|---|
Line 125... | Line 125... | ||
125 | int enabledoutput; |
125 | int enabledoutput; |
126 | int neveold = 0; |
126 | int neveold = 0; |
127 | double rate; |
127 | double rate; |
128 | int *args = (int *) functionData; |
128 | int *args = (int *) functionData; |
129 | double twin[2]; |
129 | double twin[2]; |
- | 130 | ||
130 | 131 | ||
131 | 132 | ||
132 | GetCtrlVal(ph, PANEL_CH0, &imask[0] ); |
133 | GetCtrlVal(ph, PANEL_CH0, &imask[0] ); |
133 | GetCtrlVal(ph, PANEL_CH1, &imask[1] ); |
134 | GetCtrlVal(ph, PANEL_CH1, &imask[1] ); |
134 | GetCtrlVal(ph, PANEL_CH2, &imask[2] ); |
135 | GetCtrlVal(ph, PANEL_CH2, &imask[2] ); |
Line 136... | Line 137... | ||
136 | mask = 0; |
137 | mask = 0; |
137 | for (int i=0; i<4; i++) { |
138 | for (int i=0; i<4; i++) { |
138 | if (imask[i]) mask |= (1<<i); |
139 | if (imask[i]) mask |= (1<<i); |
139 | } |
140 | } |
140 | 141 | ||
- | 142 | ||
- | 143 | ||
141 | GetCtrlVal(ph,PANEL_NEVE, &neve); |
144 | GetCtrlVal(ph,PANEL_NEVE, &neve); |
142 | GetCtrlVal(ph,PANEL_DEBUG, &verbose); |
145 | GetCtrlVal(ph,PANEL_DEBUG, &verbose); |
143 | GetCtrlVal(ph,PANEL_PFREQ, &pfreq); |
146 | GetCtrlVal(ph,PANEL_PFREQ, &pfreq); |
144 | GetCtrlVal(ph,PANEL_ENABLEDOUTPUT, &enabledoutput); |
147 | GetCtrlVal(ph,PANEL_ENABLEDOUTPUT, &enabledoutput); |
145 | 148 | ||
146 | GetCtrlVal(ph,PANEL_FREQUENCY, &frequency); |
149 | GetCtrlVal(ph,PANEL_FREQUENCY, &frequency); |
147 | GetCtrlVal(ph,PANEL_TRGDELAY, &trgdelay); |
150 | GetCtrlVal(ph,PANEL_TRGDELAY, &trgdelay); |
148 | GetCtrlVal(ph,PANEL_TRGCHANNEL, &trgchannel); |
151 | GetCtrlVal(ph,PANEL_TRGCHANNEL, &trgchannel); |
149 | 152 | ||
- | 153 | ||
150 | GetCtrlVal(ph,PANEL_TRGTYPE, &trgtype); |
154 | GetCtrlVal(ph,PANEL_TRGTYPE, &trgtype); |
151 | GetCtrlVal(ph,PANEL_TRGLEVEL, &trglevel); |
155 | GetCtrlVal(ph,PANEL_TRGLEVEL, &trglevel); |
152 | GetCtrlVal(ph,PANEL_TRGPOLARITY, &trgpolarity); |
156 | GetCtrlVal(ph,PANEL_TRGPOLARITY, &trgpolarity); |
153 | GetCtrlVal(ph,PANEL_RANGE, &range); |
157 | GetCtrlVal(ph,PANEL_RANGE, &range); |
154 | 158 | ||
Line 177... | Line 181... | ||
177 | fp = fopen(filename,"wb"); |
181 | fp = fopen(filename,"wb"); |
178 | } else { |
182 | } else { |
179 | GetCtrlVal(p2, SCAN_FILENAME, filename ); |
183 | GetCtrlVal(p2, SCAN_FILENAME, filename ); |
180 | fp = fopen(filename,"ab"); |
184 | fp = fopen(filename,"ab"); |
181 | } |
185 | } |
182 | } |
186 | } |
183 | 187 | ||
184 | static unsigned char *buffer; |
188 | static unsigned char *buffer; |
185 | 189 | ||
186 | int buffer_size = 0; |
190 | int buffer_size = 0; |
187 | const int nBoards=1; |
191 | const int nBoards=1; |
188 | const int waveDepth=1024; |
192 | const int waveDepth=1024; |
189 | 193 | ||
Line 193... | Line 197... | ||
193 | buffer_size += 24 + nBoards * (8 + 4*(8+waveDepth*2)); |
197 | buffer_size += 24 + nBoards * (8 + 4*(8+waveDepth*2)); |
194 | buffer = (unsigned char *)malloc(buffer_size); |
198 | buffer = (unsigned char *)malloc(buffer_size); |
195 | } |
199 | } |
196 | 200 | ||
197 | time_t t=0,told=0, tstart=0; |
201 | time_t t=0,told=0, tstart=0; |
198 | 202 | ||
199 | if (!DRSInit()) { |
203 | if (!DRSInit()) { |
- | 204 | ||
200 | time(&tstart); |
205 | time(&tstart); |
201 | told=tstart; |
206 | told=tstart; |
202 | int nev=0; |
207 | int nev=0; |
203 | for (int k = 0;k<4;k++){ |
208 | for (int k = 0;k<4;k++){ |
204 | gSum[k]=0; |
209 | gSum[k]=0; |
Line 233... | Line 238... | ||
233 | 238 | ||
234 | if (t[j]> twin[0] && t[j] < twin[1]) gSum[k]+= fabs(xs[k][j]); |
239 | if (t[j]> twin[0] && t[j] < twin[1]) gSum[k]+= fabs(xs[k][j]); |
235 | if (verbose) printf("[%d] %d. x= %3.2f y=%3.2f\n", k, i, t[j], x[j] ); |
240 | if (verbose) printf("[%d] %d. x= %3.2f y=%3.2f\n", k, i, t[j], x[j] ); |
236 | //h[k]->Fill( t[i], x[i]*1e-3); |
241 | //h[k]->Fill( t[i], x[i]*1e-3); |
237 | } |
242 | } |
238 | 243 | ||
239 | if (i % pfreq == 0) { |
244 | if (i % pfreq == 0) { |
240 | 245 | ||
241 | const int col[4]= {VAL_WHITE,VAL_RED,VAL_GREEN,VAL_BLUE}; |
246 | const int col[4]= {VAL_WHITE,VAL_RED,VAL_GREEN,VAL_BLUE}; |
242 | if (plothandle[k]) DeleteGraphPlot (ph, PANEL_GRAPH, plothandle[k], VAL_IMMEDIATE_DRAW); |
247 | if (plothandle[k]) DeleteGraphPlot (ph, PANEL_GRAPH, plothandle[k], VAL_IMMEDIATE_DRAW); |
243 | plothandle[k] = PlotXY (ph, PANEL_GRAPH, t, xs[k], 1024, VAL_FLOAT, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, col[k]); |
248 | plothandle[k] = PlotXY (ph, PANEL_GRAPH, t, xs[k], 1024, VAL_FLOAT, VAL_FLOAT, VAL_THIN_LINE, VAL_NO_POINT, VAL_SOLID, 1, col[k]); |
Line 397... | Line 402... | ||
397 | } |
402 | } |
398 | return 0; |
403 | return 0; |
399 | } |
404 | } |
400 | 405 | ||
401 | int CVICALLBACK StopCB (int panel, int control, int event, |
406 | int CVICALLBACK StopCB (int panel, int control, int event, |
402 | void *callbackData, int eventData1, int eventData2) { |
407 | void *callbackData, int eventData1, int eventData2) { |
403 | switch (event) { |
408 | switch (event) { |
404 | case EVENT_COMMIT: |
409 | case EVENT_COMMIT: |
405 | daq_on=0; |
410 | daq_on=0; |
406 | break; |
411 | break; |
407 | } |
412 | } |
Line 561... | Line 566... | ||
561 | void *callbackData, int eventData1, int eventData2) { |
566 | void *callbackData, int eventData1, int eventData2) { |
562 | switch (event) { |
567 | switch (event) { |
563 | case EVENT_COMMIT: |
568 | case EVENT_COMMIT: |
564 | DisplayPanel (ph); |
569 | DisplayPanel (ph); |
565 | DisplayPanel (p2); |
570 | DisplayPanel (p2); |
- | 571 | break; |
|
- | 572 | } |
|
- | 573 | return 0; |
|
- | 574 | } |
|
- | 575 | ||
- | 576 | int CVICALLBACK CalibrateCB (int panel, int control, int event, |
|
- | 577 | void *callbackData, int eventData1, int eventData2) { |
|
- | 578 | int status = 0; |
|
- | 579 | switch (event) { |
|
- | 580 | case EVENT_COMMIT: |
|
- | 581 | status = DRSCalibrateTiming(); |
|
- | 582 | printf("DRSCalibrateTiming() status = %d\n", status); |
|
566 | break; |
583 | break; |
567 | } |
584 | } |
568 | return 0; |
585 | return 0; |
569 | } |
586 | } |