Rev 32 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 32 | Rev 39 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | 29 | ||
30 | #ifdef USE_DAQ |
30 | #ifdef USE_DAQ |
31 | # define USE_CAMAC |
31 | # define USE_CAMAC |
32 | # include "camac.h" |
32 | # include "camac.h" |
33 | # define NDAC 1 |
33 | # define NDAC 1 |
- | 34 | # define ASD8 0 // channels |
|
- | 35 | # define AMPDISSH 1 |
|
- | 36 | # define SIPM 2 |
|
34 | //# define CAEN_V673A 0x10110000 // FMF |
37 | //# define CAEN_V673A 0x10110000 // FMF |
35 | # define CAEN_V673A 0x22220000 // IJS |
38 | # define CAEN_V673A 0x22220000 // IJS |
36 | # define CAEN_V462 0x100300 |
39 | # define CAEN_V462 0x100300 |
37 | #endif |
40 | #endif |
38 | 41 | ||
Line 49... | Line 52... | ||
49 | #define MAXCH 512 |
52 | #define MAXCH 512 |
50 | #define MAX_THREADS 10 |
53 | #define MAX_THREADS 10 |
51 | 54 | ||
52 | #define IWAIT 200 |
55 | #define IWAIT 200 |
53 | 56 | ||
- | 57 | #define POWERSUPPLY 66 // Power supply voltage for SiPM bias |
|
54 | #define NCH 64 |
58 | #define NCH 64 |
55 | 59 | ||
56 | static int p1h, pID, rID, tfID; |
60 | static int p1h, pID, rID, tfID; |
57 | static int ph_tdc, ph_adc; |
61 | static int ph_tdc, ph_adc; |
58 | static int dtdc[NCH][2][MAXCH]; |
62 | static int dtdc[NCH][2][MAXCH]; |
Line 504... | Line 508... | ||
504 | SetCtrlVal(p1h, P1_ADCHL, runrec.xy-2); |
508 | SetCtrlVal(p1h, P1_ADCHL, runrec.xy-2); |
505 | 509 | ||
506 | QueueUserEvent (1000, p1h, P1_RESET); |
510 | QueueUserEvent (1000, p1h, P1_RESET); |
507 | QueueUserEvent (1000, p1h, P1_ASD8THR); |
511 | QueueUserEvent (1000, p1h, P1_ASD8THR); |
508 | QueueUserEvent (1000, p1h, P1_AMPDISSHTHR); |
512 | QueueUserEvent (1000, p1h, P1_AMPDISSHTHR); |
- | 513 | QueueUserEvent (1000, p1h, P1_BIAS); |
|
- | 514 | ||
- | 515 | printf("BIAS offset set to: %d\n", POWERSUPPLY); |
|
- | 516 | ||
509 | do { |
517 | do { |
510 | GetUserEvent (1, &pID, &rID); |
518 | GetUserEvent (1, &pID, &rID); |
511 | switch (rID) { |
519 | switch (rID) { |
512 | case P1_TIMER: |
520 | case P1_TIMER: |
513 | ntics+=1; |
521 | ntics+=1; |
Line 531... | Line 539... | ||
531 | case P1_ZSET: |
539 | case P1_ZSET: |
532 | if (!daq_on) { |
540 | if (!daq_on) { |
533 | GetCtrlVal (p1h, P1_ZSET, &zpos); |
541 | GetCtrlVal (p1h, P1_ZSET, &zpos); |
534 | #ifdef USE_MIKRO_Z |
542 | #ifdef USE_MIKRO_Z |
535 | MIKRO_MoveTo (MIKRO_Z, zpos); |
543 | MIKRO_MoveTo (MIKRO_Z, zpos); |
536 | #endif |
544 | #endif |
537 | } |
545 | } |
538 | break; |
546 | break; |
539 | case P1_REREAD: |
547 | case P1_REREAD: |
540 | if (!daq_on) { |
548 | if (!daq_on) { |
541 | status = FileSelectPopup ("", "*.dat", ".dat", |
549 | status = FileSelectPopup ("", "*.dat", ".dat", |
542 | "Izberi datoteko s podatki", |
550 | "Izberi datoteko s podatki", |
543 | VAL_LOAD_BUTTON, 0, 0, 1, 0, dfile); |
551 | VAL_LOAD_BUTTON, 0, 0, 1, 0, dfile); |
Line 562... | Line 570... | ||
562 | MIKRO_GetPosition(MIKRO_X,&xpos); |
570 | MIKRO_GetPosition(MIKRO_X,&xpos); |
563 | Delay(0.01); |
571 | Delay(0.01); |
564 | SetCtrlVal (p1h, P1_X, xpos); |
572 | SetCtrlVal (p1h, P1_X, xpos); |
565 | #ifdef USE_MIKRO_Y |
573 | #ifdef USE_MIKRO_Y |
566 | MIKRO_GetPosition(MIKRO_Y,&ypos); |
574 | MIKRO_GetPosition(MIKRO_Y,&ypos); |
567 | Delay(0.01); |
575 | Delay(0.01); |
568 | SetCtrlVal (p1h, P1_Y, ypos); |
576 | SetCtrlVal (p1h, P1_Y, ypos); |
569 | #endif |
577 | #endif |
570 | #ifdef USE_MIKRO_Z |
578 | #ifdef USE_MIKRO_Z |
571 | MIKRO_GetPosition(MIKRO_Z,&zpos); |
579 | MIKRO_GetPosition(MIKRO_Z,&zpos); |
572 | Delay(0.01); |
580 | Delay(0.01); |
Line 606... | Line 614... | ||
606 | break; |
614 | break; |
607 | case P1_ADCLOG: |
615 | case P1_ADCLOG: |
608 | GetCtrlVal (p1h, P1_ADCLOG, &status); |
616 | GetCtrlVal (p1h, P1_ADCLOG, &status); |
609 | SetCtrlAttribute (p1h, P1_ADC, ATTR_YMAP_MODE, status); |
617 | SetCtrlAttribute (p1h, P1_ADC, ATTR_YMAP_MODE, status); |
610 | update_plots(); |
618 | update_plots(); |
611 | break; |
619 | break; |
612 | case P1_ASD8THR: |
620 | case P1_ASD8THR: |
613 | { |
621 | { |
614 | double value; |
622 | double value; |
615 | GetCtrlVal (p1h, P1_SASD8THR, &value); |
623 | GetCtrlVal (p1h, P1_SASD8THR, &value); |
616 | SetDac( |
624 | SetDac(ASD8, value); |
617 | 625 | ||
618 | } |
626 | } |
619 | break; |
627 | break; |
620 | case P1_AMPDISSHTHR: |
628 | case P1_AMPDISSHTHR: |
621 | { |
629 | { |
622 | double value; |
630 | double value; |
623 | GetCtrlVal (p1h, P1_SAMPDISSHTHR, &value); |
631 | GetCtrlVal (p1h, P1_SAMPDISSHTHR, &value); |
624 | SetDac( |
632 | SetDac(AMPDISSH, value); |
625 | 633 | ||
626 | } |
634 | } |
627 | break; |
635 | break; |
- | 636 | case P1_BIAS: |
|
- | 637 | { |
|
- | 638 | double value; |
|
- | 639 | GetCtrlVal (p1h, P1_SBIAS, &value); |
|
- | 640 | value -= POWERSUPPLY; |
|
- | 641 | SetDac(SIPM, value); |
|
- | 642 | } |
|
- | 643 | break; |
|
628 | 644 | ||
629 | } |
645 | } |
630 | 646 | ||
631 | } while ((rID != P1_EXIT)||daq_on); |
647 | } while ((rID != P1_EXIT)||daq_on); |
632 | 648 |