Line 17... |
Line 17... |
17 |
|
17 |
|
18 |
#include "main.h" |
18 |
#include "main.h" |
19 |
|
19 |
|
20 |
#case |
20 |
#case |
21 |
|
21 |
|
22 |
#define S105AN input(PIN_A0) // Kuchyne hlavni svetlo severni vypinac |
22 |
#define S105AN input(PIN_A0) // A Kuchyne hlavni svetlo severni vypinac |
23 |
#define R110NJU input(PIN_A1) // Roleta koupelna |
23 |
#define R110NJU input(PIN_A1) // B Roleta koupelna |
24 |
#define R110NJD input(PIN_A2) |
24 |
#define R110NJD input(PIN_A2) // C |
25 |
#define S104AZ input(PIN_A3) // Svetlo laborator vypinac u dveri |
25 |
#define S104AZ input(PIN_A3) // D Svetlo laborator vypinac u dveri |
26 |
#define R104VZU input(PIN_A4) // Roleta laborator vychod |
26 |
#define R104JZU input(PIN_A4) // E Roleta laborator jih |
27 |
#define R104VZD input(PIN_A5) |
27 |
#define R104JZD input(PIN_A5) // F |
28 |
#define R104JZU input(PIN_A6) // Roleta laborator jih |
28 |
#define R104VZU input(PIN_A6) // G Roleta laborator vychod |
29 |
#define R104JZD input(PIN_A7) |
29 |
#define R104VZD input(PIN_A7) // H |
30 |
|
30 |
|
31 |
#define S103JZ input(PIN_B0) // A Svetlo loznice jih vypinac u dveri |
31 |
#define S103JZ input(PIN_B0) // A Svetlo loznice jih vypinac u dveri |
32 |
#define S103JN input(PIN_B1) // B -"- vypinac KAKL |
32 |
#define S103JN input(PIN_B1) // B -"- vypinac KAKL |
33 |
#define S103JV input(PIN_B2) // C -"- vypinac mama |
33 |
#define S103JV input(PIN_B2) // C -"- vypinac mama |
34 |
#define R103VZU input(PIN_B3) // D Roleta loznice vypinac u dveri |
34 |
#define R103VZU input(PIN_B3) // D Roleta loznice vypinac u dveri |
35 |
#define R103VZD input(PIN_B4) // E |
35 |
#define R103VZD input(PIN_B4) // E |
36 |
//#define S input(PIN_B5) // F |
36 |
#define S110AZ input(PIN_B5) // F Vypinac koupelna sprcha |
37 |
#define S107AN input(PIN_B6) // G Svetlo satna vypinac do chodby |
37 |
#define S107AN input(PIN_B6) // G Svetlo satna vypinac do chodby |
38 |
#define S109AJ input(PIN_B7) // H Svetlo tech. mistnost vypinac do chodby |
38 |
#define S109AJ input(PIN_B7) // H Svetlo tech. mistnost vypinac do chodby |
39 |
|
39 |
|
40 |
#define OS101A PIN_C0 // Spinac svetla v bunecce prizemi |
40 |
#define OS101A PIN_C0 // Spinac svetla v bunecce prizemi |
41 |
#define OS105V PIN_C1 // Svetlo nad chlebarnou |
41 |
#define OS105V PIN_C1 // Svetlo nad chlebarnou |
Line 46... |
Line 46... |
46 |
//#define PIN_C5 31765 |
46 |
//#define PIN_C5 31765 |
47 |
|
47 |
|
48 |
//#define PIN_C6 31766 //TX |
48 |
//#define PIN_C6 31766 //TX |
49 |
//#define PIN_C7 31767 //RX |
49 |
//#define PIN_C7 31767 //RX |
50 |
|
50 |
|
51 |
#define S101AN input(PIN_D0) // Hlavni svetlo bunecka severni vypinac bliz u dveri |
51 |
#define S101AN input(PIN_D0) // A Svetlo bunecka severni vypinac bliz u dveri |
52 |
#define S101AJ input(PIN_D1) // Hlavni svetlo bunecka jizni vypinac |
52 |
#define S101AJ input(PIN_D1) // B Svetlo bunecka jizni vypinac |
53 |
#define S105VV input(PIN_D2) // Vypinac nad chlebarnou |
53 |
#define S105VV input(PIN_D2) // C Vypinac nad chlebarnou |
54 |
#define S105NZ input(PIN_D3) // Svetlo kuchyne sever vypinac zapadni |
54 |
#define S105NZ input(PIN_D3) // D Svetlo kuchyne sever vypinac zapadni |
55 |
#define S105ZZ input(PIN_D4) // Svetlo kuchyne zapad vypinac zapadni |
55 |
#define S105ZZ input(PIN_D4) // E Svetlo kuchyne zapad vypinac zapadni |
56 |
#define S102AN input(PIN_D5) // Vypinac chodba dole u schodu |
56 |
#define S102AN input(PIN_D5) // F Svetlo chodba vypinac dole u vchodu |
57 |
#define S110AN input(PIN_D6) // Vypinac koupelna sever |
57 |
#define S110AV input(PIN_D6) // G Vypinac koupelna u dveri |
58 |
#define S108AV input(PIN_D7) // Dvere do spajzu |
58 |
#define S100AV input(PIN_D7) // H Svetlo prujezd venkovni vypinac bunecka sever dal od dveri |
59 |
|
59 |
|
60 |
//#define S input(PIN_E0) // A |
60 |
#define R105JJD input(PIN_E0) // A Roleta kuchyn u varice vypinac u dveri do trucovnu u kliky |
61 |
//#define S input(PIN_E1) // B |
61 |
#define R105JJU input(PIN_E1) // B |
62 |
//#define S input(PIN_E2) // C |
62 |
#define R103VND input(PIN_E2) // C Roleta loznice vypinac KAKL |
63 |
//#define S input(PIN_E3) // D |
63 |
#define R103VNU input(PIN_E3) // D |
64 |
//#define S input(PIN_E4) // E |
64 |
#define R103VVD input(PIN_E4) // E Roleta loznice vypinac mama |
65 |
//#define S input(PIN_E5) // F |
65 |
#define R103VVU input(PIN_E5) // F |
66 |
//#define S input(PIN_E6) // G |
66 |
#define S105AV input(PIN_E6) // G Kuchyne hlavni svetlo vypinac u dveri na terasu |
67 |
//#define S input(PIN_E7) // H |
67 |
#define S102AJ input(PIN_E7) // H Svetlo chodba vypinac dole u schodu |
68 |
|
68 |
|
69 |
#define S106AV input(PIN_F0) // A Hlavni svetlo trucovna vypinac u dveri do kuchyne |
69 |
#define S106AV input(PIN_F0) // A Hlavni svetlo trucovna vypinac u dveri do kuchyne |
70 |
#define R106JVD input(PIN_F1) // B Roleta trucovna jih vypinac u dveri do kuchyne |
70 |
#define R106JVD input(PIN_F1) // B Roleta trucovna jih vypinac u dveri do kuchyne |
71 |
#define R106JVU input(PIN_F2) // C |
71 |
#define R106JVU input(PIN_F2) // C |
72 |
#define R106ZVD input(PIN_F3) // D Roleta trucovna zapad vypinac u dveri do kuchyne |
72 |
#define R106ZVD input(PIN_F3) // D Roleta trucovna zapad vypinac u dveri do kuchyne |
73 |
#define R106ZVU input(PIN_F4) // E |
73 |
#define R106ZVU input(PIN_F4) // E |
74 |
#define S107AJ input(PIN_F5) // F Svetlo satna vypinac u trucovny |
74 |
#define S106AN input(PIN_F5) // F Hlavni svetlo trucovna vypinac u dveri do satny |
75 |
#define S109AN input(PIN_F6) // G Svetlo technologicka mistnost vypinac do prujezdu |
75 |
#define S107AJ input(PIN_F6) // G Svetlo satna vypinac u trucovny |
76 |
#define S106AN input(PIN_F7) // H Hlavni svetlo trucovna vypinac u dveri do satny |
76 |
#define S109AN input(PIN_F7) // H Svetlo technologicka mistnost vypinac u dveri do prujezdu |
77 |
|
- |
|
78 |
|
77 |
|
79 |
/* |
78 |
/* |
80 |
#define PIN_G0 31792 |
79 |
#define PIN_G0 31792 |
81 |
#define PIN_G1 31793 |
80 |
#define PIN_G1 31793 |
82 |
#define PIN_G2 31794 |
81 |
#define PIN_G2 31794 |
Line 108... |
Line 107... |
108 |
|
107 |
|
109 |
#define ON(port) output_low(port); |
108 |
#define ON(port) output_low(port); |
110 |
#define OFF(port) output_high(port); |
109 |
#define OFF(port) output_high(port); |
111 |
|
110 |
|
112 |
int1 s105AN; // Predchozi stav vypinacu |
111 |
int1 s105AN; // Predchozi stav vypinacu |
- |
|
112 |
int1 s105AV; |
113 |
int1 r110NJU; |
113 |
int1 r110NJU; |
114 |
int1 r110NJD; |
114 |
int1 r110NJD; |
115 |
int1 s104AZ; |
115 |
int1 s104AZ; |
116 |
int1 r104VZU; |
116 |
int1 r104VZU; |
117 |
int1 r104VZD; |
117 |
int1 r104VZD; |
Line 128... |
Line 128... |
128 |
int1 s101AJ; |
128 |
int1 s101AJ; |
129 |
int1 s105VV; |
129 |
int1 s105VV; |
130 |
int1 s105NZ; |
130 |
int1 s105NZ; |
131 |
int1 s105ZZ; |
131 |
int1 s105ZZ; |
132 |
int1 s102AN; |
132 |
int1 s102AN; |
- |
|
133 |
int1 s102AJ; |
133 |
int1 s110AN; |
134 |
int1 s110AV; |
134 |
int1 s108AV; |
135 |
int1 s110AZ; |
135 |
int1 r106JVU; |
136 |
int1 r106JVU; |
136 |
int1 r106JVD; |
137 |
int1 r106JVD; |
137 |
int1 r106ZVU; |
138 |
int1 r106ZVU; |
138 |
int1 r106ZVD; |
139 |
int1 r106ZVD; |
139 |
int1 s106AV; |
140 |
int1 s106AV; |
140 |
int1 s106AN; |
141 |
int1 s106AN; |
141 |
int1 s107AJ; |
142 |
int1 s107AJ; |
142 |
int1 s109AN; |
143 |
int1 s109AN; |
- |
|
144 |
int1 s100AV; |
- |
|
145 |
int1 r105JJD; |
- |
|
146 |
int1 r105JJU; |
- |
|
147 |
int1 r103VND; |
- |
|
148 |
int1 r103VNU; |
- |
|
149 |
int1 r103VVD; |
- |
|
150 |
int1 r103VVU; |
143 |
|
151 |
|
144 |
#define send(s) \ |
152 |
#define send(s) \ |
145 |
{\ |
153 |
{\ |
146 |
printf("%s\r\n",#s);\ |
154 |
printf("%s\r\n",#s);\ |
147 |
output_toggle(LED1);\ |
155 |
output_toggle(LED1);\ |
Line 178... |
Line 186... |
178 |
} |
186 |
} |
179 |
} |
187 |
} |
180 |
|
188 |
|
181 |
|
189 |
|
182 |
s105AN=S105AN; // Poznamenej vychozi stav vypinacu |
190 |
s105AN=S105AN; // Poznamenej vychozi stav vypinacu |
- |
|
191 |
s105AV=S105AV; |
183 |
r110NJU=R110NJU; |
192 |
r110NJU=R110NJU; |
184 |
r110NJD=R110NJD; |
193 |
r110NJD=R110NJD; |
185 |
s104AZ=S104AZ; |
194 |
s104AZ=S104AZ; |
186 |
r104VZU=R104VZU; |
195 |
r104VZU=R104VZU; |
187 |
r104VZD=R104VZD; |
196 |
r104VZD=R104VZD; |
Line 198... |
Line 207... |
198 |
s101AJ=S101AJ; |
207 |
s101AJ=S101AJ; |
199 |
s105VV=S105VV; |
208 |
s105VV=S105VV; |
200 |
s105NZ=S105NZ; |
209 |
s105NZ=S105NZ; |
201 |
s105ZZ=S105ZZ; |
210 |
s105ZZ=S105ZZ; |
202 |
s102AN=S102AN; |
211 |
s102AN=S102AN; |
- |
|
212 |
s102AJ=S102AJ; |
203 |
s110AN=S110AN; |
213 |
s110AV=S110AV; |
204 |
s108AV=S108AV; |
214 |
s110AZ=S110AZ; |
205 |
r106JVU=R106JVU; |
215 |
r106JVU=R106JVU; |
206 |
r106JVD=R106JVD; |
216 |
r106JVD=R106JVD; |
207 |
r106ZVU=R106ZVU; |
217 |
r106ZVU=R106ZVU; |
208 |
r106ZVD=R106ZVD; |
218 |
r106ZVD=R106ZVD; |
209 |
s106AV=S106AV; |
219 |
s106AV=S106AV; |
210 |
s106AN=S106AN; |
220 |
s106AN=S106AN; |
211 |
s107AJ=S107AJ; |
221 |
s107AJ=S107AJ; |
212 |
s109AN=S109AN; |
222 |
s109AN=S109AN; |
- |
|
223 |
s100AV=S100AV; |
- |
|
224 |
r105JJD=R105JJD; |
- |
|
225 |
r105JJU=R105JJU; |
- |
|
226 |
r103VND=R103VND; |
- |
|
227 |
r103VNU=R103VNU; |
- |
|
228 |
r103VVD=R103VVD; |
- |
|
229 |
r103VVU=R103VVU; |
213 |
|
230 |
|
214 |
while(TRUE) |
231 |
while(TRUE) |
215 |
{ |
232 |
{ |
216 |
if(s105AN!=S105AN) {s105AN=S105AN; send(S15A);} |
233 |
if(s105AN!=S105AN) {s105AN=S105AN; send(S15A);} |
- |
|
234 |
if(s105AV!=S105AV) {s105AV=S105AV; send(S15A);} |
217 |
if(r110NJU!=R110NJU) {r110NJU=R110NJU; send(R1aNU);} |
235 |
if(r110NJU!=R110NJU) {r110NJU=R110NJU; send(R1aNU);} |
218 |
if(r110NJD!=R110NJD) {r110NJD=R110NJD; send(R1aND);} |
236 |
if(r110NJD!=R110NJD) {r110NJD=R110NJD; send(R1aND);} |
219 |
|
237 |
|
220 |
if(!S105VV) {output_low(OS105V);} else {output_high(OS105V);} |
238 |
if(!S105VV) {output_low(OS105V);} else {output_high(OS105V);} |
221 |
if(!S105NZ) {output_low(OS105N);} else {output_high(OS105N);} |
239 |
if(!S105NZ) {output_low(OS105N);} else {output_high(OS105N);} |
Line 230... |
Line 248... |
230 |
if(s103JZ!=S103JZ) {s103JZ=S103JZ; send(S13A);} |
248 |
if(s103JZ!=S103JZ) {s103JZ=S103JZ; send(S13A);} |
231 |
if(s103JN!=S103JN) {s103JN=S103JN; send(S13A);} |
249 |
if(s103JN!=S103JN) {s103JN=S103JN; send(S13A);} |
232 |
if(s103JV!=S103JV) {s103JV=S103JV; send(S13A);} |
250 |
if(s103JV!=S103JV) {s103JV=S103JV; send(S13A);} |
233 |
if(r103VZU!=R103VZU) {r103VZU=R103VZU; send(R13VU);} |
251 |
if(r103VZU!=R103VZU) {r103VZU=R103VZU; send(R13VU);} |
234 |
if(r103VZD!=R103VZD) {r103VZD=R103VZD; send(R13VD);} |
252 |
if(r103VZD!=R103VZD) {r103VZD=R103VZD; send(R13VD);} |
- |
|
253 |
if(r103VND!=R103VND) {r103VND=R103VND; send(R13VD);} |
- |
|
254 |
if(r103VNU!=R103VNU) {r103VNU=R103VNU; send(R13VU);} |
- |
|
255 |
if(r103VVD!=R103VVD) {r103VVD=R103VVD; send(R13VD);} |
- |
|
256 |
if(r103VVU!=R103VVU) {r103VVU=R103VVU; send(R13VU);} |
235 |
|
257 |
|
236 |
if(s107AN!=S107AN) {s107AN=S107AN; send(S17A);} |
258 |
if(s107AN!=S107AN) {s107AN=S107AN; send(S17A);} |
237 |
if(s109AJ!=S109AJ) {s109AJ=S109AJ; send(S19A);} |
259 |
if(s109AJ!=S109AJ) {s109AJ=S109AJ; send(S19A);} |
238 |
|
260 |
|
239 |
if(s101AN!=S101AN) {s101AN=S101AN; output_toggle(OS101A); delay_ms(100);} |
261 |
if(s101AN!=S101AN) {s101AN=S101AN; output_toggle(OS101A); delay_ms(100);} |
240 |
if(s101AJ!=S101AJ) {s101AJ=S101AJ; output_toggle(OS101A); delay_ms(100);} |
262 |
if(s101AJ!=S101AJ) {s101AJ=S101AJ; output_toggle(OS101A); delay_ms(100);} |
241 |
|
263 |
|
242 |
if(s102AN!=S102AN) {s102AN=S102AN; send(S12A);} |
264 |
if(s102AN!=S102AN) {s102AN=S102AN; send(S12A);} |
- |
|
265 |
if(s102AJ!=S102AJ) {s102AJ=S102AJ; send(S12A);} |
243 |
if(s110AN!=S110AN) {s110AN=S110AN; send(S1aA);} |
266 |
if(s110AV!=S110AV) {s110AV=S110AV; send(S1aA);} |
244 |
if(s108AV!=S108AV) {s108AV=S108AV; send(S18A);} |
267 |
if(s110AZ!=S110AZ) {s110AZ=S110AZ; send(S1aB);} |
245 |
|
268 |
|
246 |
if(r106JVU!=R106JVU) {r106JVU=R106JVU; send(R16JU);} |
269 |
if(r106JVU!=R106JVU) {r106JVU=R106JVU; send(R16JU);} |
247 |
if(r106JVD!=R106JVD) {r106JVD=R106JVD; send(R16JD);} |
270 |
if(r106JVD!=R106JVD) {r106JVD=R106JVD; send(R16JD);} |
248 |
if(r106ZVU!=R106ZVU) {r106ZVU=R106ZVU; send(R16ZU);} |
271 |
if(r106ZVU!=R106ZVU) {r106ZVU=R106ZVU; send(R16ZU);} |
249 |
if(r106ZVD!=R106ZVD) {r106ZVD=R106ZVD; send(R16ZD);} |
272 |
if(r106ZVD!=R106ZVD) {r106ZVD=R106ZVD; send(R16ZD);} |
250 |
if(s106AV!=S106AV) {s106AV=S106AV; send(S16A);} |
273 |
if(s106AV!=S106AV) {s106AV=S106AV; send(S16A);} |
251 |
if(s106AN!=S106AN) {s106AN=S106AN; send(S16A);} |
274 |
if(s106AN!=S106AN) {s106AN=S106AN; send(S16A);} |
252 |
if(s107AJ!=S107AJ) {s107AJ=S107AJ; send(S17A);} |
275 |
if(s107AJ!=S107AJ) {s107AJ=S107AJ; send(S17A);} |
253 |
if(s109AN!=S109AN) {s109AN=S109AN; send(S19A);} |
276 |
if(s109AN!=S109AN) {s109AN=S109AN; send(S19A);} |
- |
|
277 |
if(s100AV!=S100AV) {s100AV=S100AV; send(S10A);} |
- |
|
278 |
|
- |
|
279 |
if(r105JJD!=R105JJD) {r105JJD=R105JJD; send(R15JD);} |
- |
|
280 |
if(r105JJU!=R105JJU) {r105JJU=R105JJU; send(R15JU);} |
254 |
|
281 |
|
255 |
if(get_timer0()>65000) {output_toggle(LED2); set_timer0(0);} |
282 |
if(get_timer0()>65000) {output_toggle(LED2); set_timer0(0);} |
256 |
} |
283 |
} |
257 |
} |
284 |
} |