{HEADER END}
{BLAME START}

MLAB

[/] [Designs/] [dum/] [SW/] [2patra/] [1np/] [main.c] -

Blame information for rev 1750

Číslo řádky Revize Autor Line
1 1746 kakl #include "main.h"
2 1746 kakl
3 1746 kakl #case
4 1746 kakl
5 1748 kakl #define S105AN input(PIN_A0) // Kuchyne hlavni svetlo severni vypinac
6 1748 kakl #define R110NJU input(PIN_A1) // Roleta koupelna
7 1748 kakl #define R110NJD input(PIN_A2)
8 1748 kakl #define S104AZ input(PIN_A3) // Svetlo laborator vypinac u dveri
9 1748 kakl #define R104VZU input(PIN_A4) // Roleta laborator vychod
10 1748 kakl #define R104VZD input(PIN_A5)
11 1748 kakl #define R104JZU input(PIN_A6) // Roleta laborator jih
12 1748 kakl #define R104JZD input(PIN_A7)
13 1746 kakl
14 1748 kakl #define S103JZ input(PIN_B0) // Svetlo loznice jih vypinac u dveri
15 1748 kakl #define S103JN input(PIN_B1) // -"- vypinac KAKL
16 1748 kakl #define S103JV input(PIN_B2) // -"- vypinac mama
17 1748 kakl #define R103VZU input(PIN_B3) // Roleta loznice vypinac u dveri
18 1748 kakl #define R103VZD input(PIN_B4)
19 1748 kakl #define S106AV input(PIN_B5) // Hlavni svetlo trucovna vypinac u dveri do kuchyne
20 1748 kakl #define S107AN input(PIN_B6) // Svetlo satna vypinac do chodby
21 1748 kakl #define S109AJ input(PIN_B7) // Svetlo tech. mistnost vypinac do chodby
22 1746 kakl
23 1748 kakl #define OS101A PIN_C0 // Spinac svetla v bunecce prizemi
24 1748 kakl #define OS105V PIN_C1 // Svetlo nad chlebarnou
25 1748 kakl #define OS105N PIN_C2 // Severni svetlo kuchyne
26 1746 kakl
27 1746 kakl //#define PIN_C3 31763
28 1746 kakl //#define PIN_C4 31764
29 1746 kakl //#define PIN_C5 31765
30 1746 kakl
31 1746 kakl //#define PIN_C6 31766 //TX
32 1746 kakl //#define PIN_C7 31767 //RX
33 1746 kakl
34 1748 kakl #define S101AN input(PIN_D0) // Hlavni svetlo bunecka severni vypinac bliz u dveri
35 1748 kakl #define S101AJ input(PIN_D1) // Hlavni svetlo bunecka jizni vypinac
36 1748 kakl #define S105VV input(PIN_D2) // Vypinac nad chlebarnou
37 1748 kakl #define S105NZ input(PIN_D3) // Svetlo kuchyne sever vypinac zapadni
38 1748 kakl #define S105ZZ input(PIN_D4) // Svetlo kuchyne zapad vypinac zapadni
39 1748 kakl #define S102AN input(PIN_D5) // Vypinac chodba dole u schodu
40 1748 kakl #define S110AN input(PIN_D6) // Vypinac koupelna sever
41 1748 kakl #define S108AV input(PIN_D7) // Dvere do spajzu
42 1746 kakl
43 1746 kakl /*
44 1746 kakl #define PIN_E0 31776
45 1746 kakl #define PIN_E1 31777
46 1746 kakl #define PIN_E2 31778
47 1746 kakl #define PIN_E3 31779
48 1746 kakl #define PIN_E4 31780
49 1746 kakl #define PIN_E5 31781
50 1746 kakl #define PIN_E6 31782
51 1746 kakl #define PIN_E7 31783
52 1746 kakl
53 1746 kakl #define PIN_F0 31784
54 1746 kakl #define PIN_F1 31785
55 1746 kakl #define PIN_F2 31786
56 1746 kakl #define PIN_F3 31787
57 1746 kakl #define PIN_F4 31788
58 1746 kakl #define PIN_F5 31789
59 1746 kakl #define PIN_F6 31790
60 1746 kakl #define PIN_F7 31791
61 1746 kakl
62 1746 kakl #define PIN_G0 31792
63 1746 kakl #define PIN_G1 31793
64 1746 kakl #define PIN_G2 31794
65 1746 kakl #define PIN_G3 31795
66 1746 kakl #define PIN_G4 31796
67 1746 kakl #define PIN_G5 31797
68 1746 kakl
69 1746 kakl #define PIN_H0 31800
70 1746 kakl #define PIN_H1 31801
71 1746 kakl #define PIN_H2 31802
72 1746 kakl #define PIN_H3 31803
73 1746 kakl #define PIN_H4 31804
74 1746 kakl #define PIN_H5 31805
75 1746 kakl #define PIN_H6 31806
76 1746 kakl #define PIN_H7 31807
77 1746 kakl
78 1746 kakl #define PIN_J0 31808
79 1746 kakl #define PIN_J1 31809
80 1746 kakl #define PIN_J2 31810
81 1746 kakl #define PIN_J3 31811
82 1746 kakl #define PIN_J4 31812
83 1746 kakl #define PIN_J5 31813
84 1746 kakl #define PIN_J6 31814
85 1746 kakl #define PIN_J7 31815
86 1746 kakl */
87 1746 kakl
88 1746 kakl #define LED1 PIN_J7
89 1746 kakl #define LED2 PIN_J6
90 1746 kakl
91 1750 kakl #define ON(port) output_low(port);
92 1750 kakl #define OFF(port) output_high(port);
93 1750 kakl
94 1748 kakl int1 s105AN; // Predchozi stav vypinacu
95 1748 kakl int1 r110NJU;
96 1748 kakl int1 r110NJD;
97 1748 kakl int1 s104AZ;
98 1748 kakl int1 r104VZU;
99 1748 kakl int1 r104VZD;
100 1748 kakl int1 r104JZU;
101 1748 kakl int1 r104JZD;
102 1748 kakl int1 s103JZ;
103 1748 kakl int1 s103JN;
104 1748 kakl int1 s103JV;
105 1748 kakl int1 r103VZU;
106 1748 kakl int1 r103VZD;
107 1748 kakl int1 s106AV;
108 1748 kakl int1 s107AN;
109 1748 kakl int1 s109AJ;
110 1748 kakl int1 s101AN;
111 1748 kakl int1 s101AJ;
112 1748 kakl int1 s105VV;
113 1748 kakl int1 s105NZ;
114 1748 kakl int1 s105ZZ;
115 1748 kakl int1 s102AN;
116 1748 kakl int1 s110AN;
117 1748 kakl int1 s108AV;
118 1746 kakl
119 1747 kakl #define send(s) \
120 1747 kakl {\
121 1747 kakl printf("%s\r\n",#s);\
122 1747 kakl output_toggle(LED1);\
123 1747 kakl delay_ms(100);\
124 1747 kakl }
125 1747 kakl
126 1746 kakl void main()
127 1746 kakl {
128 1746 kakl
129 1746 kakl setup_adc_ports(NO_ANALOGS|VSS_VDD);
130 1746 kakl setup_adc(ADC_CLOCK_DIV_2);
131 1746 kakl setup_psp(PSP_DISABLED);
132 1746 kakl setup_spi(SPI_SS_DISABLED);
133 1746 kakl setup_wdt(WDT_OFF);
134 1746 kakl setup_timer_0(RTCC_INTERNAL);
135 1746 kakl setup_timer_1(T1_DISABLED);
136 1746 kakl setup_timer_2(T2_DISABLED,0,1);
137 1746 kakl setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
138 1746 kakl setup_ccp1(CCP_OFF);
139 1746 kakl setup_comparator(NC_NC_NC_NC);
140 1746 kakl setup_vref(FALSE);
141 1746 kakl
142 1750 kakl OFF(OS101A);
143 1750 kakl
144 1748 kakl s105AN=S105AN; // Poznamenej vychozi stav vypinacu
145 1748 kakl r110NJU=R110NJU;
146 1748 kakl r110NJD=R110NJD;
147 1748 kakl s104AZ=S104AZ;
148 1748 kakl r104VZU=R104VZU;
149 1748 kakl r104VZD=R104VZD;
150 1748 kakl r104JZU=R104JZU;
151 1748 kakl r104JZD=R104JZD;
152 1748 kakl s103JZ=S103JZ;
153 1748 kakl s103JN=S103JN;
154 1748 kakl s103JV=S103JV;
155 1748 kakl r103VZU=R103VZU;
156 1748 kakl r103VZD=R103VZD;
157 1748 kakl s106AV=S106AV;
158 1748 kakl s107AN=S107AN;
159 1748 kakl s109AJ=S109AJ;
160 1748 kakl s101AN=S101AN;
161 1748 kakl s101AJ=S101AJ;
162 1748 kakl s105VV=S105VV;
163 1748 kakl s105NZ=S105NZ;
164 1748 kakl s105ZZ=S105ZZ;
165 1748 kakl s102AN=S102AN;
166 1748 kakl s110AN=S110AN;
167 1748 kakl s108AV=S108AV;
168 1746 kakl
169 1746 kakl while(TRUE)
170 1746 kakl {
171 1748 kakl if(s105AN!=S105AN) {s105AN=S105AN; send(S15A);}
172 1748 kakl if(r110NJU!=R110NJU) {r110NJU=R110NJU; send(R1aNU);}
173 1748 kakl if(r110NJD!=R110NJD) {r110NJD=R110NJD; send(R1aND);}
174 1748 kakl
175 1748 kakl if(!S105VV) {output_low(OS105V);} else {output_high(OS105V);}
176 1748 kakl if(!S105NZ) {output_low(OS105N);} else {output_high(OS105N);}
177 1748 kakl if(s105ZZ!=S105ZZ) {s105ZZ=S105ZZ; send(S15Z);}
178 1746 kakl
179 1748 kakl if(s104AZ!=S104AZ) {s104AZ=S104AZ; send(S14A);}
180 1748 kakl if(r104VZU!=R104VZU) {r104VZU=R104VZU; send(R14VU);}
181 1748 kakl if(r104VZD!=R104VZD) {r104VZD=R104VZD; send(R14VD);}
182 1748 kakl if(r104JZU!=R104JZU) {r104JZU=R104JZU; send(R14JU);}
183 1748 kakl if(r104JZD!=R104JZD) {r104JZD=R104JZD; send(R14JD);}
184 1746 kakl
185 1748 kakl if(s103JZ!=S103JZ) {s103JZ=S103JZ; send(S13A);}
186 1748 kakl if(s103JN!=S103JN) {s103JN=S103JN; send(S13A);}
187 1748 kakl if(s103JV!=S103JV) {s103JV=S103JV; send(S13A);}
188 1748 kakl if(r103VZU!=R103VZU) {r103VZU=R103VZU; send(R13VU);}
189 1748 kakl if(r103VZD!=R103VZD) {r103VZD=R103VZD; send(R13VD);}
190 1748 kakl
191 1748 kakl if(s106AV!=S106AV) {s106AV=S106AV; send(S16A);}
192 1748 kakl if(s107AN!=S107AN) {s107AN=S107AN; send(S17A);}
193 1748 kakl if(s109AJ!=S109AJ) {s109AJ=S109AJ; send(S19A);}
194 1746 kakl
195 1750 kakl if(s101AN!=S101AN) {s101AN=S101AN; output_toggle(OS101A); delay_ms(100);}
196 1750 kakl if(s101AJ!=S101AJ) {s101AJ=S101AJ; output_toggle(OS101A); delay_ms(100);}
197 1746 kakl
198 1748 kakl if(s102AN!=S102AN) {s102AN=S102AN; send(S12A);}
199 1748 kakl if(s110AN!=S110AN) {s110AN=S110AN; send(S1aA);}
200 1748 kakl if(s108AV!=S108AV) {s108AV=S108AV; send(S18A);}
201 1750 kakl
202 1750 kakl if(get_timer0()>65000) {output_toggle(LED2); set_timer0(0);}
203 1746 kakl }
204 1746 kakl }
{BLAME END}
{FOOTER START}

Poháněno WebSVN v2.1 alpha 1