Line 149... |
Line 149... |
149 |
ret=spi_xfer(TDC_stream,0,32); |
149 |
ret=spi_xfer(TDC_stream,0,32); |
150 |
output_high(TDC_ENABLE); |
150 |
output_high(TDC_ENABLE); |
151 |
return ret; |
151 |
return ret; |
152 |
} |
152 |
} |
153 |
|
153 |
|
154 |
unsigned int16 TDC_get_status() |
154 |
unsigned int16 TDC_get_status() // reads status register |
155 |
{ |
155 |
{ |
156 |
unsigned int16 ret; |
156 |
unsigned int16 ret; |
157 |
|
157 |
|
158 |
output_low(TDC_ENABLE); |
158 |
output_low(TDC_ENABLE); |
159 |
spi_xfer(TDC_stream,0xB4,8); |
159 |
spi_xfer(TDC_stream,0xB4,8); |
Line 296... |
Line 296... |
296 |
float TDC_mrange1_get_time(unsigned int channel1, unsigned int shot1, unsigned int channel2, unsigned int shot2) |
296 |
float TDC_mrange1_get_time(unsigned int channel1, unsigned int shot1, unsigned int channel2, unsigned int shot2) |
297 |
{ |
297 |
{ |
298 |
unsigned int32 measurement; |
298 |
unsigned int32 measurement; |
299 |
float time; |
299 |
float time; |
300 |
|
300 |
|
- |
|
301 |
Delay_ms(10); // wait to computing of result |
- |
|
302 |
|
301 |
switch (shot1) |
303 |
switch (shot1) |
302 |
{ |
304 |
{ |
303 |
case 0: |
305 |
case 0: |
304 |
hit1=TDC_MRANGE1_HIT1_START; |
306 |
hit1=TDC_MRANGE1_HIT1_START; |
305 |
break; |
307 |
break; |
Line 347... |
Line 349... |
347 |
|
349 |
|
348 |
Delay_ms(50); // wait to computing of result |
350 |
Delay_ms(50); // wait to computing of result |
349 |
|
351 |
|
350 |
measurement=TDC_get_measurement(7&TDC_get_status()); // read computed value on pointer result register address |
352 |
measurement=TDC_get_measurement(7&TDC_get_status()); // read computed value on pointer result register address |
351 |
|
353 |
|
- |
|
354 |
printf("\r\n%Lu\r\n", (7&TDC_get_status())); |
- |
|
355 |
printf("%Lu\r\n", measurement); |
352 |
|
356 |
|
353 |
switch (clkhsdiv) |
357 |
switch (clkhsdiv) |
354 |
{ |
358 |
{ |
355 |
case TDC_CLKHSDIV_1: |
359 |
case TDC_CLKHSDIV_1: |
356 |
time=(measurement/65536.0) * 1.0e6/TDC_CLKHS; |
360 |
time=(measurement/65536.0)* 1.0e6/TDC_CLKHS; |
357 |
break; |
361 |
break; |
358 |
|
362 |
|
359 |
case TDC_CLKHSDIV_2: |
363 |
case TDC_CLKHSDIV_2: |
360 |
time=(measurement/65536.0) * 1.0e6/TDC_CLKHS * 2.0; |
364 |
time=(measurement/65536.0) * 1.0e6/TDC_CLKHS * 2.0; |
361 |
break; |
365 |
break; |