| 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 2821 2013-03-10 14:47:53Z kaklik $" | 3 | #define ID "$Id: main.c 2822 2013-03-10 14:51:27Z kaklik $" | 
      
        | 4 | #include "main.h" | 4 | #include "main.h" | 
      
        | 5 | #include <string.h> | 5 | #include <string.h> | 
      
        | 6 |   | 6 |   | 
      
        | 7 | #CASE    // Case sensitive compiler | 7 | #CASE    // Case sensitive compiler | 
      
        | 8 |   | 8 |   | 
      
        | Line 62... | Line 62... | 
      
        | 62 |   | 62 |   | 
      
        | 63 | void main() | 63 | void main() | 
      
        | 64 | { | 64 | { | 
      
        | 65 | unsigned int16 seq=0; | 65 | unsigned int16 seq=0; | 
      
        | 66 |   | 66 |   | 
      
        | 67 | /*   setup_adc_ports(NO_ANALOGS|VSS_VDD); | 67 |    setup_adc_ports(NO_ANALOGS|VSS_VDD); | 
      
        | 68 |    setup_adc(ADC_CLOCK_DIV_2); | 68 |    setup_adc(ADC_CLOCK_DIV_2); | 
      
        | 69 |    setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); | 69 |    setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); | 
      
        | 70 |    setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT); | 70 |    setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT); | 
      
        | 71 |    setup_timer_2(T2_DISABLED,0,1); | 71 |    setup_timer_2(T2_DISABLED,0,1); | 
      
        | 72 |    setup_ccp1(CCP_OFF); | 72 |    setup_ccp1(CCP_OFF); | 
      
        | 73 |    setup_comparator(NC_NC_NC_NC);      // This device COMP currently not supported by the PICWizard | 73 | /*   setup_comparator(NC_NC_NC_NC);      // This device COMP currently not supported by the PICWizard | 
      
        | 74 |    setup_oscillator(OSC_8MHZ); | 74 |    setup_oscillator(OSC_8MHZ); | 
      
        | 75 |    setup_wdt(WDT_1152MS|WDT_DIV_16); | 75 |    setup_wdt(WDT_1152MS|WDT_DIV_16); | 
      
        | 76 |    setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); | 76 |    setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); | 
      
        | 77 |    output_high(CSN_SPI); | 77 |    output_high(CSN_SPI); | 
      
        | 78 | //   enable_interrupts(INT_TIMER1); | - |  | 
      
        | 79 | //   enable_interrupts(INT_TIMER0); | - |  | 
      
        | 80 | //   enable_interrupts(GLOBAL); | - |  | 
      
        | 81 |   | 78 |   | 
      
        | 82 | */ | 79 | */ | 
      
        | 83 |    delay_ms(100);  | 80 |    delay_ms(100);  | 
      
        | 84 |   | 81 |   | 
      
        | 85 |    welcome(); | 82 |    welcome(); | 
      
        | 86 |   | 83 |   | 
      
        | 87 |    sht_init(); | 84 |    sht_init(); | 
      
        | 88 |    MPL_init();  // get correction coefficients from the sensor  | 85 |    MPL_init();  // get correction coefficients from the sensor  | 
      
        | 89 |   | 86 |   | 
      
        | - |  | 87 | //   enable_interrupts(INT_TIMER1);   // interrupts used for anemometer readings | 
      
        | - |  | 88 | //   enable_interrupts(INT_TIMER0); | 
      
        | - |  | 89 | //   enable_interrupts(GLOBAL); | 
      
        | - |  | 90 |   | 
      
        | 90 |    while (TRUE) | 91 |    while (TRUE) | 
      
        | 91 |    { | 92 |    { | 
      
        | 92 |    char output[8];   // Output buffer | 93 |    char output[8];   // Output buffer | 
      
        | 93 |    int8 j;           // String pointer | 94 |    int8 j;           // String pointer | 
      
        | 94 |    int8 check=0;     // Checksum is calculated between '$' and '*' | 95 |    int8 check=0;     // Checksum is calculated between '$' and '*' |