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 2837 2013-03-15 18:24:46Z kaklik $" |
3 |
#define ID "$Id: main.c 2838 2013-03-15 20:47:41Z 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 76... |
Line 76... |
76 |
welcome(); // welcome 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 |
Line 96... |
Line 96... |
96 |
|
96 |
|
97 |
local_temp = ds1820_read()+27315; |
97 |
local_temp = ds1820_read()+27315; |
98 |
sht_rd(SHT_temp,SHT_hum); |
98 |
sht_rd(SHT_temp,SHT_hum); |
99 |
SHT_temp = (SHT_temp + 273.15)*100; |
99 |
SHT_temp = (SHT_temp + 273.15)*100; |
100 |
barometer_temperature = (MPL_get_temperature() + 273.15)*100; |
100 |
barometer_temperature = (MPL_get_temperature() + 273.15)*100; |
101 |
barometer_pressure = MPL_get_pressure() * 10.0; // conversion to hectopascals |
101 |
barometer_pressure = MPL_get_pressure() * 10.0; // conversion to hectopascals |
102 |
|
102 |
|
103 |
delay_us(SEND_DELAY); |
103 |
delay_us(SEND_DELAY); |
104 |
putc('$'); |
104 |
putc('$'); |
105 |
delay_us(SEND_DELAY); |
105 |
delay_us(SEND_DELAY); |
106 |
sprintf(output,"AWS%s \0",VER); |
106 |
sprintf(output,"AWS%s \0",VER); |