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 2848 2013-03-21 08:16:49Z kakl $" |
3 |
#define ID "$Id: main.c 2858 2013-03-22 16:04:13Z 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 80... |
Line 80... |
80 |
output_high(CSN_SPI); |
80 |
output_high(CSN_SPI); |
81 |
|
81 |
|
82 |
welcome(); // welcome print and device indentification |
82 |
welcome(); // welcome print and device indentification |
83 |
output_low(PIN_E1); |
83 |
output_low(PIN_E1); |
84 |
|
84 |
|
85 |
enable_interrupts(INT_TIMER1); // interrupts used for anemometer readings |
85 |
//enable_interrupts(INT_TIMER1); // interrupts used for anemometer readings |
86 |
//enable_interrupts(INT_TIMER0); |
86 |
//enable_interrupts(INT_TIMER0); |
87 |
// disable_interrupts(INT_RDA); |
87 |
// disable_interrupts(INT_RDA); |
88 |
enable_interrupts(GLOBAL); |
88 |
//enable_interrupts(GLOBAL); |
89 |
output_high(PIN_E1); |
89 |
output_high(PIN_E1); |
90 |
|
90 |
|
91 |
restart_wdt(); //---WDT |
91 |
restart_wdt(); //---WDT |
92 |
|
92 |
|
93 |
sht_init(); |
93 |
sht_init(); |
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); |