Rev 1284 Rev 1285
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 1284 2009-01-07 21:05:29Z kakl $" 3 #define ID "$Id: irmrak4.c 1285 2009-01-08 00:31:13Z 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 25... Line 25...
25 int8 open; 25 int8 open;
26   26  
27 inline void toggle_dome(void) // Wire exercise 27 inline void toggle_dome(void) // Wire exercise
28 { 28 {
29 if (open>0) 29 if (open>0)
30 {output_toggle(DOME);} 30 {output_toggle(DOME);} // Toggle = Open Dome
31 else 31 else
32 {output_low(DOME);} 32 {output_high(DOME);} // Do not toggle = Close Dome
33 } 33 }
34   34  
35 void delay(int16 cycles) // Wire exercise with delay 35 void delay(int16 cycles) // Wire exercise with delay
36 { 36 {
37 int16 i; 37 int16 i;
Line 87... Line 87...
87 { 87 {
88 unsigned int16 seq, temp, tempa; 88 unsigned int16 seq, temp, tempa;
89 signed int16 ta, to; 89 signed int16 ta, to;
90 int8 safety_counter; 90 int8 safety_counter;
91   91  
92 output_low(DOME); // Close Dome 92 output_high(DOME); // Close Dome
93 output_low(HEATING); // Heating off 93 output_low(HEATING); // Heating off
94 setup_wdt(WDT_2304MS); // Setup Watch Dog 94 setup_wdt(WDT_2304MS); // Setup Watch Dog
95 setup_adc_ports(NO_ANALOGS); 95 setup_adc_ports(NO_ANALOGS);
96 setup_adc(ADC_OFF); 96 setup_adc(ADC_OFF);
97 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 97 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
Line 103... Line 103...
103 setup_oscillator(OSC_8MHZ|OSC_INTRC); 103 setup_oscillator(OSC_8MHZ|OSC_INTRC);
104   104  
105 delay_ms(1000); 105 delay_ms(1000);
106 restart_wdt(); 106 restart_wdt();
107   107  
108 welcome(); -  
109 -  
110 tempa=ReadTemp(SA, RAM_Tamb); // Dummy read -  
111 temp=ReadTemp(SA, RAM_Tobj1); -  
112   -  
113 seq=0; // Variables initiation 108 seq=0; // Variables initiation
114 heat=0; 109 heat=0;
115 open=0; 110 open=0;
116   111  
-   112 welcome();
-   113  
-   114 tempa=ReadTemp(SA, RAM_Tamb); // Dummy read
-   115 temp=ReadTemp(SA, RAM_Tobj1);
-   116  
117 //---WDT 117 //---WDT
118 restart_wdt(); 118 restart_wdt();
119   119  
120 while(TRUE) // Main Loop 120 while(TRUE) // Main Loop
121 { 121 {
Line 146... Line 146...
146 safety_counter=0; 146 safety_counter=0;
147 //---WDT 147 //---WDT
148 restart_wdt(); 148 restart_wdt();
149 } 149 }
150 } while (!kbhit()); 150 } while (!kbhit());
151 151  
152 //---WDT 152 //---WDT
153 restart_wdt(); 153 restart_wdt();
154 { // Retrieve command 154 { // Retrieve command
155 char ch; 155 char ch;
156   156