| Line 1... | 
        Line 1... | 
      
      
        | 1 | 
        /**** Automatic weather station 01A ****/ | 
        1 | 
        /**** Automatic weather station 01A ****/ | 
      
      
        | 2 | 
        #define VERSION "0.1" | 
        2 | 
        #define VERSION "0.1" | 
      
      
        | 3 | 
        #define ID "$Id: main.c 2897 2013-04-09 21:20:28Z kakl $" | 
        3 | 
        #define ID "$Id: main.c 2899 2013-04-11 22:07:54Z kaklik $" | 
      
      
        | 4 | 
        #include "main.h" | 
        4 | 
        #include "main.h" | 
      
      
        | 5 | 
        #include ".\common\dbloader.h" | 
        5 | 
        #include ".\common\dbloader.h" | 
      
      
        | 6 | 
        #include <string.h> | 
        6 | 
        #include <string.h> | 
      
      
        | 7 | 
          | 
        7 | 
          | 
      
      
        | 8 | 
        #CASE    // Case sensitive compiler | 
        8 | 
        #CASE    // Case sensitive compiler | 
      
      
        | Line 69... | 
        Line 69... | 
      
      
        | 69 | 
           setup_wdt(WDT_2304MS); | 
        69 | 
           setup_wdt(WDT_2304MS); | 
      
      
        | 70 | 
           restart_wdt();  //---WDT | 
        70 | 
           restart_wdt();  //---WDT | 
      
      
        | 71 | 
           setup_adc_ports(NO_ANALOGS|VSS_VDD); | 
        71 | 
           setup_adc_ports(NO_ANALOGS|VSS_VDD); | 
      
      
        | 72 | 
           setup_adc(ADC_CLOCK_DIV_2); | 
        72 | 
           setup_adc(ADC_CLOCK_DIV_2); | 
      
      
        | 73 | 
           setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); | 
        73 | 
           setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); | 
      
      
        | 74 | 
        //   setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);//|T1_CLK_OUT); | 
        74 | 
           setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1);//|T1_CLK_OUT); | 
      
      
        | 75 | 
           setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); | 
        75 | 
        //   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); | 
      
      
        | 76 | 
           setup_timer_2(T2_DISABLED,0,1); | 
        76 | 
           setup_timer_2(T2_DISABLED,0,1); | 
      
      
        | 77 | 
           setup_ccp1(CCP_OFF); | 
        77 | 
           setup_ccp1(CCP_OFF); | 
      
      
        | 78 | 
           setup_comparator(NC_NC_NC_NC);      // This device COMP currently not supported by the PICWizard | 
        78 | 
           setup_comparator(NC_NC_NC_NC);      // This device COMP currently not supported by the PICWizard | 
      
      
        | 79 | 
           setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); | 
        79 | 
           setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); | 
      
      
        | 80 | 
           output_high(CSN_SPI); | 
        80 | 
           output_high(CSN_SPI); | 
      
      
        | Line 108... | 
        Line 108... | 
      
      
        | 108 | 
                 { // printf | 
        108 | 
                 { // printf | 
      
      
        | 109 | 
          | 
        109 | 
          | 
      
      
        | 110 | 
             local_temp = ds1820_read()+27315; | 
        110 | 
             local_temp = ds1820_read()+27315; | 
      
      
        | 111 | 
             sht_rd(SHT_temp,SHT_hum); | 
        111 | 
             sht_rd(SHT_temp,SHT_hum); | 
      
      
        | 112 | 
             SHT_temp = (SHT_temp + 273.15)*100; | 
        112 | 
             SHT_temp = (SHT_temp + 273.15)*100; | 
      
      
        | 113 | 
             //barometer_temperature =  (MPL_get_temperature() + 273.15)*100; | 
        113 | 
             barometer_temperature =  (MPL_get_temperature() + 273.15)*100; | 
      
      
        | 114 | 
             //barometer_pressure = MPL_get_pressure() * 10.0; // conversion to hectopascals | 
        114 | 
             barometer_pressure = MPL_get_pressure() * 10.0; // conversion to hectopascals | 
      
      
        | 115 | 
              | 
        115 | 
              | 
      
      
        | 116 | 
                 delay_us(SEND_DELAY); | 
        116 | 
                 delay_us(SEND_DELAY); | 
      
      
        | 117 | 
                 putc('$'); | 
        117 | 
                 putc('$'); | 
      
      
        | 118 | 
                 delay_us(SEND_DELAY); | 
        118 | 
                 delay_us(SEND_DELAY); | 
      
      
        | 119 | 
                 sprintf(output,"AWS%s \0",VER); | 
        119 | 
                 sprintf(output,"AWS%s \0",VER); |