Rev 1964 Rev 1965
Line 56... Line 56...
56   56  
57 TDC_reset(); 57 TDC_reset();
58 delay_ms(100); 58 delay_ms(100);
59 59
60 //----------------------------------------------- Nastaveni registru 60 //----------------------------------------------- Nastaveni registru
61 output_low(TDC_ENABLE); 61 /* output_low(TDC_ENABLE);
62 ble=0; 62 ble=0;
63 ble=(8<<28)|(0<<24); // write addres 63 ble=(8<<28)|(0<<24); // write addres
64 ble|=(0<<20)|(0<<16)|(0<<14)|(3<<12)|(1<<10)|(0<<9)|(0<<8)|(0<<7)|(1<<6)|(1<<5)|(0<<4)|(1<<3)|(0<<2)|(0<<1)|0; 64 ble|=(0<<20)|(0<<16)|(0<<14)|(3<<12)|(1<<10)|(0<<9)|(0<<8)|(0<<7)|(1<<6)|(1<<5)|(0<<4)|(1<<3)|(0<<2)|(0<<1)|0;
65 spi_xfer(TDC_stream,ble,32); 65 spi_xfer(TDC_stream,ble,32);
66 output_high(TDC_ENABLE); 66 output_high(TDC_ENABLE);
Line 97... Line 97...
97 ble=0; 97 ble=0;
98 ble=(8<<28)|(5<<24); 98 ble=(8<<28)|(5<<24);
99 ble|=(0<<21)|(0<<20)|(0<<19)|(0<<16)|0; 99 ble|=(0<<21)|(0<<20)|(0<<19)|(0<<16)|0;
100 spi_xfer(TDC_stream,ble,32); 100 spi_xfer(TDC_stream,ble,32);
101 output_high(TDC_ENABLE); 101 output_high(TDC_ENABLE);
-   102 */
-   103  
-   104 hit1=TDC_MRANGE2_HIT1_START;
-   105 // hit2=TDC_MRANGE2_HIT2_2CH1;
-   106 hitin1=TDC_HITIN1_4;
-   107 hitin2=TDC_HITIN2_0;
-   108 en_int= TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT;
-   109 en_err_val=TDC_ERRVAL_EN;
-   110 delval1=0x0;
-   111 delval2=0x0;
-   112 delval3=0x0;
102   113
-   114 TDC_update_registers();
103   115  
104 //----------------------------------------------- Vypis registru 116 //----------------------------------------------- Vypis registru
105 117
106 printf("- %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); 118 printf("- %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4));
107 119
Line 146... Line 158...
146 158
147 159
148 160
149 //----------------------------------------------- Pocitani 161 //----------------------------------------------- Pocitani
150 int32 nn; 162 int32 nn;
151 for(nn=3;nn<=5;nn++) 163 for(nn=1;nn<=3;nn++)
152 { 164 {
153 delay_ms(500); 165 delay_ms(500);
154   166  
155 printf("* %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); 167 printf("* %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4));
156 168
Line 162... Line 174...
162 output_high(TDC_ENABLE); 174 output_high(TDC_ENABLE);
163 printf("[%Lu %Lu %Lu %Lu %Lu %Lu %Lu] ", (1&(ret16)>>12), (1&(ret16)>>11), (1&(ret16)>>10), 1&(ret16)>>9, 7&(ret16)>>6, 7&(ret16)>>3, 7&ret16); 175 printf("[%Lu %Lu %Lu %Lu %Lu %Lu %Lu] ", (1&(ret16)>>12), (1&(ret16)>>11), (1&(ret16)>>10), 1&(ret16)>>9, 7&(ret16)>>6, 7&(ret16)>>3, 7&ret16);
164 176
165 printf("%X\r\n",TDC_get_reg1()); 177 printf("%X\r\n",TDC_get_reg1());
166 178
-   179 switch (nn)
-   180 {
167 // Next calculation 181 case 1:
168 output_low(TDC_ENABLE); 182 hit2=TDC_MRANGE2_HIT2_1CH1;
169 ble=0; 183 break;
-   184  
170 ble=(8<<28)|(1<<24); // write to reg1 185 case 2:
171 ble|=(nn<<20)|(1<<16)|(0<<15)|(1<<14)|(0<<11)|(4<<8)|0x00; 186 hit2=TDC_MRANGE2_HIT2_2CH1;
172 spi_xfer(TDC_stream,ble,32); 187 break;
-   188  
-   189 case 3:
173 output_high(TDC_ENABLE); 190 hit2=TDC_MRANGE2_HIT2_3CH1;
-   191 break;
174 192 }
-   193 TDC_update_reg1();
175 } 194 }
176 -  
177 } 195 }
178   -  
179 } 196 }