Line 5... |
Line 5... |
5 |
|
5 |
|
6 |
<Roleta/Svetlo><#patro><#mistnost><Nord/Jih/Vychod/Zapad/A/B><Up/Down> |
6 |
<Roleta/Svetlo><#patro><#mistnost><Nord/Jih/Vychod/Zapad/A/B><Up/Down> |
7 |
R2aNU - roleta, 2. n.p., mistnost 10, sever, nahoru |
7 |
R2aNU - roleta, 2. n.p., mistnost 10, sever, nahoru |
8 |
S12A - svetlo, 1. n.p., mistnost 2, prostredni |
8 |
S12A - svetlo, 1. n.p., mistnost 2, prostredni |
9 |
|
9 |
|
- |
|
10 |
Rozmisteni desek: |
- |
|
11 |
|
- |
|
12 |
[CAN] |
- |
|
13 |
[IN J] [IN D] |
- |
|
14 |
[OUT A] [CPU] |
- |
|
15 |
|
- |
|
16 |
[OUT F] [OUT B] [OUT E] |
- |
|
17 |
|
10 |
*/ |
18 |
*/ |
11 |
#include "main.h" |
19 |
#include "main.h" |
12 |
|
20 |
|
13 |
#case |
21 |
#case |
14 |
|
22 |
|
Line 42... |
Line 50... |
42 |
//#define PIN_C4 31764 |
50 |
//#define PIN_C4 31764 |
43 |
//#define PIN_C5 31765 |
51 |
//#define PIN_C5 31765 |
44 |
//#define PIN_C6 31766 //TX |
52 |
//#define PIN_C6 31766 //TX |
45 |
//#define PIN_C7 31767 //RX |
53 |
//#define PIN_C7 31767 //RX |
46 |
|
54 |
|
47 |
//#define O... PIN_F0 // t1 |
55 |
#define OR104VU PIN_F0 // t1 Roleta laborator vychod |
48 |
//#define O... PIN_F1 // t2 |
56 |
#define OR104VD PIN_F1 // t2 |
49 |
//#define O... PIN_F2 // t3 |
57 |
//#define O... PIN_F2 // t3 |
50 |
//#define O... PIN_F3 // t4 |
58 |
//#define O... PIN_F3 // t4 |
51 |
//#define O... PIN_F4 // t5 |
59 |
//#define O... PIN_F4 // t5 |
52 |
//#define O... PIN_F5 // t6 |
60 |
//#define O... PIN_F5 // t6 |
53 |
//#define O... PIN_F6 // t7 |
61 |
//#define O... PIN_F6 // t7 |
54 |
//#define O... PIN_F7 // t8 |
62 |
//#define O... PIN_F7 // t8 |
55 |
|
63 |
|
56 |
//#define I.... input(PIN_D0) // A |
64 |
//#define I.... input(PIN_D0) // A |
57 |
#define IS201AZ input(PIN_D1) // B Vypinac chodba 2.n.p. zapad u Kaklika |
65 |
#define IS201AZ input(PIN_D1) // B Vypinac chodba 2.n.p. zapad u Kaklika |
58 |
#define IS207AJ input(PIN_D2) // C Vypinac klubovna |
66 |
#define IS207AJ input(PIN_D2) // C Vypinac klubovna |
59 |
#define IR207VU input(PIN_D3) // D Vypinac roleta klubovna nahoru |
67 |
#define IR207VD input(PIN_D3) // D Vypinac roleta klubovna dolu |
60 |
#define IR207VD input(PIN_D4) // E Vypinac roleta klubovna dolu |
68 |
#define IR207VU input(PIN_D4) // E Vypinac roleta klubovna nahoru |
61 |
#define IS201AV input(PIN_D5) // F Vypinac chodba 2.n.p. vychod |
69 |
#define IS201AV input(PIN_D5) // F Vypinac chodba 2.n.p. vychod |
62 |
#define IS209AJ input(PIN_D6) // G Vypinac koupelna Zizala |
70 |
#define IS209AJ input(PIN_D6) // G Vypinac koupelna Zizala |
63 |
#define IS203AJ input(PIN_D7) // H Vypinac koupelna Kaklik |
71 |
#define IS203AJ input(PIN_D7) // H Vypinac koupelna Kaklik |
64 |
|
72 |
|
65 |
#define OS102A PIN_E0 // t1 Svetlo chodba |
73 |
#define OS102A PIN_E0 // t1 Svetlo chodba |
Line 200... |
Line 208... |
200 |
tr110N=0; |
208 |
tr110N=0; |
201 |
tr104V=0; |
209 |
tr104V=0; |
202 |
tr104J=0; |
210 |
tr104J=0; |
203 |
tr207V=0; |
211 |
tr207V=0; |
204 |
|
212 |
|
205 |
output_high(LED1); // Indikace restartu (pockame na nabiti kondenzatoru ve vstupnich obvodech) |
- |
|
206 |
delay_ms(100); |
213 |
{ |
207 |
output_low(LED1); |
214 |
int n; |
208 |
delay_ms(30); |
215 |
|
209 |
output_high(LED1); |
216 |
for(n=0;n<10;n++) |
210 |
restart_wdt(); |
217 |
{ |
- |
|
218 |
output_low(LED1); // Indikace restartu (pockame na nabiti kondenzatoru ve vstupnich obvodech) |
211 |
delay_ms(100); |
219 |
delay_ms(100); |
212 |
output_low(LED1); |
220 |
output_high(LED1); |
213 |
delay_ms(30); |
221 |
delay_ms(100); |
214 |
output_high(LED1); |
222 |
restart_wdt(); |
215 |
restart_wdt(); |
223 |
} |
- |
|
224 |
} |
216 |
|
225 |
|
217 |
s201AV=IS201AV; // Precteme vychozi stav vypinacu |
226 |
s201AV=IS201AV; // Precteme vychozi stav vypinacu |
218 |
s201AZ=IS201AZ; |
227 |
s201AZ=IS201AZ; |
219 |
s207AJ=IS207AJ; |
228 |
s207AJ=IS207AJ; |
220 |
s203AJ=IS203AJ; |
229 |
s203AJ=IS203AJ; |
221 |
s209AJ=IS209AJ; |
230 |
s209AJ=IS209AJ; |
222 |
r207VU=IR207VU; |
231 |
r207VU=IR207VU; |
223 |
r207VD=IR207VD; |
232 |
r207VD=IR207VD; |
- |
|
233 |
|
- |
|
234 |
CREN=0; CREN=1; // Reinitialise USART |
224 |
|
235 |
|
225 |
enable_interrupts(INT_TIMER0); |
236 |
enable_interrupts(INT_TIMER0); |
226 |
enable_interrupts(GLOBAL); |
237 |
enable_interrupts(GLOBAL); |
227 |
|
- |
|
228 |
CREN=0; CREN=1; // Reinitialise USART |
- |
|
229 |
|
238 |
|
230 |
while(TRUE) |
239 |
while(TRUE) |
231 |
{ |
240 |
{ |
232 |
|
241 |
|
233 |
if(kbhit()) // Chce po nas nekdo neco? |
242 |
if(kbhit()) // Chce po nas nekdo neco? |
234 |
{ |
243 |
{ |
Line 355... |
Line 364... |
355 |
if(s201AZ!=IS201AZ) {s201AZ=IS201AZ; output_toggle(OS102A); delay_ms(100); continue;} |
364 |
if(s201AZ!=IS201AZ) {s201AZ=IS201AZ; output_toggle(OS102A); delay_ms(100); continue;} |
356 |
if(s207AJ!=IS207AJ) {s207AJ=IS207AJ; output_toggle(OS207A); delay_ms(100); continue;} |
365 |
if(s207AJ!=IS207AJ) {s207AJ=IS207AJ; output_toggle(OS207A); delay_ms(100); continue;} |
357 |
if(s203AJ!=IS203AJ) {s203AJ=IS203AJ; output_toggle(OS203A); delay_ms(100); continue;} |
366 |
if(s203AJ!=IS203AJ) {s203AJ=IS203AJ; output_toggle(OS203A); delay_ms(100); continue;} |
358 |
if(s209AJ!=IS209AJ) {s209AJ=IS209AJ; output_toggle(OS209A); delay_ms(100); continue;} |
367 |
if(s209AJ!=IS209AJ) {s209AJ=IS209AJ; output_toggle(OS209A); delay_ms(100); continue;} |
359 |
|
368 |
|
360 |
if(r207VU!=IR207VU) {r207VU=IR207VU; up(&r207V,&tr207V); delay_ms(100); continue;} |
369 |
if(r207VU!=IR207VU) {r207VU=IR207VU; up(&r207V,&tr207V); delay_ms(100); continue;} |
361 |
if(r207VD!=IR207VD) {r207VD=IR207VD; down(&r207V,&tr207V); delay_ms(100); continue;} |
370 |
if(r207VD!=IR207VD) {r207VD=IR207VD; down(&r207V,&tr207V); delay_ms(100); continue;} |
362 |
|
371 |
|
363 |
restart_wdt(); |
372 |
restart_wdt(); |
364 |
} |
373 |
} |
365 |
} |
374 |
} |