Rev 3020 Rev 3021
Line 52... Line 52...
52 output_toggle(BEEP); 52 output_toggle(BEEP);
53 delay_us(1/frequency); 53 delay_us(1/frequency);
54 } 54 }
55 } 55 }
56   56  
-   57 #define TRESHOLD_setup 1
-   58 #define INTERVAL_setup 0
-   59  
-   60  
57 void main() 61 void main()
58 { 62 {
59 unsigned int16 integration_time=60; 63 unsigned int16 integration_time=60;
60 unsigned int16 time; 64 unsigned int16 time;
61 unsigned int16 last_timer; // promena pro praskani 65 unsigned int16 last_timer; // promena pro praskani
62 unsigned int1 button_press,voltage_setup=0,time_setup=1; // semafor pro cteni tlacitek 66 unsigned int1 button_press,setup_mode=INTERVAL_setup; // semafor pro cteni tlacitek
63 unsigned int16 measurement_number=0; 67 unsigned int16 measurement_number=0;
64   68  
65 setup_adc_ports(sAN0|VSS_VDD); 69 setup_adc_ports(sAN0|VSS_VDD);
66 setup_adc(ADC_CLOCK_DIV_32); 70 setup_adc(ADC_CLOCK_DIV_32);
67 setup_spi(SPI_SS_DISABLED); 71 setup_spi(SPI_SS_DISABLED);
Line 188... Line 192...
188 { 192 {
189 delay_ms(20); 193 delay_ms(20);
190 if(!input(S4)) 194 if(!input(S4))
191 { 195 {
192 button_press=true; 196 button_press=true;
193 if(time_setup==TRUE) 197 switch (setup_mode)
194 { 198 {
-   199 case INTERVAL_setup:
-   200
195 sound_beep(100,400); 201 sound_beep(100,400);
196 if(integration_time > 0x0001 ) integration_time--; 202 if(integration_time > 0x0001 ) integration_time--;
197   203  
198 set_timer0(0); // vynulovani pocitadel, kdyz uzivatel sahne na tlacitka 204 set_timer0(0); // vynulovani pocitadel, kdyz uzivatel sahne na tlacitka
199 time_overflow_count=0; 205 time_overflow_count=0;
200 set_timer1(0); 206 set_timer1(0);
201 overflow_count=0; 207 overflow_count=0;
-   208 break;
202 } 209 }
203 if(time_setup==TRUE) -  
204 { -  
205 } 210 }
206 } 211 }
207 212
208 if(!input(S5)) // prepnuti na nastavovani casu 213 if(!input(S5)) // prepnuti na nastavovani casu
209 { 214 {
210 delay_ms(20); 215 delay_ms(20);
211 if(!input(S5)) 216 if(!input(S5))
212 { 217 {
213 button_press=true; 218 button_press=true;
214 sound_beep(100,800); 219 sound_beep(100,800);
215 voltage_setup=FALSE; 220 setup_mode=INTERVAL_setup;
216 time_setup=TRUE; -  
217 } 221 }
218 } 222 }
219 223
220 if(!input(S6)) // prepnuti na nastavovani napeti 224 if(!input(S6)) // prepnuti na nastavovani napeti
221 { 225 {
222 delay_ms(20); 226 delay_ms(20);
223 if(!input(S6)) 227 if(!input(S6))
224 { 228 {
225 button_press=true; 229 button_press=true;
226 sound_beep(100,800); 230 sound_beep(100,800);
227 voltage_setup=TRUE; -  
228 time_setup=FALSE; 231 setup_mode=TRESHOLD_setup;
229 } 232 }
230 } 233 }
231 } 234 }
232 235
233 if ( input(S1) && input(S2) && input(S3) && input(S4) && input(S5) && input(S6)) // detekce pustenych tlacitek 236 if ( input(S1) && input(S2) && input(S3) && input(S4) && input(S5) && input(S6)) // detekce pustenych tlacitek