Rev 4248 Rev 4681
1 /**** IR Mrakomer 4 ****/ 1 /**** IR Mrakomer 4 ****/
2 #define VERSION "4.1" 2 #define VERSION "4.1"
3 #define ID "$Id: irmrak4.c 4248 2015-10-19 18:09:23Z kakl $" 3 #define ID "$Id: irmrak4.c 4681 2016-08-16 14:39:27Z kakl $"
4   4  
5 #include "irmrak4.h" 5 #include "irmrak4.h"
6   6  
7 #bit CREN = 0x18.4 // USART registers 7 #bit CREN = 0x18.4 // USART registers
8 #bit SPEN = 0x18.7 8 #bit SPEN = 0x18.7
9 #bit OERR = 0x18.1 9 #bit OERR = 0x18.1
10 #bit FERR = 0x18.2 10 #bit FERR = 0x18.2
11   11  
12 #include <string.h> 12 #include <string.h>
13   13  
14 #CASE // Case sensitive compiler 14 #CASE // Case sensitive compiler
15   15  
16 #define MAXHEAT 20 // Number of cycles for heating 16 #define MAXHEAT 20 // Number of cycles for heating
17 #define MAXOPEN 20 // Number of cycles for dome open 17 #define MAXOPEN 20 // Number of cycles for dome open
18 #define MEASURE_DELAY 6000 // Delay to a next measurement 18 #define MEASURE_DELAY 6000 // Delay to a next measurement
19 #define RESPONSE_DELAY 100 // Reaction time after receiving a command 19 #define RESPONSE_DELAY 100 // Reaction time after receiving a command
20 #define SAFETY_COUNT 90 // Time of one emergency cycle 20 #define SAFETY_COUNT 90 // Time of one emergency cycle
21 #define SEND_DELAY 50 // Time between two characters on RS232 21 #define SEND_DELAY 50 // Time between two characters on RS232
22 #define TEMPERATURE_INSIDE 1800 // Keep this temperature inside MM's box 22 #define TEMPERATURE_INSIDE 1800 // Keep this temperature inside MM's box
23   23  
24 #define DOME PIN_B4 // Dome controll port 24 #define DOME PIN_B4 // Dome controll port
25 #define HEATING PIN_B3 // Heating for defrosting 25 #define HEATING PIN_B3 // Heating for defrosting
26   26  
27   27  
28 char VER[4]=VERSION; // Buffer for concatenate of a version string 28 char VER[4]=VERSION; // Buffer for concatenate of a version string
29   29  
30 int8 heat; // Status variables 30 int8 heat; // Status variables
31 int8 open; 31 int8 open;
32   32  
33 inline void toggle_dome(void) // Wire exercise 33 inline void toggle_dome(void) // Wire exercise
34 { 34 {
35 if (open>0) 35 if (open>0)
36 {output_toggle(DOME);} // Toggle = Open Dome 36 {output_toggle(DOME);} // Toggle = Open Dome
37 else 37 else
38 {output_high(DOME);} // Do not toggle = Close Dome 38 {output_high(DOME);} // Do not toggle = Close Dome
39 } 39 }
40   40  
41 void delay(int16 cycles) // Wire exercise with delay 41 void delay(int16 cycles) // Wire exercise with delay
42 { 42 {
43 int16 i; 43 int16 i;
44   44  
45 for(i=0; i<cycles; i++) {toggle_dome(); delay_us(100);} 45 for(i=0; i<cycles; i++) {toggle_dome(); delay_us(100);}
46 } 46 }
47   47  
48 void welcome(void) // Welcome message 48 void welcome(void) // Welcome message
49 { 49 {
50 char REV[50]=ID; // Buffer for concatenate of a version string 50 char REV[50]=ID; // Buffer for concatenate of a version string
51   51  
52 if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0; 52 if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0;
53 printf("\r\n\r\n# Mrakomer %s (C) 2011 UST\r\n",VER); // Welcome message 53 printf("\r\n\r\n# Mrakomer %s (C) 2011 UST\r\n",VER); // Welcome message
54 printf("#%s\r\n",&REV[4]); 54 printf("#%s\r\n",&REV[4]);
55 // printf("#\r\n"); 55 // printf("#\r\n");
56 // printf("# commands: h, c, o, l, x, i, r, a, s, u\r\n"); 56 // printf("# commands: h, c, o, l, x, i, r, a, s, u\r\n");
57 // printf("# h_eat, c_old, o_pen, l_ock, x_open, "); 57 // printf("# h_eat, c_old, o_pen, l_ock, x_open, ");
58 // printf("i_nfo, r_epeat, a_uto, s_single, u_pdate\r\n"); 58 // printf("i_nfo, r_epeat, a_uto, s_single, u_pdate\r\n");
59 // printf("#\r\n"); 59 // printf("#\r\n");
60 // printf("# ver seq in[1/100 C] sky[1/100 C] sky[1/100 C] "); 60 // printf("# ver seq in[1/100 C] sky[1/100 C] sky[1/100 C] ");
61 // printf("out[1/100 C] heat[s] dome[s] check\r\n\r\n"); 61 // printf("out[1/100 C] heat[s] dome[s] check\r\n\r\n");
62   62  
63 //---WDT 63 //---WDT
64 restart_wdt(); 64 restart_wdt();
65 } 65 }
66   66  
67   67  
68 #include "smb.c" // System Management Bus driver 68 #include "smb.c" // System Management Bus driver
69 #include "TOUCH.C" 69 #include "TOUCH.C"
70   70  
71   71  
72 // Read sensor's RAM 72 // Read sensor's RAM
73 // Returns temperature in °K 73 // Returns temperature in °K
74 int16 ReadTemp(int8 addr, int8 select) 74 int16 ReadTemp(int8 addr, int8 select)
75 { 75 {
76 unsigned char arr[6]; // Buffer for the sent bytes 76 unsigned char arr[6]; // Buffer for the sent bytes
77 int8 crc; // Readed CRC 77 int8 crc; // Readed CRC
78 int16 temp; // Readed temperature 78 int16 temp; // Readed temperature
79   79  
80 addr<<=1; 80 addr<<=1;
81   81  
82 SMB_STOP_bit(); //If slave send NACK stop comunication 82 SMB_STOP_bit(); //If slave send NACK stop comunication
83 SMB_START_bit(); //Start condition 83 SMB_START_bit(); //Start condition
84 SMB_TX_byte(addr); 84 SMB_TX_byte(addr);
85 SMB_TX_byte(RAM_Access|select); 85 SMB_TX_byte(RAM_Access|select);
86 SMB_START_bit(); //Repeated Start condition 86 SMB_START_bit(); //Repeated Start condition
87 SMB_TX_byte(addr); 87 SMB_TX_byte(addr);
88 arr[2]=SMB_RX_byte(ACK); //Read low data,master must send ACK 88 arr[2]=SMB_RX_byte(ACK); //Read low data,master must send ACK
89 arr[1]=SMB_RX_byte(ACK); //Read high data,master must send ACK 89 arr[1]=SMB_RX_byte(ACK); //Read high data,master must send ACK
90 temp=make16(arr[1],arr[2]); 90 temp=make16(arr[1],arr[2]);
91 crc=SMB_RX_byte(NACK); //Read PEC byte, master must send NACK 91 crc=SMB_RX_byte(NACK); //Read PEC byte, master must send NACK
92 SMB_STOP_bit(); //Stop condition 92 SMB_STOP_bit(); //Stop condition
93   93  
94 arr[5]=addr; 94 arr[5]=addr;
95 arr[4]=RAM_Access|select; 95 arr[4]=RAM_Access|select;
96 arr[3]=addr; 96 arr[3]=addr;
97 arr[0]=0; 97 arr[0]=0;
98 if (crc != PEC_calculation(arr)) temp=0; // Calculate and check CRC 98 if (crc != PEC_calculation(arr)) temp=0; // Calculate and check CRC
99   99  
100 return temp; 100 return temp;
101 } 101 }
102   102  
103 // compute CRC 103 // compute CRC
104 // *sn - pointer to the byte array 104 // *sn - pointer to the byte array
105 // num - length of array 105 // num - length of array
106 inline int8 TM_check_CRC(unsigned int8 *sn, unsigned int8 num) 106 inline int8 TM_check_CRC(unsigned int8 *sn, unsigned int8 num)
107 { 107 {
108 // CRC table 108 // CRC table
109 const int8 TouchCRC[256]= { 109 const int8 TouchCRC[256]= {
110 0, 94, 188, 226, 97, 63, 221, 131, 194, 156, 126, 32, 163, 253, 31, 65, 110 0, 94, 188, 226, 97, 63, 221, 131, 194, 156, 126, 32, 163, 253, 31, 65,
111 157, 195, 33, 127, 252, 162, 64, 30, 95, 1, 227, 189, 62, 96, 130, 220, 111 157, 195, 33, 127, 252, 162, 64, 30, 95, 1, 227, 189, 62, 96, 130, 220,
112 35, 125, 159, 193, 66, 28, 254, 160, 225, 191, 93, 3, 128, 222, 60, 98, 112 35, 125, 159, 193, 66, 28, 254, 160, 225, 191, 93, 3, 128, 222, 60, 98,
113 190, 224, 2, 92, 223, 129, 99, 61, 124, 34, 192, 158, 29, 67, 161, 255, 113 190, 224, 2, 92, 223, 129, 99, 61, 124, 34, 192, 158, 29, 67, 161, 255,
114 70, 24, 250, 164, 39, 121, 155, 197, 132, 218, 56, 102, 229, 187, 89, 7, 114 70, 24, 250, 164, 39, 121, 155, 197, 132, 218, 56, 102, 229, 187, 89, 7,
115 219, 133, 103, 57, 186, 228, 6, 88, 25, 71, 165, 251, 120, 38, 196, 154, 115 219, 133, 103, 57, 186, 228, 6, 88, 25, 71, 165, 251, 120, 38, 196, 154,
116 101, 59, 217, 135, 4, 90, 184, 230, 167, 249, 27, 69, 198, 152, 122, 36, 116 101, 59, 217, 135, 4, 90, 184, 230, 167, 249, 27, 69, 198, 152, 122, 36,
117 248, 166, 68, 26, 153, 199, 37, 123, 58, 100, 134, 216, 91, 5, 231, 185, 117 248, 166, 68, 26, 153, 199, 37, 123, 58, 100, 134, 216, 91, 5, 231, 185,
118 140, 210, 48, 110, 237, 179, 81, 15, 78, 16, 242, 172, 47, 113, 147, 205, 118 140, 210, 48, 110, 237, 179, 81, 15, 78, 16, 242, 172, 47, 113, 147, 205,
119 17, 79, 173, 243, 112, 46, 204, 146, 211, 141, 111, 49, 178, 236, 14, 80, 119 17, 79, 173, 243, 112, 46, 204, 146, 211, 141, 111, 49, 178, 236, 14, 80,
120 175, 241, 19, 77, 206, 144, 114, 44, 109, 51, 209, 143, 12, 82, 176, 238, 120 175, 241, 19, 77, 206, 144, 114, 44, 109, 51, 209, 143, 12, 82, 176, 238,
121 50, 108, 142, 208, 83, 13, 239, 177, 240, 174, 76, 18, 145, 207, 45, 115, 121 50, 108, 142, 208, 83, 13, 239, 177, 240, 174, 76, 18, 145, 207, 45, 115,
122 202, 148, 118, 40, 171, 245, 23, 73, 8, 86, 180, 234, 105, 55, 213, 139, 122 202, 148, 118, 40, 171, 245, 23, 73, 8, 86, 180, 234, 105, 55, 213, 139,
123 87, 9, 235, 181, 54, 104, 138, 212, 149, 203, 41, 119, 244, 170, 72, 22, 123 87, 9, 235, 181, 54, 104, 138, 212, 149, 203, 41, 119, 244, 170, 72, 22,
124 233, 183, 85, 11, 136, 214, 52, 106, 43, 117, 151, 201, 74, 20, 246, 168, 124 233, 183, 85, 11, 136, 214, 52, 106, 43, 117, 151, 201, 74, 20, 246, 168,
125 116, 42, 200, 150, 21, 75, 169, 247, 182, 232, 10, 84, 215, 137, 107, 53}; 125 116, 42, 200, 150, 21, 75, 169, 247, 182, 232, 10, 84, 215, 137, 107, 53};
126   126  
127 int8 CRC; 127 int8 CRC;
128 int8 i; 128 int8 i;
129   129  
130 CRC=0; 130 CRC=0;
131 for(i=0;i<num;i++) CRC=TouchCRC[CRC ^ *(sn+i)]; 131 for(i=0;i<num;i++) CRC=TouchCRC[CRC ^ *(sn+i)];
132 return(CRC); 132 return(CRC);
133 } 133 }
134   134  
135   135  
136 /*-------------------------------- MAIN --------------------------------------*/ 136 /*-------------------------------- MAIN --------------------------------------*/
137 void main() 137 void main()
138 { 138 {
139 unsigned int16 seq, temp, tempa; 139 unsigned int16 seq, temp, tempa;
140 signed int16 ta, to1, to2, tTouch; 140 signed int16 ta, to1, to2, tTouch;
141 int8 tLSB,tMSB; // Temperatures from TouchMemory 141 int8 tLSB,tMSB; // Temperatures from TouchMemory
142 int8 safety_counter; 142 int8 safety_counter;
143 int8 heatTime; 143 int8 heatTime;
144 int1 repeat; // Status flags 144 int1 repeat; // Status flags
145 int1 automatic; 145 int1 automatic;
146   146  
147 //KAKL!!! 147 //KAKL!!!
148 int8 SN[10]; 148 int8 SN[10];
149   149  
150   150  
151 output_high(DOME); // Close Dome 151 output_high(DOME); // Close Dome
152 output_low(HEATING); // Heating off 152 output_low(HEATING); // Heating off
153   153  
154 delay_ms(1000); 154 delay_ms(1000);
155 restart_wdt(); 155 restart_wdt();
156   156  
157 seq=0; // Variables initiation 157 seq=0; // Variables initiation
158 heat=0; 158 heat=0;
159 open=0; 159 open=0;
160 heatTime=0; 160 heatTime=0;
161 repeat=TRUE; 161 repeat=TRUE;
162 automatic=FALSE; 162 automatic=FALSE;
163   163  
164 welcome(); 164 welcome();
165   165  
166 tempa=ReadTemp(SA, RAM_Tamb); // Dummy read 166 tempa=ReadTemp(SA, RAM_Tamb); // Dummy read
167 temp=ReadTemp(SA, RAM_Tobj1); 167 temp=ReadTemp(SA, RAM_Tobj1);
168 touch_present(); //Issues a reset of Touch Memory device 168 touch_present(); //Issues a reset of Touch Memory device
169 touch_write_byte(0xCC); 169 touch_write_byte(0xCC);
170 touch_write_byte(0x44); 170 touch_write_byte(0x44);
171   171  
172 delay_ms(1000); 172 delay_ms(1000);
173 //---WDT 173 //---WDT
174 restart_wdt(); 174 restart_wdt();
175 175
176 while(TRUE) // Main Loop 176 while(TRUE) // Main Loop
177 { 177 {
178 safety_counter=SAFETY_COUNT; // Heating and Dome Count Down 178 safety_counter=SAFETY_COUNT; // Heating and Dome Count Down
179 do 179 do
180 { 180 {
181 if (safety_counter<SAFETY_COUNT) safety_counter++; 181 if (safety_counter<SAFETY_COUNT) safety_counter++;
182   182  
183 delay(RESPONSE_DELAY); 183 delay(RESPONSE_DELAY);
184   184  
185 if (safety_counter>=SAFETY_COUNT) 185 if (safety_counter>=SAFETY_COUNT)
186 { 186 {
187 if (heat>0) { output_high(HEATING); } else { output_low(HEATING); } 187 if (heat>0) { output_high(HEATING); } else { output_low(HEATING); }
188   188  
189 if (heat>0) heat--; 189 if (heat>0) heat--;
190 if (open>0) open--; 190 if (open>0) open--;
191   191  
192 safety_counter=0; 192 safety_counter=0;
193 //---WDT 193 //---WDT
194 restart_wdt(); 194 restart_wdt();
195 } 195 }
196 } while (!kbhit()&&!repeat); 196 } while (!kbhit()&&!repeat);
197   197  
198 //---WDT 198 //---WDT
199 restart_wdt(); 199 restart_wdt();
200 { // Retrieve command 200 { // Retrieve command
201 char ch='k'; 201 char ch='k';
202   202  
203 if(kbhit()) ch=getc(); 203 if(kbhit()) ch=getc();
204   204  
205 switch (ch) 205 switch (ch)
206 { 206 {
207 case 'h': 207 case 'h':
208 heat=MAXHEAT; // Need heating 208 heat=MAXHEAT; // Need heating
209 automatic=FALSE; 209 automatic=FALSE;
210 break; 210 break;
211   211  
212 case 'c': 212 case 'c':
213 heat=0; // Need colder 213 heat=0; // Need colder
214 automatic=FALSE; 214 automatic=FALSE;
215 break; 215 break;
216   216  
217 case 'o': 217 case 'o':
218 open=MAXOPEN; // Open the dome 218 open=MAXOPEN; // Open the dome
219 automatic=FALSE; 219 automatic=FALSE;
220 break; 220 break;
221   221  
222 case 'x': 222 case 'x':
223 open=MAXOPEN; // Open the dome 223 open=MAXOPEN; // Open the dome
224 heat=MAXHEAT; // Need heating 224 heat=MAXHEAT; // Need heating
225 automatic=FALSE; 225 automatic=FALSE;
226 break; 226 break;
227   227  
228 case 'l': 228 case 'l':
229 open=0; // Lock the dome 229 open=0; // Lock the dome
230 automatic=FALSE; 230 automatic=FALSE;
231 break; 231 break;
232   232  
233 case 'i': 233 case 'i':
234 if (open==0) welcome(); // Information about version, etc... 234 if (open==0) welcome(); // Information about version, etc...
235 break; // Only when dome is closed 235 break; // Only when dome is closed
236   236  
237 case 'r': 237 case 'r':
238 repeat=TRUE; // Repeated measure mode 238 repeat=TRUE; // Repeated measure mode
239 automatic=FALSE; 239 automatic=FALSE;
240 break; 240 break;
241   241  
242 case 's': 242 case 's':
243 repeat=FALSE; // Single measure mode 243 repeat=FALSE; // Single measure mode
244 automatic=FALSE; 244 automatic=FALSE;
245 break; 245 break;
246   246  
247 case 'a': 247 case 'a':
248 repeat=TRUE; // Automatic mode 248 repeat=TRUE; // Automatic mode
249 automatic=TRUE; 249 automatic=TRUE;
250 break; 250 break;
251   251  
252 case 'u': 252 case 'u':
253 reset_cpu(); // Update firmware 253 reset_cpu(); // Update firmware
254 } 254 }
255 } 255 }
256 CREN=0; CREN=1; // Reinitialise USART 256 CREN=0; CREN=1; // Reinitialise USART
257   257  
258 seq++; // Increment the number of measurement 258 seq++; // Increment the number of measurement
259   259  
260 tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor 260 tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor
261 ta=tempa*2-27315; // °K -> °C 261 ta=tempa*2-27315; // °K -> °C
262   262  
263 temp=ReadTemp(SA, RAM_Tobj1); 263 temp=ReadTemp(SA, RAM_Tobj1);
264 if (temp>0x48E1) {to1=-27315;} else {to1=temp*2-27315;} 264 if (temp>0x48E1) {to1=-27315;} else {to1=temp*2-27315;}
265 temp=ReadTemp(SA, RAM_Tobj2); 265 temp=ReadTemp(SA, RAM_Tobj2);
266 if (temp>0x48E1) {to2=-27315;} else {to2=temp*2-27315;} 266 if (temp>0x48E1) {to2=-27315;} else {to2=temp*2-27315;}
267   267  
268 touch_present(); //Issues a reset of Touch Memory device 268 touch_present(); //Issues a reset of Touch Memory device
269 touch_write_byte(0xCC); 269 touch_write_byte(0xCC);
270 touch_write_byte(0x44); 270 touch_write_byte(0x44);
271 271
272 //---WDT 272 //---WDT
273 restart_wdt(); 273 restart_wdt();
274 delay(MEASURE_DELAY); // Delay to a next measurement 274 delay(MEASURE_DELAY); // Delay to a next measurement
275   275  
276 { 276 {
277 //KAKL!!! int8 SN[10]; 277 //KAKL!!! int8 SN[10];
278 int8 n; 278 int8 n;
279   279  
280 touch_present(); //Issues a reset and returns true if the touch device is there. 280 touch_present(); //Issues a reset and returns true if the touch device is there.
281 touch_write_byte(0xCC); 281 touch_write_byte(0xCC);
282 touch_write_byte(0xBE); 282 touch_write_byte(0xBE);
283 for(n=0;n<9;n++) SN[n]=touch_read_byte(); 283 for(n=0;n<9;n++) SN[n]=touch_read_byte();
284 tLSB=SN[0]; 284 tLSB=SN[0];
285 tMSB=SN[1]; 285 tMSB=SN[1];
-   286 /*KAKL!!!
286 if ((SN[8]==TM_check_CRC(SN,8))&&(SN[7]==0x10)) // Check CRC and family code to prevent O's error 287 if ((SN[8]==TM_check_CRC(SN,8))&&(SN[7]==0x10)) // Check CRC and family code to prevent O's error
287 { 288 {
288 tTouch=make16(tMSB,tLSB); 289 tTouch=make16(tMSB,tLSB);
289 tTouch=tTouch*6+tTouch/4; // 1bit = 0,0625gradC recalculate to 1/100gradC 290 tTouch=tTouch*6+tTouch/4; // 1bit = 0,0625gradC recalculate to 1/100gradC
290 } 291 }
291 else 292 else
292 { 293 {
293 tTouch=-27315; 294 tTouch=-27315;
294 } 295 }
-   296 */
-   297 tTouch=make16(tMSB,tLSB);
-   298 tTouch=tTouch*6+tTouch/4; // 1bit = 0,0625gradC recalculate to 1/100gradC
-   299  
295 } 300 }
296 301
297 /* 302 /*
298 if(automatic) // Solve automatic mode 303 if(automatic) // Solve automatic mode
299 { 304 {
300 if (heatTime==0) 305 if (heatTime==0)
301 { 306 {
302 if((tTouch<=-300)&&(ta<=300)) {heat=(700-tTouch)/400;} else {heat=1;} // Needs warmer? 307 if((tTouch<=-300)&&(ta<=300)) {heat=(700-tTouch)/400;} else {heat=1;} // Needs warmer?
303 heatTime=MAXHEAT; 308 heatTime=MAXHEAT;
304 } 309 }
305 heatTime--; 310 heatTime--;
306 311
307 if(ta>2000) heat=0; // Overtemperature protection 312 if(ta>2000) heat=0; // Overtemperature protection
308 if(tTouch>2000) heat=0; 313 if(tTouch>2000) heat=0;
309 if(ta<-10000) heat=0; // Sensor Error protection 314 if(ta<-10000) heat=0; // Sensor Error protection
310 if(tTouch<-10000) heat=0; 315 if(tTouch<-10000) heat=0;
311 316
312 if((abs(to1-to2)<100)&&(tTouch>to1)&&(abs(tTouch-to1)>800)) open=1; // Control the dome 317 if((abs(to1-to2)<100)&&(tTouch>to1)&&(abs(tTouch-to1)>800)) open=1; // Control the dome
313 if(to1<-10000) open=0; // Sensor Error protection 318 if(to1<-10000) open=0; // Sensor Error protection
314 if(tTouch<-10000) open=0; 319 if(tTouch<-10000) open=0;
315 } 320 }
316 */ 321 */
317 { // printf 322 { // printf
318 char output[8]; // Output buffer 323 char output[8]; // Output buffer
319 int8 j; // String pointer 324 int8 j; // String pointer
320 int8 check=0; // Checksum is calculated between '$' and '*' 325 int8 check=0; // Checksum is calculated between '$' and '*'
321   326  
322 delay(SEND_DELAY); 327 delay(SEND_DELAY);
323 putc('$'); 328 putc('$');
324 delay(SEND_DELAY); 329 delay(SEND_DELAY);
325 sprintf(output,"M%s \0",VER); 330 sprintf(output,"M%s \0",VER);
326 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 331 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
327 sprintf(output,"%Lu \0", seq); 332 sprintf(output,"%Lu \0", seq);
328 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 333 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
329 sprintf(output,"%Ld \0", ta); 334 sprintf(output,"%Ld \0", ta);
330 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 335 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
331 sprintf(output,"%Ld \0", to1); 336 sprintf(output,"%Ld \0", to1);
332 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 337 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
333 sprintf(output,"%Ld \0", to2); 338 sprintf(output,"%Ld \0", to2);
334 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 339 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
335 sprintf(output,"%Ld \0",tTouch); 340 sprintf(output,"%Ld \0",tTouch);
336 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 341 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
337 sprintf(output,"%u \0", heat); 342 sprintf(output,"%u \0", heat);
338 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 343 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
339 sprintf(output,"%u \0", open); 344 sprintf(output,"%u \0", open);
340 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; } 345 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
341 //KAKL!!! sprintf(output,"*%X\r\n\0", check); 346 //KAKL!!! sprintf(output,"*%X\r\n\0", check);
342 sprintf(output,"*%X \0", check); 347 sprintf(output,"*%X \0", check);
343 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } 348 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
344 { 349 {
345 int n; 350 int n;
346 for (n=0;n<9;n++) 351 for (n=0;n<9;n++)
347 { 352 {
348 sprintf(output,"%X \0", SN[n]); 353 sprintf(output,"%X \0", SN[n]);
349 354
350 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } 355 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
351 } 356 }
352 } 357 }
353 sprintf(output,"\r\n\0"); 358 sprintf(output,"\r\n\0");
354 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } 359 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
355   360  
356 delay(SEND_DELAY); 361 delay(SEND_DELAY);
357 } 362 }
358 363
359 //---WDT 364 //---WDT
360 restart_wdt(); 365 restart_wdt();
361 } 366 }
362 } 367 }
363   368  
364   369  
365 #include "dbloader.c" // Space reservation for the BootLoader 370 #include "dbloader.c" // Space reservation for the BootLoader