Line 104... |
Line 104... |
104 |
output_low(STOP1); |
104 |
output_low(STOP1); |
105 |
delay_us(1); |
105 |
delay_us(1); |
106 |
|
106 |
|
107 |
//----------------------------------------------- Pocitani |
107 |
//----------------------------------------------- Pocitani |
108 |
|
108 |
|
109 |
printf("Time2: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
109 |
// printf("Time2: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
110 |
|
110 |
|
111 |
|
111 |
|
112 |
output_low(TDC_ENABLE); //status register |
112 |
output_low(TDC_ENABLE); //status register |
113 |
ret8=0; |
113 |
ret8=0; |
114 |
ret8=(0b1011<<4)|4; |
114 |
ret8=(0b1011<<4)|4; |
Line 149... |
Line 149... |
149 |
output_low(STOP2); |
149 |
output_low(STOP2); |
150 |
|
150 |
|
151 |
output_high(START); // start of time measurement |
151 |
output_high(START); // start of time measurement |
152 |
|
152 |
|
153 |
output_high(STOP2); |
153 |
output_high(STOP2); |
154 |
output_high(STOP1); |
154 |
output_high(STOP1); |
155 |
|
155 |
|
156 |
output_low(STOP1); |
156 |
output_low(STOP1); |
157 |
output_low(STOP2); |
157 |
output_low(STOP2); |
158 |
output_low(START); |
158 |
output_low(START); |
159 |
|
159 |
|
160 |
|
160 |
|
161 |
|
161 |
|
162 |
//----------------------------------------------- Pocitani |
162 |
//----------------------------------------------- Pocitani |
163 |
|
163 |
|
164 |
printf("Time1: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
164 |
// printf("Time1: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
165 |
|
165 |
|
166 |
output_low(TDC_ENABLE); //status register |
166 |
output_low(TDC_ENABLE); //status register |
167 |
ret8=0; |
167 |
ret8=0; |
168 |
ret8=(0b1011<<4)|4; |
168 |
ret8=(0b1011<<4)|4; |
169 |
spi_xfer(TDC_stream,ret8,8); |
169 |
spi_xfer(TDC_stream,ret8,8); |
Line 174... |
Line 174... |
174 |
|
174 |
|
175 |
printf("Time1: %3.7f %3.7f %3.7f \r\n", TDC_mrange1_get_time(1,0,1,1), TDC_mrange1_get_time(2,0,2,1), TDC_mrange1_get_time(1,1,2,1)); |
175 |
printf("Time1: %3.7f %3.7f %3.7f \r\n", TDC_mrange1_get_time(1,0,1,1), TDC_mrange1_get_time(2,0,2,1), TDC_mrange1_get_time(1,1,2,1)); |
176 |
|
176 |
|
177 |
/// ----------------------------------------------- Temperature masurement |
177 |
/// ----------------------------------------------- Temperature masurement |
178 |
|
178 |
|
- |
|
179 |
|
- |
|
180 |
TDC_reset(); |
- |
|
181 |
portnum=TDC_TPORTNUM_4; |
- |
|
182 |
Tcycle=TDC_TCYCLE_SHORT; |
- |
|
183 |
fakenum=TDC_TFAKENUM_2; |
- |
|
184 |
selclkT=TDC_TSELCLK_128HS; |
- |
|
185 |
|
- |
|
186 |
TDC_update_registers(); |
- |
|
187 |
|
- |
|
188 |
TDC_init(); |
179 |
TDC_start_temp(); |
189 |
TDC_start_temp(); |
- |
|
190 |
|
- |
|
191 |
|
180 |
output_low(TDC_ENABLE); //status register |
192 |
output_low(TDC_ENABLE); //status register |
181 |
ret8=0; |
193 |
ret8=0; |
182 |
ret8=(0b1011<<4)|4; |
194 |
ret8=(0b1011<<4)|4; |
183 |
spi_xfer(TDC_stream,ret8,8); |
195 |
spi_xfer(TDC_stream,ret8,8); |
184 |
ret16=spi_xfer(TDC_stream,0,16); |
196 |
ret16=spi_xfer(TDC_stream,0,16); |
185 |
output_high(TDC_ENABLE); |
197 |
output_high(TDC_ENABLE); |
186 |
printf("Temp: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
198 |
printf("Temp: %LX %LX %LX %LX ", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
187 |
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()); |
199 |
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()); |
188 |
|
- |
|
189 |
|
- |
|
190 |
|
- |
|
191 |
} |
200 |
} |
192 |
} |
201 |
} |