Rev 928 Rev 929
Line 1... Line 1...
1 /**** IR Mrakomer3 ****/ 1 /**** IR Mrakomer3 ****/
2 #define VERSION "3.0" 2 #define VERSION "3.0"
3 #define ID "$Id: irmrak3.c 928 2007-12-24 09:52:55Z kakl $" 3 #define ID "$Id: irmrak3.c 929 2007-12-24 10:00:11Z kakl $"
4 #include "irmrak3.h" 4 #include "irmrak3.h"
5 #bit SSPM3=0x14.3 5 #bit SSPM3=0x14.3
6   6  
7 #define SA 0x00 // Slave Address (0 for single slave / 0x5A<<1 default) 7 #define SA 0x00 // Slave Address (0 for single slave / 0x5A<<1 default)
8 #define RAM_Access 0x00 // RAM access command 8 #define RAM_Access 0x00 // RAM access command
Line 141... Line 141...
141   141  
142 while(TRUE) 142 while(TRUE)
143 { 143 {
144 n++; 144 n++;
145   145  
146 if (kbhit()) 146 if (kbhit()) // Would you like warmer?
147 { 147 {
148 delay_ms(200); 148 getc(); i=0;
149 if ('w'==getc()) i=0; // Would you like warmer? -  
150 } 149 }
151   150  
152 tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor 151 tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor
153 temp=ReadTemp(SA, RAM_Tobj1); 152 temp=ReadTemp(SA, RAM_Tobj1);
154   153  
155 if((0==tempa)||(0==temp)) // Transfer error? 154 if((0==tempa)||(0==temp)) // Transfer error?
156 { 155 {
157 printf("%Lu;ta:-273;ts:-273;Error\n\r",n); 156 printf("%Lu;ta:-273;ts:-273;sta:-1\n\r",n);
158 output_low(HEATING); 157 output_low(HEATING);
159 } 158 }
160 else 159 else
161 { 160 {
162 to=(signed int16)(temp*2-27315)/100; 161 to=(signed int16)(temp*2-27315)/100;
163 ta=(signed int16)(tempa*2-27315)/100; 162 ta=(signed int16)(tempa*2-27315)/100;
164   163  
165 printf("%Lu;ta:%Ld;ts:%Ld;",n,ta,to); 164 printf("%Lu;ta:%Ld;ts:%Ld;sta:",n,ta,to);
166 if (i>=MAXHEAT) 165 if (i>=MAXHEAT)
167 { 166 {
168 printf("OK\n\r"); 167 printf("0\n\r");
169 output_low(HEATING); 168 output_low(HEATING);
170 } 169 }
171 else 170 else
172 { 171 {
173 printf("Heating\n\r"); 172 printf("1\n\r");
174 output_high(HEATING); 173 output_high(HEATING);
175 i++; 174 i++;
176 } 175 }
177 }; 176 };
178 restart_wdt(); 177 restart_wdt();