Rev 1815 Rev 1817
Line 26... Line 26...
26 setup_comparator(NC_NC_NC_NC); 26 setup_comparator(NC_NC_NC_NC);
27 setup_vref(FALSE); 27 setup_vref(FALSE);
28   28  
29 TDC_reset(); 29 TDC_reset();
30 30
31 /* MRange=TDC_MRANGE1; 31 MRange=TDC_MRANGE2;
32 hitin1=TDC_HITIN1_1; 32 hitin1=TDC_HITIN1_1;
33 hitin2=TDC_HITIN2_0; 33 hitin2=TDC_HITIN2_0;
34 hit1=TDC_MRANGE1_HIT1_START; 34 hit1=TDC_MRANGE2_HIT1_START;
35 hit2=TDC_MRANGE1_HIT2_1CH1; 35 hit2=TDC_MRANGE2_HIT2_1CH1;
36 en_int=0x0; // (TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT); 36 en_int=(TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT);
37 en_err_val=TDC_ERRVAL_EN; 37 en_err_val=TDC_ERRVAL_EN;
38 delval1=0x0; 38 delval1=0x0;
39 delval2=0x0; 39 delval2=0x0;
40 delval3=0x0; 40 delval3=0x0;
41 calibrate=TDC_CALIBRATE_DIS; 41 calibrate=TDC_CALIBRATE_DIS;
Line 47... Line 47...
47 Tcycle=TDC_TCYSLE_LONG; 47 Tcycle=TDC_TCYSLE_LONG;
48 portnum=TDC_TPORTNUM_2; 48 portnum=TDC_TPORTNUM_2;
49 fakenum=TDC_TFAKENUM_2; 49 fakenum=TDC_TFAKENUM_2;
50 50
51 TDC_update_registers(); 51 TDC_update_registers();
52 */ 52
53 output_low(START); 53 output_low(START);
54 output_low(STOP1); 54 output_low(STOP1);
55 output_low(STOP2); 55 output_low(STOP2);
56   56  
57 delay_ms(50); 57 delay_ms(50);
58   58  
59 //write raw register values 59 //write raw register values
60 output_low(TDC_ENABLE); 60 /* output_low(TDC_ENABLE);
61 spi_xfer(TDC_stream,0x80338AE8,32); 61 spi_xfer(TDC_stream,0x80338AE8,32);
62 output_high(TDC_ENABLE); 62 output_high(TDC_ENABLE);
63   63  
64 output_low(TDC_ENABLE); 64 output_low(TDC_ENABLE);
65 spi_xfer(TDC_stream,0x81211400,32); 65 spi_xfer(TDC_stream,0x81211400,32);
Line 78... Line 78...
78 output_high(TDC_ENABLE); 78 output_high(TDC_ENABLE);
79   79  
80 output_low(TDC_ENABLE); 80 output_low(TDC_ENABLE);
81 spi_xfer(TDC_stream,0x85080000,32); 81 spi_xfer(TDC_stream,0x85080000,32);
82 output_high(TDC_ENABLE); 82 output_high(TDC_ENABLE);
83   83 */
84 TDC_start_cal_resonator(); 84 TDC_start_cal_resonator();
85 delay_ms(50); 85 delay_ms(50);
86 printf("calibrate: %LX, %LX, %LX, %LX \r\n", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); 86 printf("calibrate: %LX, %LX, %LX, %LX \r\n", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4));
87 // TDC_start_cal(); 87 // TDC_start_cal();
88 // delay_ms(50); 88 // delay_ms(50);
Line 125... Line 125...
125 output_high(STOP1); 125 output_high(STOP1);
126 // output_low(STOP2); 126 // output_low(STOP2);
127 // delay_us(500); 127 // delay_us(500);
128 // output_high(STOP2); 128 // output_high(STOP2);
129 // delay_us(10); 129 // delay_us(10);
130 // output_low(STOP2); 130 output_low(STOP1);
131 // delay_us(500); 131 // delay_us(500);
132 // output_high(STOP2); 132 // output_high(STOP2);
133 // delay_us(10); 133 // delay_us(10);
134 // output_low(STOP2); 134 // output_low(STOP2);
135   135