Line 1... |
Line 1... |
1 |
/**** IR Mrakomer 4 ****/ |
1 |
/**** IR Mrakomer 4 ****/ |
2 |
#define VERSION "4.0" |
2 |
#define VERSION "4.0" |
3 |
#define ID "$Id: irmrak4.c 1281 2009-01-07 12:31:20Z kakl $" |
3 |
#define ID "$Id: irmrak4.c 1282 2009-01-07 13:07:23Z kakl $" |
4 |
#include "irmrak4.h" |
4 |
#include "irmrak4.h" |
5 |
|
5 |
|
6 |
#define MAXHEAT 20 // Number of cycles for heating |
6 |
#define MAXHEAT 20 // Number of cycles for heating |
7 |
#define MAXOPEN 20 // Number of cycles for dome open |
7 |
#define MAXOPEN 20 // Number of cycles for dome open |
8 |
#define MEASURE_DELAY 10000 // Delay to a next measurement |
8 |
#define MEASURE_DELAY 10000 // Delay to a next measurement |
Line 94... |
Line 94... |
94 |
|
94 |
|
95 |
delay_ms(1000); |
95 |
delay_ms(1000); |
96 |
restart_wdt(); |
96 |
restart_wdt(); |
97 |
printf("\n\r* Mrakomer %s (C) 2007 KAKL *\n\r",VER); // Welcome message |
97 |
printf("\n\r* Mrakomer %s (C) 2007 KAKL *\n\r",VER); // Welcome message |
98 |
printf("* %s *\n\r",REV); |
98 |
printf("* %s *\n\r",REV); |
99 |
printf("<#sequence> <ambient [1/100 °C]> <sky [1/100 °C]> "); |
99 |
printf("<#sequence> <ambient [1/100 C]> <sky [1/100 C]> "); |
100 |
printf("<heating [s]> <dome [s]>\n\r\n\r"); |
100 |
printf("<heating [s]> <dome [s]>\n\r\n\r"); |
101 |
tempa=ReadTemp(SA, RAM_Tamb); // Dummy read |
101 |
tempa=ReadTemp(SA, RAM_Tamb); // Dummy read |
102 |
temp=ReadTemp(SA, RAM_Tobj1); |
102 |
temp=ReadTemp(SA, RAM_Tobj1); |
103 |
|
103 |
|
104 |
seq=0; |
104 |
seq=0; |
Line 178... |
Line 178... |
178 |
|
178 |
|
179 |
ta=tempa*2-27315; // °K -> °C |
179 |
ta=tempa*2-27315; // °K -> °C |
180 |
to=temp*2-27315; |
180 |
to=temp*2-27315; |
181 |
|
181 |
|
182 |
{ // printf |
182 |
{ // printf |
183 |
char output[30]; // Output buffer |
183 |
char output[10]; // Output buffer |
184 |
int8 j; // Counter |
184 |
int8 j; // Counter |
185 |
|
185 |
|
- |
|
186 |
delay(SEND_DELAY); |
186 |
sprintf(output,"#%Lu %Ld %Ld %u %u\n\r\0", seq, ta, to, heat, open); |
187 |
sprintf(output,"#%Lu ", seq); |
187 |
|
- |
|
- |
|
188 |
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } |
188 |
j=0; |
189 |
sprintf(output,"%Ld ", ta); |
189 |
while(output[j]!=0) |
190 |
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } |
190 |
{ |
191 |
sprintf(output,"%Ld ", to); |
191 |
delay(SEND_DELAY); |
192 |
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } |
192 |
putc(output[j++]); |
193 |
sprintf(output,"%u", heat); |
- |
|
194 |
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } |
193 |
} |
195 |
sprintf(output,"%u\n\r\0", open); |
- |
|
196 |
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } |
194 |
} |
197 |
} |
195 |
|
198 |
|
196 |
delay(MEASURE_DELAY); // Delay to a next measurement |
199 |
delay(MEASURE_DELAY); // Delay to a next measurement |
197 |
//---WDT |
200 |
//---WDT |
198 |
restart_wdt(); |
201 |
restart_wdt(); |