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 2835 2013-03-15 15:59:31Z kaklik $" |
3 |
#define ID "$Id: main.c 2837 2013-03-15 18:24:46Z 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 94... |
Line 94... |
94 |
delay_ms(1000); |
94 |
delay_ms(1000); |
95 |
{ // printf |
95 |
{ // printf |
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 += 273.15; |
99 |
SHT_temp = (SHT_temp + 273.15)*100; |
100 |
barometer_temperature = MPL_get_temperature() + 273.15; |
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); |
Line 107... |
Line 107... |
107 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
107 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
108 |
sprintf(output,"%Lu \0", seq); |
108 |
sprintf(output,"%Lu \0", seq); |
109 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
109 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
110 |
sprintf(output,"%5.0f \0", local_temp ); |
110 |
sprintf(output,"%5.0f \0", local_temp ); |
111 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
111 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
112 |
sprintf(output,"%5.0f \0", SHT_temp*100); |
112 |
sprintf(output,"%5.0f \0", SHT_temp); |
113 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
113 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
114 |
sprintf(output,"%3.1f \0", SHT_hum); |
114 |
sprintf(output,"%3.1f \0", SHT_hum); |
115 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
115 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
116 |
sprintf(output,"%f \0", barometer_temperature); |
116 |
sprintf(output,"%5.0f \0", barometer_temperature); |
117 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
117 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
118 |
sprintf(output,"%5.1f \0", barometer_pressure); |
118 |
sprintf(output,"%5.1f \0", barometer_pressure); |
119 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
119 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
120 |
sprintf(output,"%3.1f \0", anemo); |
120 |
sprintf(output,"%3.1f \0", anemo); |
121 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |
121 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; } |