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 |
//TDC_init(); |
|
|
23 |
|
|
|
24 |
while(true) |
|
|
25 |
{ |
|
|
26 |
delay_ms(500); |
|
|
27 |
printf("ret: %LX \n", TDC_get_reg1()); |
1745 |
kakl |
28 |
// printf("ret: %LX \n", TDC_get_measurement(1)); |
1757 |
kakl |
29 |
|
1744 |
kakl |
30 |
}; |
|
|
31 |
} |