Rev 1757 Rev 1758
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 5 #define VERSION 0.1
6   6  
7 void main() 7 void main()
8 { 8 {
9 setup_adc_ports(NO_ANALOGS|VSS_VDD); 9 setup_adc_ports(NO_ANALOGS|VSS_VDD);
10 setup_adc(ADC_CLOCK_DIV_2); 10 setup_adc(ADC_CLOCK_DIV_2);
11 setup_psp(PSP_DISABLED); 11 setup_psp(PSP_DISABLED);
12 setup_spi(SPI_SS_DISABLED); 12 setup_spi(SPI_SS_DISABLED);
13 setup_wdt(WDT_OFF); 13 setup_wdt(WDT_OFF);
14 setup_timer_0(RTCC_INTERNAL); 14 setup_timer_0(RTCC_INTERNAL);
15 setup_timer_1(T1_DISABLED); 15 setup_timer_1(T1_DISABLED);
16 setup_timer_2(T2_DISABLED,0,1); 16 setup_timer_2(T2_DISABLED,0,1);
17 setup_ccp1(CCP_OFF); 17 setup_ccp1(CCP_OFF);
18 setup_comparator(NC_NC_NC_NC); 18 setup_comparator(NC_NC_NC_NC);
19 setup_vref(FALSE); 19 setup_vref(FALSE);
20   20  
21 TDC_reset(); 21 TDC_reset();
22 //TDC_init(); -  
23 22
-   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
24 while(true) 30 while(true)
25 { 31 {
-   32 TDC_init();
26 delay_ms(500); 33 delay_ms(500);
27 printf("ret: %LX \n", TDC_get_reg1()); -  
28 // printf("ret: %LX \n", TDC_get_measurement(1)); 34 printf("measured: %LX, %LX, %LX, %LX \n", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4));
29   -  
30 }; 35 };
31 } 36 }