Line 24... |
Line 24... |
24 |
#use fast_io(E) |
24 |
#use fast_io(E) |
25 |
#use fast_io(F) |
25 |
#use fast_io(F) |
26 |
#use fast_io(D) |
26 |
#use fast_io(D) |
27 |
#use fast_io(J) |
27 |
#use fast_io(J) |
28 |
|
28 |
|
- |
|
29 |
#define T_REVERS 5 // 5*256 ms = 1,25 s; pred prepnutim rele (zastaveni motoru a vybiti kondenzatoru) |
29 |
#define REVERS 3 // 3*256 ms = 0,75 s |
30 |
#define T_START 1 // 256 ms; po prepnuti rele do sepnuti triaku |
30 |
#define GO 117 // 117*256 ms = 30 s |
31 |
#define T_GO 117 // 117*256 ms = 30 s; max. beh rolety |
31 |
#define GO_ZALUZIE 6 // cca 1,5 s |
32 |
#define T_GO_ZALUZIE 6 // cca 1,5 s; beh zaluzie (pouze na preklopeni lamel) |
32 |
#define RECEIVE 10 // cca 2,6 s |
33 |
#define T_RECEIVE 10 // cca 2,6 s |
33 |
#define ZAKMIT 2000 // pocet pruchodu hlavni smyckou pred opetovnou detekci prepnuti vypinace |
34 |
#define ZAKMIT 2000 // pocet pruchodu hlavni smyckou pred opetovnou detekci prepnuti vypinace |
34 |
|
35 |
|
- |
|
36 |
#define OR106Z PIN_A0 // t1 Zaluzie trucovna zapad |
35 |
#define OR110NU PIN_A0 // t1 Zaluzie koupelna dole |
37 |
#define OR110N PIN_A1 // t2 Zaluzie koupelna dole sever |
- |
|
38 |
#define OR104V PIN_A2 // t3 Roleta lab vychod |
- |
|
39 |
#define OR104J PIN_A3 // t4 Roleta lab jih |
36 |
#define OR110ND PIN_A1 // t2 |
40 |
#define OR103V PIN_A4 // t5 Roleta loznice |
- |
|
41 |
#define OR202J PIN_A5 // t6 Roleta Kaklik |
- |
|
42 |
#define OR204Z PIN_A6 // t7 Roleta radiomistnost |
37 |
#define OR207VU PIN_A2 // t3 Roleta klubovna |
43 |
#define OR207V PIN_A7 // t8 Roleta klubovna |
- |
|
44 |
|
- |
|
45 |
#define OR208V PIN_F0 // t1 Roleta Zizala vychod |
- |
|
46 |
#define OR208J PIN_F1 // t2 Roleta Zizala jih |
- |
|
47 |
//??? #define OR107 PIN_F2 // t3 |
38 |
#define OR207VD PIN_A3 // t4 |
48 |
//??? #define OR107 PIN_F3 // t4 |
39 |
#define OR103VU PIN_A4 // t5 Roleta loznice |
49 |
#define OR201Z PIN_F4 // t5 Roleta chodba nahore |
40 |
#define OR103VD PIN_A5 // t6 |
50 |
#define OR205N PIN_F5 // t6 Roleta puda |
41 |
#define OR104JU PIN_A6 // t7 Roleta laborator jih |
51 |
//??? #define OR105 PIN_F6 // t7 Roleta kuchyn |
42 |
#define OR104JD PIN_A7 // t8 |
52 |
//#define O... PIN_F7 // t8 |
- |
|
53 |
|
43 |
|
54 |
|
44 |
#define OS103J PIN_B0 // t1 Svetla loznice |
55 |
#define OS103J PIN_B0 // t1 Svetla loznice |
45 |
#define OS105Z PIN_B1 // t2 Svetlo kuchyn nad lavici |
56 |
#define OS105Z PIN_B1 // t2 Svetlo kuchyn nad lavici |
46 |
#define OS110N PIN_B2 // t3 Svetlo koupelna dole zachod a sprhca |
57 |
#define OS110N PIN_B2 // t3 Svetlo koupelna dole zachod a sprhca |
47 |
#define OS106A PIN_B3 // t4 Svetlo trucovna stred |
58 |
#define OS106A PIN_B3 // t4 Svetlo trucovna stred |
Line 62... |
Line 73... |
62 |
#define OS207A PIN_E2 // t3 Svetlo klubovna |
73 |
#define OS207A PIN_E2 // t3 Svetlo klubovna |
63 |
#define OS104A PIN_E3 // t4 Svetlo laborator |
74 |
#define OS104A PIN_E3 // t4 Svetlo laborator |
64 |
#define OS202A PIN_E4 // t5 Svetlo Kaklik stred |
75 |
#define OS202A PIN_E4 // t5 Svetlo Kaklik stred |
65 |
#define OS209A PIN_E5 // t6 Svetlo Zizala koupelna |
76 |
#define OS209A PIN_E5 // t6 Svetlo Zizala koupelna |
66 |
#define OS203A PIN_E6 // t7 Svetlo Kaklik koupelna |
77 |
#define OS203A PIN_E6 // t7 Svetlo Kaklik koupelna |
67 |
//#define O... PIN_E7 // t8 |
- |
|
68 |
|
- |
|
69 |
#define OR104VU PIN_F0 // t1 Roleta laborator vychod |
- |
|
70 |
#define OR104VD PIN_F1 // t2 |
- |
|
71 |
#define OR202JU PIN_F2 // t3 Roleta Kaklik |
- |
|
72 |
#define OR202JD PIN_F3 // t4 |
- |
|
73 |
#define OR204ZU PIN_F4 // t5 Roleta radiomistnost |
78 |
#define RE PIN_E7 // t8 Rele pro rizeni smeru rolet |
74 |
#define OR204ZD PIN_F5 // t6 |
- |
|
75 |
//#define O... PIN_F6 // t7 |
- |
|
76 |
//#define O... PIN_F7 // t8 |
- |
|
77 |
|
79 |
|
78 |
//#define I.... input(PIN_D0) // A |
80 |
//#define I.... input(PIN_D0) // A |
79 |
#define IS201AZ input(PIN_D1) // B Vypinac chodba 2.n.p. zapad u Kaklika |
81 |
#define IS201AZ input(PIN_D1) // B Vypinac chodba 2.n.p. zapad u Kaklika |
80 |
#define IS207AJ input(PIN_D2) // C Vypinac klubovna |
82 |
#define IS207AJ input(PIN_D2) // C Vypinac klubovna |
81 |
#define IR207VD input(PIN_D3) // D Vypinac roleta klubovna dolu |
83 |
#define IR207VD input(PIN_D3) // D Vypinac roleta klubovna dolu |
Line 114... |
Line 116... |
114 |
#define LED2 PIN_C1 |
116 |
#define LED2 PIN_C1 |
115 |
|
117 |
|
116 |
#define ON(port) output_low(port); |
118 |
#define ON(port) output_low(port); |
117 |
#define OFF(port) output_high(port); |
119 |
#define OFF(port) output_high(port); |
118 |
|
120 |
|
- |
|
121 |
typedef enum {RUN, STOP} roleta_state; |
- |
|
122 |
roleta_state rol[18]; // Stavy rolet |
- |
|
123 |
#define R103V 0 |
- |
|
124 |
#define R110N 1 |
- |
|
125 |
#define R104V 2 |
- |
|
126 |
#define R104J 3 |
- |
|
127 |
#define R207V 4 |
- |
|
128 |
#define R202J 5 |
- |
|
129 |
#define R204Z 6 |
- |
|
130 |
|
119 |
typedef enum {GO_UP, GO_DOWN, REVERS_UP, REVERS_DOWN, STOP} state; |
131 |
typedef enum {UP, DOWN, REVERS_UP, REVERS_DOWN, RUN_UP, RUN_DOWN} relay_state; |
- |
|
132 |
relay_state relay; // Stavy rele |
120 |
|
133 |
|
121 |
state r103V, r110N, r104V, r104J, r207V, r202J, r204Z; // Stavy rolet |
134 |
int8 timer_run; // Bezpecnostni casovac behu rolety |
- |
|
135 |
int8 timer_run_zaluzie; // Casovac zaluzie na preklopeni lamel |
- |
|
136 |
int8 timer_revers; // Prodleva na vybiti kondenzatoru pa zastaveni rolety pred prepnutim rele |
122 |
int8 tr103V, tr110N, tr104V, tr104J, tr207V, tr202J, tr204Z; // Casovace rolet |
137 |
int8 timer_start; // Prodleva na prepnuti rele pred startem rolety |
123 |
int8 timer; // Casovac komunikace |
138 |
int8 timer; // Casovac komunikace |
124 |
|
139 |
|
125 |
#int_TIMER0 |
140 |
#int_TIMER0 |
126 |
void TIMER0_isr(void) |
141 |
void TIMER0_isr(void) |
127 |
{ |
142 |
{ |
128 |
if(tr103V>0) tr103V--; |
- |
|
129 |
if(tr110N>0) tr110N--; |
- |
|
130 |
if(tr104V>0) tr104V--; |
- |
|
131 |
if(tr104J>0) tr104J--; |
- |
|
132 |
if(tr207V>0) tr207V--; |
- |
|
133 |
if(tr202J>0) tr202J--; |
- |
|
134 |
if(tr204Z>0) tr204Z--; |
- |
|
135 |
if(timer>0) timer--; |
143 |
if(timer>0) timer--; |
- |
|
144 |
if(timer_run>0) timer_run--; |
- |
|
145 |
if(timer_revers>0) timer_revers--; |
- |
|
146 |
if(timer_start>0) timer_start--; |
- |
|
147 |
if(timer_run_zaluzie>0) timer_run_zaluzie--; |
136 |
output_toggle(LED2); |
148 |
output_toggle(LED2); |
137 |
} |
149 |
} |
138 |
|
150 |
|
- |
|
151 |
void stop_all() // Zastav vsechny rolety |
- |
|
152 |
{ |
- |
|
153 |
int8 n; |
- |
|
154 |
|
- |
|
155 |
for(n=0; n<18; n++) rol[n]=STOP; |
- |
|
156 |
output_a(0xFF); |
- |
|
157 |
output_f(0xFF); |
- |
|
158 |
} |
- |
|
159 |
|
- |
|
160 |
void run_all() // Spust rolety |
- |
|
161 |
{ |
- |
|
162 |
if (rol[R103V]==RUN) ON(OR103V); |
- |
|
163 |
if (rol[R110N]==RUN) ON(OR110N); |
- |
|
164 |
if (rol[R104V]==RUN) ON(OR104V); |
- |
|
165 |
if (rol[R104J]==RUN) ON(OR104J); |
- |
|
166 |
if (rol[R207V]==RUN) ON(OR207V); |
- |
|
167 |
if (rol[R202J]==RUN) ON(OR202J); |
- |
|
168 |
if (rol[R204Z]==RUN) ON(OR204Z); |
- |
|
169 |
} |
- |
|
170 |
|
- |
|
171 |
/* |
139 |
void up(state *status, int8 *timer) // Zmena stavu rolety smer nahoru |
172 |
void up(state *status, int8 *timer) // Zmena stavu rolety smer nahoru |
140 |
{ |
173 |
{ |
141 |
switch (*status) |
174 |
switch (*status) |
142 |
{ |
175 |
{ |
143 |
case STOP: |
176 |
case STOP: |
Line 197... |
Line 230... |
197 |
OFF(OR##x##D); \ |
230 |
OFF(OR##x##D); \ |
198 |
if(tr##x==0) {r##x=GO_DOWN; tr##x=GO;} \ |
231 |
if(tr##x==0) {r##x=GO_DOWN; tr##x=GO;} \ |
199 |
break; \ |
232 |
break; \ |
200 |
} \ |
233 |
} \ |
201 |
} |
234 |
} |
- |
|
235 |
*/ |
202 |
|
236 |
|
203 |
void main() |
237 |
void main() |
204 |
{ |
238 |
{ |
205 |
char buf[10]; // Buffer pro prijem prikazu |
239 |
char buf[10]; // Buffer pro prijem prikazu |
206 |
unsigned int16 zakmity=0; // Osetreni zakmitu vypinacu |
240 |
unsigned int16 zakmity=0; // Osetreni zakmitu vypinacu |
Line 227... |
Line 261... |
227 |
|
261 |
|
228 |
output_a(0xFF); // Vsechno zhasni a zastav |
262 |
output_a(0xFF); // Vsechno zhasni a zastav |
229 |
output_b(0xFF); |
263 |
output_b(0xFF); |
230 |
output_f(0xFF); |
264 |
output_f(0xFF); |
231 |
output_e(0xFF); |
265 |
output_e(0xFF); |
- |
|
266 |
stop_all(); |
232 |
|
267 |
|
233 |
r103V=STOP; // Rolety jsou zastaveny |
268 |
timer_run=0; // Zastav vsechny casovace |
234 |
r110N=STOP; |
- |
|
235 |
r104V=STOP; |
- |
|
236 |
r104J=STOP; |
- |
|
237 |
r207V=STOP; |
- |
|
238 |
r202J=STOP; |
- |
|
239 |
r204Z=STOP; |
- |
|
240 |
tr103V=0; |
269 |
timer=0; |
241 |
tr110N=0; |
270 |
timer_revers=0; |
242 |
tr104V=0; |
271 |
timer_start=0; |
243 |
tr104J=0; |
272 |
timer_run_zaluzie=0; |
244 |
tr207V=0; |
273 |
zakmity=0; |
245 |
tr202J=0; |
274 |
|
246 |
tr204Z=0; |
275 |
relay=RUN_UP; // Rele je na zacatku vypnuto |
247 |
|
276 |
|
248 |
{ |
277 |
{ |
249 |
int n; |
278 |
int n; |
250 |
|
279 |
|
251 |
for(n=0;n<10;n++) |
280 |
for(n=0;n<10;n++) |
Line 286... |
Line 315... |
286 |
{ |
315 |
{ |
287 |
buf[0]=getc(); |
316 |
buf[0]=getc(); |
288 |
if((buf[0]=='S')||(buf[0]=='R')) // Jinym znakem nesmi zacinat prikaz |
317 |
if((buf[0]=='S')||(buf[0]=='R')) // Jinym znakem nesmi zacinat prikaz |
289 |
{ |
318 |
{ |
290 |
int8 n=0; // Ukazatel do prijimaciho bufferu |
319 |
int8 n=0; // Ukazatel do prijimaciho bufferu |
291 |
timer=RECEIVE; // Timeout pro prijem znaku |
320 |
timer=T_RECEIVE; // Timeout pro prijem znaku |
292 |
|
321 |
|
293 |
do |
322 |
do |
294 |
{ |
323 |
{ |
295 |
if(kbhit()) // Je dalsi znak? |
324 |
if(kbhit()) // Je dalsi znak? |
296 |
{ |
325 |
{ |
Line 350... |
Line 379... |
350 |
if(buf[1]=='1') |
379 |
if(buf[1]=='1') |
351 |
{ |
380 |
{ |
352 |
switch(buf[2]) |
381 |
switch(buf[2]) |
353 |
{ |
382 |
{ |
354 |
case '3': |
383 |
case '3': |
355 |
if(buf[4]=='U') {up(&r103V,&tr103V);} else {down(&r103V,&tr103V);} |
384 |
//!!! if(buf[4]=='U') {up(&r103V,&tr103V);} else {down(&r103V,&tr103V);} |
356 |
break; |
385 |
break; |
357 |
case '4': |
386 |
case '4': |
358 |
if(buf[3]=='V') if((buf[4]=='U')) {up(&r104V,&tr104V);} else {down(&r104V,&tr104V);} |
387 |
//!!! if(buf[3]=='V') if((buf[4]=='U')) |
359 |
if(buf[3]=='J') if((buf[4]=='U')) {up(&r104J,&tr104J);} else {down(&r104J,&tr104J);} |
388 |
//!!! if(buf[3]=='J') if((buf[4]=='U')) {up(&r104J,&tr104J);} else {down(&r104J,&tr104J);} |
360 |
break; |
389 |
break; |
361 |
case 'a': |
390 |
case 'a': |
362 |
if((buf[4]=='U')) {up(&r110N,&tr110N);} else {down(&r110N,&tr110N);} |
391 |
//!!! if((buf[4]=='U')) {up(&r110N,&tr110N);} else {down(&r110N,&tr110N);} |
363 |
break; |
392 |
break; |
364 |
} |
393 |
} |
365 |
} |
394 |
} |
366 |
} |
395 |
} |
367 |
|
396 |
|
368 |
} |
397 |
} |
369 |
} |
398 |
} |
370 |
} |
399 |
} |
371 |
|
400 |
|
372 |
run(103V); // Rizeni rolet za behu |
- |
|
373 |
// run(104V); |
- |
|
374 |
run(104J); |
- |
|
375 |
run(207V); |
- |
|
376 |
run(202J); |
- |
|
377 |
run(204Z); |
- |
|
378 |
|
- |
|
379 |
switch(r110N) // Zaluzie ma specielni rizeni |
401 |
//!!! switch(r110N) // Zaluzie ma specielni rizeni |
380 |
{ |
- |
|
381 |
case STOP: |
- |
|
382 |
OFF(OR110NU); |
- |
|
383 |
OFF(OR110ND); |
- |
|
384 |
break; |
- |
|
385 |
case GO_UP: |
- |
|
386 |
OFF(OR110ND); |
- |
|
387 |
ON(OR110NU); |
- |
|
388 |
if(tr110N==0) {r110N=STOP;} |
- |
|
389 |
break; |
- |
|
390 |
case GO_DOWN: |
- |
|
391 |
OFF(OR110NU); |
- |
|
392 |
ON(OR110ND); |
- |
|
393 |
if(tr110N==0) {r110N=STOP;} |
- |
|
394 |
break; |
- |
|
395 |
case REVERS_UP: |
- |
|
396 |
OFF(OR110NU); |
- |
|
397 |
OFF(OR110ND); |
- |
|
398 |
if(tr110N==0) {r110N=GO_UP; tr110N=GO_ZALUZIE;} // Nahoru pouze kratce na otevreni zaluzie |
- |
|
399 |
break; |
- |
|
400 |
case REVERS_DOWN: |
- |
|
401 |
OFF(OR110NU); |
- |
|
402 |
OFF(OR110ND); |
- |
|
403 |
if(tr110N==0) {r110N=GO_DOWN; tr110N=GO_ZALUZIE;} // Dolu take kratce pouze na zaklopeni zaluzie |
- |
|
404 |
break; |
- |
|
405 |
} |
- |
|
406 |
|
402 |
|
407 |
// mistni vypinace z 2. n.p. |
403 |
// mistni vypinace z 2. n.p. |
408 |
if (0==zakmity) |
404 |
if (0==zakmity) |
409 |
{ |
405 |
{ |
410 |
if(s201AV!=IS201AV) {s201AV=IS201AV; output_toggle(OS102A); zakmity=ZAKMIT;} |
406 |
if(s201AV!=IS201AV) {s201AV=IS201AV; output_toggle(OS102A); zakmity=ZAKMIT;} |
Line 414... |
Line 410... |
414 |
if(s209AJ!=IS209AJ) {s209AJ=IS209AJ; output_toggle(OS209A); zakmity=ZAKMIT;} |
410 |
if(s209AJ!=IS209AJ) {s209AJ=IS209AJ; output_toggle(OS209A); zakmity=ZAKMIT;} |
415 |
if(s205A!=IS205A) {s205A=IS205A; output_toggle(OS205A); zakmity=ZAKMIT;} |
411 |
if(s205A!=IS205A) {s205A=IS205A; output_toggle(OS205A); zakmity=ZAKMIT;} |
416 |
if(s204AJ!=IS204AJ) {s204AJ=IS204AJ; output_toggle(OS204A); zakmity=ZAKMIT;} |
412 |
if(s204AJ!=IS204AJ) {s204AJ=IS204AJ; output_toggle(OS204A); zakmity=ZAKMIT;} |
417 |
if(s202AN!=IS202AN) {s202AN=IS202AN; output_toggle(OS202A); zakmity=ZAKMIT;} |
413 |
if(s202AN!=IS202AN) {s202AN=IS202AN; output_toggle(OS202A); zakmity=ZAKMIT;} |
418 |
|
414 |
|
419 |
if(r207VU!=IR207VU) {r207VU=IR207VU; up(&r207V,&tr207V); zakmity=ZAKMIT;} |
415 |
if(r207VU!=IR207VU) // Zmenil se stav vypinace |
- |
|
416 |
{ |
420 |
if(r207VD!=IR207VD) {r207VD=IR207VD; down(&r207V,&tr207V); zakmity=ZAKMIT;} |
417 |
r207VU=IR207VU; // Poznamenej soucasny stav vypinace |
- |
|
418 |
|
- |
|
419 |
if (rol[R207V]==RUN) |
- |
|
420 |
{ |
- |
|
421 |
rol[R207V]=STOP; // Roleta jela, tak zastav |
- |
|
422 |
OFF(OR207V); |
- |
|
423 |
} |
- |
|
424 |
else |
- |
|
425 |
{ |
- |
|
426 |
if ((relay==DOWN)||(relay==RUN_DOWN)) // Rele je prepnuto na druhou stranu! |
- |
|
427 |
{ |
- |
|
428 |
relay=REVERS_UP; // Reverzuj |
- |
|
429 |
timer_revers=T_REVERS; |
- |
|
430 |
stop_all(); // Vsechno zastav |
- |
|
431 |
} |
- |
|
432 |
if (relay==RUN_UP) |
- |
|
433 |
{ |
- |
|
434 |
ON(OR207V); // Jede se spravnym smerem, tak jenom pust roletu |
- |
|
435 |
} |
- |
|
436 |
rol[R104V]=RUN; // Poznamenej, ze se jede, a natahni bezpecnostni casovac |
- |
|
437 |
timer_run=T_GO; |
- |
|
438 |
} |
- |
|
439 |
zakmity=ZAKMIT; |
- |
|
440 |
} |
- |
|
441 |
if(r207VD!=IR207VD) |
- |
|
442 |
{ |
- |
|
443 |
r207VD=IR207VD; |
- |
|
444 |
|
- |
|
445 |
if (rol[R207V]==RUN) |
- |
|
446 |
{ |
- |
|
447 |
rol[R207V]=STOP; |
- |
|
448 |
OFF(OR207V); |
- |
|
449 |
} |
- |
|
450 |
else |
- |
|
451 |
{ |
- |
|
452 |
if ((relay==UP)||(relay==RUN_UP)) |
- |
|
453 |
{ |
- |
|
454 |
relay=REVERS_DOWN; |
- |
|
455 |
timer_revers=T_REVERS; |
- |
|
456 |
stop_all(); |
- |
|
457 |
} |
- |
|
458 |
if (relay==RUN_DOWN) |
- |
|
459 |
{ |
- |
|
460 |
ON(OR207V); |
- |
|
461 |
} |
- |
|
462 |
rol[R104V]=RUN; |
- |
|
463 |
timer_run=T_GO; |
- |
|
464 |
} |
- |
|
465 |
zakmity=ZAKMIT; |
- |
|
466 |
} |
- |
|
467 |
|
421 |
if(r202NU!=IR202NU) {r202NU=IR202NU; up(&r202J,&tr202J); zakmity=ZAKMIT;} |
468 |
//!!! if(r202NU!=IR202NU) {r202NU=IR202NU; up(&r202J,&tr202J); zakmity=ZAKMIT;} |
422 |
if(r202ND!=IR202ND) {r202ND=IR202ND; down(&r202J,&tr202J); zakmity=ZAKMIT;} |
469 |
//!!! if(r202ND!=IR202ND) {r202ND=IR202ND; down(&r202J,&tr202J); zakmity=ZAKMIT;} |
423 |
if(r204ZU!=IR204ZU) {r204ZU=IR204ZU; up(&r204Z,&tr204Z); zakmity=ZAKMIT;} |
470 |
//!!! if(r204ZU!=IR204ZU) {r204ZU=IR204ZU; up(&r204Z,&tr204Z); zakmity=ZAKMIT;} |
424 |
if(r204ZD!=IR204ZD) {r204ZD=IR204ZD; down(&r204Z,&tr204Z); zakmity=ZAKMIT;} |
471 |
//!!! if(r204ZD!=IR204ZD) {r204ZD=IR204ZD; down(&r204Z,&tr204Z); zakmity=ZAKMIT;} |
425 |
} |
472 |
} |
426 |
else zakmity--; |
473 |
else zakmity--; |
427 |
} |
474 |
} |
- |
|
475 |
|
- |
|
476 |
switch (relay) |
- |
|
477 |
{ |
- |
|
478 |
case UP: |
- |
|
479 |
if (timer_start==0) // Rele prepnuto, muzeme sepnout triaky |
- |
|
480 |
{ |
- |
|
481 |
relay=RUN_UP; // Zmen stav na "jede se" |
- |
|
482 |
run_all(); // Sepni triaky u rolet, ktere maji jet |
- |
|
483 |
timer_run=T_GO; // Natahni bezpecnostni casovac |
- |
|
484 |
} |
- |
|
485 |
break; |
- |
|
486 |
|
- |
|
487 |
case DOWN: |
- |
|
488 |
if (timer_start==0) // Rele prepnuto, muzeme sepnout triaky |
- |
|
489 |
{ |
- |
|
490 |
relay=RUN_DOWN; // Zmen stav na "jede se" |
- |
|
491 |
run_all(); // Sepni triaky u rolet, ktere maji jet |
- |
|
492 |
timer_run=T_GO; // Natahni bezpecnostni casovac |
- |
|
493 |
} |
- |
|
494 |
break; |
- |
|
495 |
|
- |
|
496 |
case RUN_UP: |
- |
|
497 |
if (timer_run==0) // Vyprsel bezpecnostni casovac |
- |
|
498 |
{ |
- |
|
499 |
stop_all(); // Vsechno zastav |
- |
|
500 |
} |
- |
|
501 |
break; |
- |
|
502 |
|
- |
|
503 |
case RUN_DOWN: |
- |
|
504 |
if (timer_run==0) // Vyprsel bezpecnostni casovac |
- |
|
505 |
{ |
- |
|
506 |
relay=REVERS_UP; // Vsechno zastav a reverzuj pro prepnuti rele do klidove polohy bez energizace civky |
- |
|
507 |
stop_all(); |
- |
|
508 |
timer_revers=T_REVERS; |
- |
|
509 |
} |
- |
|
510 |
break; |
- |
|
511 |
|
- |
|
512 |
case REVERS_UP: |
- |
|
513 |
if (timer_revers==0) // Uz se snad vybil kondenzator, muzeme reverzovat |
- |
|
514 |
{ |
- |
|
515 |
relay=UP; // Prepni rele |
- |
|
516 |
OFF(RE); |
- |
|
517 |
timer_start=T_START; // Pockej na prepnuti rele |
- |
|
518 |
} |
- |
|
519 |
break; |
- |
|
520 |
|
- |
|
521 |
case REVERS_DOWN: |
- |
|
522 |
if (timer_revers==0) // Uz se snad vybil kondenzator, muzeme reverzovat |
- |
|
523 |
{ |
- |
|
524 |
relay=DOWN; // Prepni rele |
- |
|
525 |
ON(RE); |
- |
|
526 |
timer_start=T_START; // Pockej na prepnuti rele |
- |
|
527 |
} |
- |
|
528 |
break; |
- |
|
529 |
} |
428 |
} |
530 |
} |