Line 1... |
Line 1... |
1 |
#include "main.h" |
1 |
#include "main.h" |
2 |
|
2 |
|
3 |
#include "GP2.h" |
3 |
#include "GP2.h" |
4 |
|
4 |
|
- |
|
5 |
#define VERSION 0.1 |
- |
|
6 |
|
5 |
void main() |
7 |
void main() |
6 |
{ |
8 |
{ |
7 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
9 |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
8 |
setup_adc(ADC_CLOCK_DIV_2); |
10 |
setup_adc(ADC_CLOCK_DIV_2); |
9 |
setup_psp(PSP_DISABLED); |
11 |
setup_psp(PSP_DISABLED); |
Line 16... |
Line 18... |
16 |
setup_comparator(NC_NC_NC_NC); |
18 |
setup_comparator(NC_NC_NC_NC); |
17 |
setup_vref(FALSE); |
19 |
setup_vref(FALSE); |
18 |
|
20 |
|
19 |
TDC_reset(); |
21 |
TDC_reset(); |
20 |
//TDC_init(); |
22 |
//TDC_init(); |
21 |
TDC_setup_reg1(); |
- |
|
22 |
|
23 |
|
23 |
while(true) |
24 |
while(true) |
24 |
{ |
25 |
{ |
25 |
delay_ms(500); |
26 |
delay_ms(500); |
26 |
printf("ret: %LX \n", TDC_get_reg1()); |
27 |
printf("ret: %LX \n", TDC_get_reg1()); |
27 |
// printf("ret: %LX \n", TDC_get_measurement(1)); |
28 |
// printf("ret: %LX \n", TDC_get_measurement(1)); |
- |
|
29 |
|
28 |
}; |
30 |
}; |
29 |
} |
31 |
} |