1744 |
kakl |
1 |
#include "main.h" |
|
|
2 |
|
|
|
3 |
#include "GP2.h" |
|
|
4 |
|
1757 |
kakl |
5 |
#define VERSION 0.1 |
|
|
6 |
|
1744 |
kakl |
7 |
void main() |
|
|
8 |
{ |
|
|
9 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
10 |
setup_adc(ADC_CLOCK_DIV_2); |
|
|
11 |
setup_psp(PSP_DISABLED); |
|
|
12 |
setup_spi(SPI_SS_DISABLED); |
|
|
13 |
setup_wdt(WDT_OFF); |
|
|
14 |
setup_timer_0(RTCC_INTERNAL); |
|
|
15 |
setup_timer_1(T1_DISABLED); |
|
|
16 |
setup_timer_2(T2_DISABLED,0,1); |
|
|
17 |
setup_ccp1(CCP_OFF); |
|
|
18 |
setup_comparator(NC_NC_NC_NC); |
|
|
19 |
setup_vref(FALSE); |
|
|
20 |
|
1745 |
kakl |
21 |
TDC_reset(); |
1744 |
kakl |
22 |
|
1758 |
kakl |
23 |
hit1=TDC_MRANGE2_HIT1_START; |
|
|
24 |
hit2=TDC_MRANGE2_HIT2_1CH1; |
|
|
25 |
hitin1=TDC_HITIN1_2; |
|
|
26 |
hitin2=TDC_HITIN1_0; |
|
|
27 |
|
|
|
28 |
TDC_update_registers(); |
|
|
29 |
|
1744 |
kakl |
30 |
while(true) |
|
|
31 |
{ |
1758 |
kakl |
32 |
TDC_init(); |
1744 |
kakl |
33 |
delay_ms(500); |
1758 |
kakl |
34 |
printf("measured: %LX, %LX, %LX, %LX \n", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4)); |
1744 |
kakl |
35 |
}; |
|
|
36 |
} |