Rev 1288 Rev 1289
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 1288 2009-01-08 19:01:53Z kakl $" 3 #define ID "$Id: irmrak4.c 1289 2009-01-08 19:13:06Z kakl $"
4 #include "irmrak4.h" 4 #include "irmrak4.h"
5   5  
-   6 #CASE // Case sensitive compiler
-   7  
6 #define MAXHEAT 20 // Number of cycles for heating 8 #define MAXHEAT 20 // Number of cycles for heating
7 #define MAXOPEN 20 // Number of cycles for dome open 9 #define MAXOPEN 20 // Number of cycles for dome open
8 #define MEASURE_DELAY 6000 // Delay to a next measurement 10 #define MEASURE_DELAY 6000 // Delay to a next measurement
9 #define RESPONSE_DELAY 100 // Reaction time after receiving a command 11 #define RESPONSE_DELAY 100 // Reaction time after receiving a command
10 #define SAFETY_COUNT 90 // Time of one emergency cycle 12 #define SAFETY_COUNT 90 // Time of one emergency cycle
Line 67... Line 69...
67 SMB_TX_byte(RAM_Access|select); 69 SMB_TX_byte(RAM_Access|select);
68 SMB_START_bit(); //Repeated Start condition 70 SMB_START_bit(); //Repeated Start condition
69 SMB_TX_byte(addr); 71 SMB_TX_byte(addr);
70 arr[2]=SMB_RX_byte(ACK); //Read low data,master must send ACK 72 arr[2]=SMB_RX_byte(ACK); //Read low data,master must send ACK
71 arr[1]=SMB_RX_byte(ACK); //Read high data,master must send ACK 73 arr[1]=SMB_RX_byte(ACK); //Read high data,master must send ACK
72 temp=MAKE16(arr[1],arr[2]); 74 temp=make16(arr[1],arr[2]);
73 crc=SMB_RX_byte(NACK); //Read PEC byte, master must send NACK 75 crc=SMB_RX_byte(NACK); //Read PEC byte, master must send NACK
74 SMB_STOP_bit(); //Stop condition 76 SMB_STOP_bit(); //Stop condition
75   77  
76 arr[5]=addr; 78 arr[5]=addr;
77 arr[4]=RAM_Access|select; 79 arr[4]=RAM_Access|select;
Line 108... Line 110...
108   110  
109 seq=0; // Variables initiation 111 seq=0; // Variables initiation
110 heat=0; 112 heat=0;
111 open=0; 113 open=0;
112 repeat=FALSE; 114 repeat=FALSE;
113 115  
114 welcome(); 116 welcome();
115   117  
116 tempa=ReadTemp(SA, RAM_Tamb); // Dummy read 118 tempa=ReadTemp(SA, RAM_Tamb); // Dummy read
117 temp=ReadTemp(SA, RAM_Tobj1); 119 temp=ReadTemp(SA, RAM_Tobj1);
118   120  
Line 208... Line 210...
208 sprintf(output,"%u ", heat); 210 sprintf(output,"%u ", heat);
209 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } 211 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
210 sprintf(output,"%u\n\r\0", open); 212 sprintf(output,"%u\n\r\0", open);
211 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); } 213 j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
212 } 214 }
213 215  
214 if(heating>0) { output_high(HEATING); } else { output_low(HEATING); } 216 if(heat>0) { output_high(HEATING); } else { output_low(HEATING); }
215   217  
216 delay(MEASURE_DELAY); // Delay to a next measurement 218 delay(MEASURE_DELAY); // Delay to a next measurement
217 //---WDT 219 //---WDT
218 restart_wdt(); 220 restart_wdt();
219 } 221 }