Rev 2829 Rev 2834
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 2829 2013-03-10 16:41:20Z kaklik $" 3 #define ID "$Id: main.c 2834 2013-03-15 00:32: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 64... Line 64...
64 setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); 64 setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
65 setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT); 65 setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT);
66 setup_timer_2(T2_DISABLED,0,1); 66 setup_timer_2(T2_DISABLED,0,1);
67 setup_ccp1(CCP_OFF); 67 setup_ccp1(CCP_OFF);
68 setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard 68 setup_comparator(NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard
69 setup_oscillator(OSC_8MHZ); 69 // setup_oscillator(OSC_8MHZ); // pri prouziti bootloaderu neni treba nastavovat
70 setup_wdt(WDT_1152MS|WDT_DIV_16); 70 // setup_wdt(WDT_1152MS|WDT_DIV_16);
71 setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64); 71 setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_64);
72 output_high(CSN_SPI); 72 output_high(CSN_SPI);
73   73  
74 delay_ms(100); 74 delay_ms(100);
75   75  
76 welcome(); // welocome print and device indentification 76 welcome(); // welcome print and device indentification
77   77  
78 sht_init(); 78 sht_init();
79 MPL_init(); // get correction coefficients from the sensor 79 MPL_init(); // get correction coefficients from the sensor
80   80  
81 enable_interrupts(INT_TIMER1); // interrupts used for anemometer readings 81 // enable_interrupts(INT_TIMER1); // interrupts used for anemometer readings
82 enable_interrupts(INT_TIMER0); 82 // enable_interrupts(INT_TIMER0);
83 enable_interrupts(GLOBAL); 83 // enable_interrupts(GLOBAL);
84   84  
85 while (TRUE) 85 while (TRUE)
86 { 86 {
87 char output[8]; // Output buffer 87 char output[8]; // Output buffer
88 int8 j; // String pointer 88 int8 j; // String pointer