Rev 2183 Rev 2184
Line 43... Line 43...
43 { 43 {
44 TDC_reset(); 44 TDC_reset();
45 delay_ms(50); 45 delay_ms(50);
46 en_int= TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT; // eneble all possible interrupt flags 46 en_int= TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT; // eneble all possible interrupt flags
47 en_err_val=TDC_ERRVAL_EN; // enable of error value output 47 en_err_val=TDC_ERRVAL_EN; // enable of error value output
48 clkhsdiv=TDC_CLKHSDIV_4; // divide clkHS by 2 48 clkhsdiv=TDC_CLKHSDIV_2; // divide clkHS by 2
49 firenum=TDC_FIRENUM_1; 49 firenum=TDC_FIRENUM_1;
50 calibrate=TDC_CALIBRATE_EN; 50 calibrate=TDC_CALIBRATE_EN;
51 disautocal=TDC_AUTOCAL_EN; // automatic calibration enabled 51 disautocal=TDC_AUTOCAL_EN; // automatic calibration enabled
52 52
53 rfedge2=TDC_CH2EDGE_FAL_RIS; // stop channels input edge sensityvity selection 53 rfedge2=TDC_CH2EDGE_FAL_RIS; // stop channels input edge sensityvity selection
Line 55... Line 55...
55   55  
56 MRange=TDC_MRANGE1; 56 MRange=TDC_MRANGE1;
57 hit1=TDC_MRANGE1_HIT1_NOAC; 57 hit1=TDC_MRANGE1_HIT1_NOAC;
58 hit2=TDC_MRANGE1_HIT2_NOAC; 58 hit2=TDC_MRANGE1_HIT2_NOAC;
59   59  
60   -  
61 // hitin2=TDC_HITIN2_1; -  
62 // hitin1=TDC_HITIN1_1; -  
63   -  
64 delval1=0x0; 60 delval1=0x0;
65 delval2=0x0; 61 delval2=0x0;
66 delval3=0x0; 62 delval3=0x0;
67   63  
68 switch(hits2) // sets number of hits on channel 1 64 switch(hits2) // sets number of hits on channel 1
Line 121... Line 117...
121   117  
122   118  
123 //----------------------------------------------- Mereni 1 119 //----------------------------------------------- Mereni 1
124 120
125 TDC_init(); 121 TDC_init();
126 // TDC_start_cycle(); // Fire pulse generator activation 122 TDC_start_cycle(); // Fire pulse generator activation
127 delay_ms(100); 123 delay_ms(100);
128   124  
129 While(!input(INTN_PIN)); // waiting for interrupt flag 125 While(!input(INTN_PIN)); // waiting for interrupt flag
130   126  
131 //----------------------------------------------- Pocitani 127 //----------------------------------------------- Pocitani
132   128  
133 // printf("Time1: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); -  
134   -  
135 /* output_low(TDC_ENABLE); //status register -  
136 ret8=0; -  
137 ret8=(0b1011<<4)|4; -  
138 spi_xfer(TDC_stream,ret8,8); -  
139 ret16=spi_xfer(TDC_stream,0,16); -  
140 output_high(TDC_ENABLE); -  
141   -  
142 printf("[%Lu %Lu %Lu %Lu %Lu %Lu %Lu]\r\n", (1&(ret16)>>12), (1&(ret16)>>11), (1&(ret16)>>10), 1&(ret16)>>9, 7&(ret16)>>6, 7&(ret16)>>3, 7&TDC_get_status()); -  
143 */ -  
144   -  
145 printf("[%Lu %Lu %Lu %Lu %Lu %Lu %Lu]\r\n", (1&(TDC_get_status())>>12), (1&(TDC_get_status())>>11), (1&(TDC_get_status())>>10), 1&(TDC_get_status())>>9, 7&(TDC_get_status())>>6, 7&(TDC_get_status())>>3, 7&TDC_get_status()); 129 printf("[%Lu %Lu %Lu %Lu %Lu %Lu %Lu]\r\n", (1&(TDC_get_status())>>12), (1&(TDC_get_status())>>11), (1&(TDC_get_status())>>10), 1&(TDC_get_status())>>9, 7&(TDC_get_status())>>6, 7&(TDC_get_status())>>3, 7&TDC_get_status());
146   130  
-   131 delay_ms(10);
-   132  
147 printf("$TDC%s M1 ", VERSION); 133 printf("$TDC%s M1 ", VERSION);
148 printf("%f %f", TDC_mrange1_get_time(1,1,1,2), TDC_mrange1_get_time(1,0,1,1)); 134 printf("%5.6f %5.6f", TDC_mrange1_get_time(1,0,1,1), TDC_mrange1_get_time(2,1,2,0));
149 135
150 // syntax TDC_mrange1_get_time(Channel, shot, Channel , shot ) 136 // syntax TDC_mrange1_get_time(Channel, shot, Channel , shot )
151 137
152 printf("\r\n"); 138 printf("\r\n");
153 } 139 }
Line 270... Line 256...
270 strcpy(tmp,"M1 "); 256 strcpy(tmp,"M1 ");
271 if (!strncmp(command, tmp, 3)) 257 if (!strncmp(command, tmp, 3))
272 { 258 {
273 parameter=strtol(command+3,&ptr,10); 259 parameter=strtol(command+3,&ptr,10);
274 parameter2=strtol(ptr,&ptr,10); 260 parameter2=strtol(ptr,&ptr,10);
275 printf("%lu\r\n", parameter); // echo received command -  
276 printf("%lu\r\n", parameter2); // echo received command -  
277 measurementM1(parameter, parameter2); 261 measurementM1(parameter, parameter2);
278 } 262 }
279   -  
280 } 263 }
281 } 264 }