Line 1... |
Line 1... |
1 |
#include "main.h" |
1 |
#include "main.h" |
2 |
|
2 |
|
3 |
#case |
3 |
#case |
4 |
|
4 |
|
5 |
#define S105A1 input(PIN_A0) |
5 |
#define S105AN input(PIN_A0) // Kuchyne hlavni svetlo severni vypinac |
6 |
#define R110A1U input(PIN_A1) |
6 |
#define R110NJU input(PIN_A1) // Roleta koupelna |
7 |
#define R110A1D input(PIN_A2) |
7 |
#define R110NJD input(PIN_A2) |
8 |
#define S104A1 input(PIN_A3) |
8 |
#define S104AZ input(PIN_A3) // Svetlo laborator vypinac u dveri |
9 |
#define R104A1U input(PIN_A4) |
9 |
#define R104VZU input(PIN_A4) // Roleta laborator vychod |
10 |
#define R104A1D input(PIN_A5) |
10 |
#define R104VZD input(PIN_A5) |
11 |
#define R104B1U input(PIN_A6) |
11 |
#define R104JZU input(PIN_A6) // Roleta laborator jih |
12 |
#define R104B1D input(PIN_A7) |
12 |
#define R104JZD input(PIN_A7) |
13 |
|
13 |
|
14 |
#define S103A1 input(PIN_B0) |
14 |
#define S103JZ input(PIN_B0) // Svetlo loznice jih vypinac u dveri |
15 |
#define S103A2 input(PIN_B1) |
15 |
#define S103JN input(PIN_B1) // -"- vypinac KAKL |
16 |
#define S103A3 input(PIN_B2) |
16 |
#define S103JV input(PIN_B2) // -"- vypinac mama |
17 |
#define R103A1U input(PIN_B3) |
17 |
#define R103VZU input(PIN_B3) // Roleta loznice vypinac u dveri |
18 |
#define R103A1D input(PIN_B4) |
18 |
#define R103VZD input(PIN_B4) |
19 |
#define S106A1 input(PIN_B5) |
19 |
#define S106AV input(PIN_B5) // Hlavni svetlo trucovna vypinac u dveri do kuchyne |
20 |
#define S107A2 input(PIN_B6) |
20 |
#define S107AN input(PIN_B6) // Svetlo satna vypinac do chodby |
21 |
#define S109A1 input(PIN_B7) |
21 |
#define S109AJ input(PIN_B7) // Svetlo tech. mistnost vypinac do chodby |
22 |
|
22 |
|
23 |
#define OS101 PIN_C0 |
23 |
#define OS101A PIN_C0 // Spinac svetla v bunecce prizemi |
24 |
#define OS105B PIN_C1 |
24 |
#define OS105V PIN_C1 // Svetlo nad chlebarnou |
25 |
#define OS105C PIN_C2 |
25 |
#define OS105N PIN_C2 // Severni svetlo kuchyne |
26 |
|
26 |
|
27 |
//#define PIN_C3 31763 |
27 |
//#define PIN_C3 31763 |
28 |
//#define PIN_C4 31764 |
28 |
//#define PIN_C4 31764 |
29 |
//#define PIN_C5 31765 |
29 |
//#define PIN_C5 31765 |
30 |
|
30 |
|
31 |
//#define PIN_C6 31766 //TX |
31 |
//#define PIN_C6 31766 //TX |
32 |
//#define PIN_C7 31767 //RX |
32 |
//#define PIN_C7 31767 //RX |
33 |
|
33 |
|
34 |
#define S101A1 input(PIN_D0) |
34 |
#define S101AN input(PIN_D0) // Hlavni svetlo bunecka severni vypinac bliz u dveri |
35 |
#define S101A2 input(PIN_D1) |
35 |
#define S101AJ input(PIN_D1) // Hlavni svetlo bunecka jizni vypinac |
36 |
#define S105B1 input(PIN_D2) |
36 |
#define S105VV input(PIN_D2) // Vypinac nad chlebarnou |
37 |
#define S105C1 input(PIN_D3) |
37 |
#define S105NZ input(PIN_D3) // Svetlo kuchyne sever vypinac zapadni |
38 |
#define S105D1 input(PIN_D4) |
38 |
#define S105ZZ input(PIN_D4) // Svetlo kuchyne zapad vypinac zapadni |
39 |
#define S102A1 input(PIN_D5) |
39 |
#define S102AN input(PIN_D5) // Vypinac chodba dole u schodu |
40 |
#define S110A1 input(PIN_D6) |
40 |
#define S110AN input(PIN_D6) // Vypinac koupelna sever |
41 |
#define S108A1 input(PIN_D7) |
41 |
#define S108AV input(PIN_D7) // Dvere do spajzu |
42 |
|
42 |
|
43 |
/* |
43 |
/* |
44 |
#define PIN_E0 31776 |
44 |
#define PIN_E0 31776 |
45 |
#define PIN_E1 31777 |
45 |
#define PIN_E1 31777 |
46 |
#define PIN_E2 31778 |
46 |
#define PIN_E2 31778 |
Line 86... |
Line 86... |
86 |
*/ |
86 |
*/ |
87 |
|
87 |
|
88 |
#define LED1 PIN_J7 |
88 |
#define LED1 PIN_J7 |
89 |
#define LED2 PIN_J6 |
89 |
#define LED2 PIN_J6 |
90 |
|
90 |
|
91 |
int1 s105A1; |
91 |
int1 s105AN; // Predchozi stav vypinacu |
92 |
int1 r110A1U; |
92 |
int1 r110NJU; |
93 |
int1 r110A1D; |
93 |
int1 r110NJD; |
94 |
int1 s104A1; |
94 |
int1 s104AZ; |
95 |
int1 r104A1U; |
95 |
int1 r104VZU; |
96 |
int1 r104A1D; |
96 |
int1 r104VZD; |
97 |
int1 r104B1U; |
97 |
int1 r104JZU; |
98 |
int1 r104B1D; |
98 |
int1 r104JZD; |
99 |
|
- |
|
100 |
int1 s103A1; |
99 |
int1 s103JZ; |
101 |
int1 s103A2; |
100 |
int1 s103JN; |
102 |
int1 s103A3; |
101 |
int1 s103JV; |
103 |
int1 r103A1U; |
102 |
int1 r103VZU; |
104 |
int1 r103A1D; |
103 |
int1 r103VZD; |
105 |
int1 s106A1; |
104 |
int1 s106AV; |
106 |
int1 s107A2; |
105 |
int1 s107AN; |
107 |
int1 s109A1; |
106 |
int1 s109AJ; |
108 |
|
- |
|
109 |
int1 s101A1; |
107 |
int1 s101AN; |
110 |
int1 s101A2; |
108 |
int1 s101AJ; |
- |
|
109 |
int1 s105VV; |
- |
|
110 |
int1 s105NZ; |
111 |
int1 s105D1; |
111 |
int1 s105ZZ; |
112 |
int1 s102A1; |
112 |
int1 s102AN; |
113 |
int1 s110A1; |
113 |
int1 s110AN; |
114 |
int1 s108A1; |
114 |
int1 s108AV; |
115 |
|
115 |
|
116 |
#define send(s) \ |
116 |
#define send(s) \ |
117 |
{\ |
117 |
{\ |
118 |
printf("%s\r\n",#s);\ |
118 |
printf("%s\r\n",#s);\ |
119 |
output_toggle(LED1);\ |
119 |
output_toggle(LED1);\ |
Line 134... |
Line 134... |
134 |
setup_timer_3(T3_DISABLED|T3_DIV_BY_1); |
134 |
setup_timer_3(T3_DISABLED|T3_DIV_BY_1); |
135 |
setup_ccp1(CCP_OFF); |
135 |
setup_ccp1(CCP_OFF); |
136 |
setup_comparator(NC_NC_NC_NC); |
136 |
setup_comparator(NC_NC_NC_NC); |
137 |
setup_vref(FALSE); |
137 |
setup_vref(FALSE); |
138 |
|
138 |
|
139 |
s105A1=S105A1; |
139 |
s105AN=S105AN; // Poznamenej vychozi stav vypinacu |
140 |
r110A1U=R110A1U; |
140 |
r110NJU=R110NJU; |
141 |
r110A1D=R110A1D; |
141 |
r110NJD=R110NJD; |
142 |
s104A1=S104A1; |
142 |
s104AZ=S104AZ; |
143 |
r104A1U=R104A1U; |
143 |
r104VZU=R104VZU; |
144 |
r104A1D=R104A1D; |
144 |
r104VZD=R104VZD; |
145 |
r104B1U=R104B1U; |
145 |
r104JZU=R104JZU; |
146 |
r104B1D=R104B1D; |
146 |
r104JZD=R104JZD; |
147 |
|
- |
|
148 |
s103A1=S103A1; |
147 |
s103JZ=S103JZ; |
149 |
s103A2=S103A2; |
148 |
s103JN=S103JN; |
150 |
s103A3=S103A3; |
149 |
s103JV=S103JV; |
151 |
r103A1U=R103A1U; |
150 |
r103VZU=R103VZU; |
152 |
r103A1D=R103A1D; |
151 |
r103VZD=R103VZD; |
153 |
s106A1=S106A1; |
152 |
s106AV=S106AV; |
154 |
s107A2=S107A2; |
153 |
s107AN=S107AN; |
155 |
s109A1=S109A1; |
154 |
s109AJ=S109AJ; |
156 |
|
155 |
s101AN=S101AN; |
157 |
s101A1=S101A1; |
156 |
s101AJ=S101AJ; |
- |
|
157 |
s105VV=S105VV; |
158 |
s101A2=S101A2; |
158 |
s105NZ=S105NZ; |
159 |
s105D1=S105D1; |
159 |
s105ZZ=S105ZZ; |
160 |
s102A1=S102A1; |
160 |
s102AN=S102AN; |
161 |
s110A1=S110A1; |
161 |
s110AN=S110AN; |
162 |
s108A1=S108A1; |
162 |
s108AV=S108AV; |
163 |
|
163 |
|
164 |
while(TRUE) |
164 |
while(TRUE) |
165 |
{ |
165 |
{ |
166 |
if(s105A1!=S105A1) {s105A1=S105A1; send(S15A);} |
166 |
if(s105AN!=S105AN) {s105AN=S105AN; send(S15A);} |
167 |
if(r110A1U!=R110A1U) {r110A1U=R110A1U; send(R1aAU);} |
167 |
if(r110NJU!=R110NJU) {r110NJU=R110NJU; send(R1aNU);} |
168 |
if(r110A1D!=R110A1D) {r110A1D=R110A1D; send(R1aAD);} |
168 |
if(r110NJD!=R110NJD) {r110NJD=R110NJD; send(R1aND);} |
- |
|
169 |
|
169 |
if(!S105B1) {output_low(OS105B);} else {output_high(OS105B);} |
170 |
if(!S105VV) {output_low(OS105V);} else {output_high(OS105V);} |
170 |
if(!S105C1) {output_low(OS105C);} else {output_high(OS105C);} |
171 |
if(!S105NZ) {output_low(OS105N);} else {output_high(OS105N);} |
171 |
if(s105D1!=S105D1) {s105D1=S105D1; send(S15D);} |
172 |
if(s105ZZ!=S105ZZ) {s105ZZ=S105ZZ; send(S15Z);} |
172 |
|
173 |
|
173 |
if(s104A1!=S104A1) {s104A1=S104A1; send(S14A);} |
174 |
if(s104AZ!=S104AZ) {s104AZ=S104AZ; send(S14A);} |
174 |
if(r104A1U!=R104A1U) {r104A1U=R104A1U; send(R14AU);} |
175 |
if(r104VZU!=R104VZU) {r104VZU=R104VZU; send(R14VU);} |
175 |
if(r104A1D!=R104A1D) {r104A1D=R104A1D; send(R14AD);} |
176 |
if(r104VZD!=R104VZD) {r104VZD=R104VZD; send(R14VD);} |
176 |
if(r104B1U!=R104B1U) {r104B1U=R104B1U; send(R14BU);} |
177 |
if(r104JZU!=R104JZU) {r104JZU=R104JZU; send(R14JU);} |
177 |
if(r104B1D!=R104B1D) {r104B1D=R104B1D; send(R14BD);} |
178 |
if(r104JZD!=R104JZD) {r104JZD=R104JZD; send(R14JD);} |
178 |
|
179 |
|
179 |
if(s103A1!=S103A1) {s103A1=S103A1; send(S13A);} |
180 |
if(s103JZ!=S103JZ) {s103JZ=S103JZ; send(S13A);} |
180 |
if(s103A2!=S103A2) {s103A2=S103A2; send(S13A);} |
181 |
if(s103JN!=S103JN) {s103JN=S103JN; send(S13A);} |
181 |
if(s103A3!=S103A3) {s103A3=S103A3; send(S13A);} |
182 |
if(s103JV!=S103JV) {s103JV=S103JV; send(S13A);} |
182 |
if(r103A1U!=R103A1U) {r103A1U=R103A1U; send(R13AU);} |
183 |
if(r103VZU!=R103VZU) {r103VZU=R103VZU; send(R13VU);} |
183 |
if(r103A1D!=R103A1D) {r103A1D=R103A1D; send(R13AD);} |
184 |
if(r103VZD!=R103VZD) {r103VZD=R103VZD; send(R13VD);} |
184 |
|
185 |
|
185 |
if(s106A1!=S106A1) {s106A1=S106A1; send(S16A);} |
186 |
if(s106AV!=S106AV) {s106AV=S106AV; send(S16A);} |
186 |
if(s107A2!=S107A2) {s107A2=S107A2; send(S17A);} |
187 |
if(s107AN!=S107AN) {s107AN=S107AN; send(S17A);} |
187 |
if(s109A1!=S109A1) {s109A1=S109A1; send(S19A);} |
188 |
if(s109AJ!=S109AJ) {s109AJ=S109AJ; send(S19A);} |
188 |
|
189 |
|
189 |
if(s101A1!=S101A1) {s101A1=S101A1; send(S11A);} |
190 |
if(s101AN!=S101AN) {s101AN=S101AN; send(S11A);} |
190 |
if(s101A2!=S101A2) {s101A2=S101A2; send(S11A);} |
191 |
if(s101AJ!=S101AJ) {s101AJ=S101AJ; send(S11A);} |
191 |
|
192 |
|
192 |
if(s102A1!=S102A1) {s102A1=S102A1; send(S12A);} |
193 |
if(s102AN!=S102AN) {s102AN=S102AN; send(S12A);} |
193 |
if(s110A1!=S110A1) {s110A1=S110A1; send(S1aA);} |
194 |
if(s110AN!=S110AN) {s110AN=S110AN; send(S1aA);} |
194 |
if(s108A1!=S108A1) {s108A1=S108A1; send(S18A);} |
195 |
if(s108AV!=S108AV) {s108AV=S108AV; send(S18A);} |
195 |
} |
196 |
} |
196 |
} |
197 |
} |