229 |
toman |
1 |
CCS PCM C Compiler, Version 4.058s, 42064 04-V-08 15:12 |
|
|
2 |
|
|
|
3 |
Filename: C:\RS\Prog\alarm\alarm.lst |
|
|
4 |
|
|
|
5 |
ROM used: 263 words (3%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 18 (5%) at main() level |
|
|
8 |
21 (6%) worst case |
|
|
9 |
Stack: 3 worst case (1 in main + 2 for interrupts) |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 00 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 068 |
|
|
15 |
0003: NOP |
|
|
16 |
0004: MOVWF 7F |
|
|
17 |
0005: SWAPF 03,W |
|
|
18 |
0006: CLRF 03 |
|
|
19 |
0007: MOVWF 21 |
|
|
20 |
0008: MOVF 0A,W |
|
|
21 |
0009: MOVWF 20 |
|
|
22 |
000A: CLRF 0A |
|
|
23 |
000B: MOVF 04,W |
|
|
24 |
000C: MOVWF 22 |
|
|
25 |
000D: MOVF 77,W |
|
|
26 |
000E: MOVWF 23 |
|
|
27 |
000F: MOVF 78,W |
|
|
28 |
0010: MOVWF 24 |
|
|
29 |
0011: MOVF 79,W |
|
|
30 |
0012: MOVWF 25 |
|
|
31 |
0013: MOVF 7A,W |
|
|
32 |
0014: MOVWF 26 |
|
|
33 |
0015: MOVF 7B,W |
|
|
34 |
0016: MOVWF 27 |
|
|
35 |
0017: BCF 03.7 |
|
|
36 |
0018: BCF 03.5 |
|
|
37 |
0019: MOVLW 8C |
|
|
38 |
001A: MOVWF 04 |
|
|
39 |
001B: BTFSS 00.5 |
|
|
40 |
001C: GOTO 01F |
|
|
41 |
001D: BTFSC 0C.5 |
|
|
42 |
001E: GOTO 032 |
|
|
43 |
001F: MOVF 22,W |
|
|
44 |
0020: MOVWF 04 |
|
|
45 |
0021: MOVF 23,W |
|
|
46 |
0022: MOVWF 77 |
|
|
47 |
0023: MOVF 24,W |
|
|
48 |
0024: MOVWF 78 |
|
|
49 |
0025: MOVF 25,W |
|
|
50 |
0026: MOVWF 79 |
|
|
51 |
0027: MOVF 26,W |
|
|
52 |
0028: MOVWF 7A |
|
|
53 |
0029: MOVF 27,W |
|
|
54 |
002A: MOVWF 7B |
|
|
55 |
002B: MOVF 20,W |
|
|
56 |
002C: MOVWF 0A |
|
|
57 |
002D: SWAPF 21,W |
|
|
58 |
002E: MOVWF 03 |
|
|
59 |
002F: SWAPF 7F,F |
|
|
60 |
0030: SWAPF 7F,W |
|
|
61 |
0031: RETFIE |
|
|
62 |
0032: BCF 0A.3 |
|
|
63 |
0033: BCF 0A.4 |
|
|
64 |
0034: GOTO 04D |
|
|
65 |
.................... #include "C:\RS\Prog\alarm\alarm.h" |
|
|
66 |
.................... #include <16F877A.h> |
|
|
67 |
.................... //////// Standard Header file for the PIC16F877A device //////////////// |
|
|
68 |
.................... #device PIC16F877A |
|
|
69 |
.................... #list |
|
|
70 |
.................... |
|
|
71 |
.................... #device adc=8 |
|
|
72 |
.................... |
|
|
73 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
74 |
.................... #FUSES XT //Crystal osc <= 4mhz |
|
|
75 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
76 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
77 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
78 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
79 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
80 |
.................... #FUSES NOCPD //No EE protection |
|
|
81 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
82 |
.................... |
|
|
83 |
.................... #use delay(clock=4000000,RESTART_WDT) |
|
|
84 |
0035: MOVLW 2E |
|
|
85 |
0036: MOVWF 04 |
|
|
86 |
0037: BCF 03.7 |
|
|
87 |
0038: MOVF 00,W |
|
|
88 |
0039: BTFSC 03.2 |
|
|
89 |
003A: GOTO 04C |
|
|
90 |
003B: MOVLW 01 |
|
|
91 |
003C: MOVWF 78 |
|
|
92 |
003D: MOVLW BF |
|
|
93 |
003E: MOVWF 77 |
|
|
94 |
003F: CLRWDT |
|
|
95 |
0040: DECFSZ 77,F |
|
|
96 |
0041: GOTO 03F |
|
|
97 |
0042: DECFSZ 78,F |
|
|
98 |
0043: GOTO 03D |
|
|
99 |
0044: MOVLW 4A |
|
|
100 |
0045: MOVWF 77 |
|
|
101 |
0046: DECFSZ 77,F |
|
|
102 |
0047: GOTO 046 |
|
|
103 |
0048: NOP |
|
|
104 |
0049: CLRWDT |
|
|
105 |
004A: DECFSZ 00,F |
|
|
106 |
004B: GOTO 03B |
|
|
107 |
004C: RETLW 00 |
|
|
108 |
.................... #use rs232(baud=1200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8) |
|
|
109 |
.................... |
|
|
110 |
.................... |
|
|
111 |
.................... |
|
|
112 |
.................... #int_RDA |
|
|
113 |
.................... void RDA_isr(void) |
|
|
114 |
.................... { |
|
|
115 |
.................... while(TRUE) |
|
|
116 |
.................... { |
|
|
117 |
.................... output_high(PIN_A2); |
|
|
118 |
004D: BSF 03.5 |
|
|
119 |
004E: BCF 05.2 |
|
|
120 |
004F: BCF 03.5 |
|
|
121 |
0050: BSF 05.2 |
|
|
122 |
.................... delay_ms(500); |
|
|
123 |
0051: MOVLW 02 |
|
|
124 |
0052: MOVWF 2D |
|
|
125 |
0053: MOVLW FA |
|
|
126 |
0054: MOVWF 2E |
|
|
127 |
0055: CALL 035 |
|
|
128 |
0056: DECFSZ 2D,F |
|
|
129 |
0057: GOTO 053 |
|
|
130 |
.................... output_low(PIN_A2); |
|
|
131 |
0058: BSF 03.5 |
|
|
132 |
0059: BCF 05.2 |
|
|
133 |
005A: BCF 03.5 |
|
|
134 |
005B: BCF 05.2 |
|
|
135 |
.................... delay_ms(500); |
|
|
136 |
005C: MOVLW 02 |
|
|
137 |
005D: MOVWF 2D |
|
|
138 |
005E: MOVLW FA |
|
|
139 |
005F: MOVWF 2E |
|
|
140 |
0060: CALL 035 |
|
|
141 |
0061: DECFSZ 2D,F |
|
|
142 |
0062: GOTO 05E |
|
|
143 |
.................... } |
|
|
144 |
0063: GOTO 04D |
|
|
145 |
.................... } |
|
|
146 |
.................... |
|
|
147 |
0064: BCF 0C.5 |
|
|
148 |
0065: BCF 0A.3 |
|
|
149 |
0066: BCF 0A.4 |
|
|
150 |
0067: GOTO 01F |
|
|
151 |
.................... void main() |
|
|
152 |
.................... { |
|
|
153 |
0068: CLRF 04 |
|
|
154 |
0069: BCF 03.7 |
|
|
155 |
006A: MOVLW 1F |
|
|
156 |
006B: ANDWF 03,F |
|
|
157 |
006C: MOVLW 33 |
|
|
158 |
006D: BSF 03.5 |
|
|
159 |
006E: MOVWF 19 |
|
|
160 |
006F: MOVLW A2 |
|
|
161 |
0070: MOVWF 18 |
|
|
162 |
0071: MOVLW 90 |
|
|
163 |
0072: BCF 03.5 |
|
|
164 |
0073: MOVWF 18 |
|
|
165 |
0074: BSF 03.5 |
|
|
166 |
0075: BSF 1F.0 |
|
|
167 |
0076: BSF 1F.1 |
|
|
168 |
0077: BSF 1F.2 |
|
|
169 |
0078: BCF 1F.3 |
|
|
170 |
0079: MOVLW 07 |
|
|
171 |
007A: MOVWF 1C |
|
|
172 |
.................... int1 pipak; |
|
|
173 |
.................... |
|
|
174 |
.................... port_b_pullups(TRUE); |
|
|
175 |
* |
|
|
176 |
007E: BSF 03.5 |
|
|
177 |
007F: BCF 01.7 |
|
|
178 |
.................... setup_adc_ports(NO_ANALOGS); |
|
|
179 |
0080: BSF 1F.0 |
|
|
180 |
0081: BSF 1F.1 |
|
|
181 |
0082: BSF 1F.2 |
|
|
182 |
0083: BCF 1F.3 |
|
|
183 |
.................... setup_adc(ADC_OFF); |
|
|
184 |
0084: BCF 03.5 |
|
|
185 |
0085: BCF 1F.0 |
|
|
186 |
.................... setup_psp(PSP_DISABLED); |
|
|
187 |
0086: BSF 03.5 |
|
|
188 |
0087: BCF 09.4 |
|
|
189 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
190 |
* |
|
|
191 |
007B: MOVLW FF |
|
|
192 |
007C: BCF 03.5 |
|
|
193 |
007D: MOVWF 29 |
|
|
194 |
* |
|
|
195 |
0088: BCF 03.5 |
|
|
196 |
0089: BCF 14.5 |
|
|
197 |
008A: BCF 29.5 |
|
|
198 |
008B: MOVF 29,W |
|
|
199 |
008C: BSF 03.5 |
|
|
200 |
008D: MOVWF 07 |
|
|
201 |
008E: BCF 03.5 |
|
|
202 |
008F: BSF 29.4 |
|
|
203 |
0090: MOVF 29,W |
|
|
204 |
0091: BSF 03.5 |
|
|
205 |
0092: MOVWF 07 |
|
|
206 |
0093: BCF 03.5 |
|
|
207 |
0094: BCF 29.3 |
|
|
208 |
0095: MOVF 29,W |
|
|
209 |
0096: BSF 03.5 |
|
|
210 |
0097: MOVWF 07 |
|
|
211 |
0098: MOVLW 01 |
|
|
212 |
0099: BCF 03.5 |
|
|
213 |
009A: MOVWF 14 |
|
|
214 |
009B: MOVLW 00 |
|
|
215 |
009C: BSF 03.5 |
|
|
216 |
009D: MOVWF 14 |
|
|
217 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
218 |
009E: MOVF 01,W |
|
|
219 |
009F: ANDLW C7 |
|
|
220 |
00A0: IORLW 08 |
|
|
221 |
00A1: MOVWF 01 |
|
|
222 |
.................... setup_timer_1(T1_DISABLED); |
|
|
223 |
00A2: BCF 03.5 |
|
|
224 |
00A3: CLRF 10 |
|
|
225 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
226 |
00A4: MOVLW 00 |
|
|
227 |
00A5: MOVWF 78 |
|
|
228 |
00A6: MOVWF 12 |
|
|
229 |
00A7: MOVLW 00 |
|
|
230 |
00A8: BSF 03.5 |
|
|
231 |
00A9: MOVWF 12 |
|
|
232 |
.................... setup_comparator(NC_NC_NC_NC); |
|
|
233 |
00AA: MOVLW 07 |
|
|
234 |
00AB: MOVWF 1C |
|
|
235 |
00AC: MOVF 05,W |
|
|
236 |
00AD: CLRWDT |
|
|
237 |
00AE: MOVLW 02 |
|
|
238 |
00AF: MOVWF 77 |
|
|
239 |
00B0: DECFSZ 77,F |
|
|
240 |
00B1: GOTO 0B0 |
|
|
241 |
00B2: GOTO 0B3 |
|
|
242 |
00B3: MOVF 1C,W |
|
|
243 |
00B4: BCF 03.5 |
|
|
244 |
00B5: BCF 0D.6 |
|
|
245 |
.................... setup_vref(FALSE); |
|
|
246 |
00B6: BSF 03.5 |
|
|
247 |
00B7: CLRF 1D |
|
|
248 |
.................... |
|
|
249 |
.................... enable_interrupts(INT_RDA); |
|
|
250 |
00B8: BSF 0C.5 |
|
|
251 |
.................... enable_interrupts(GLOBAL); |
|
|
252 |
00B9: MOVLW C0 |
|
|
253 |
00BA: BCF 03.5 |
|
|
254 |
00BB: IORWF 0B,F |
|
|
255 |
.................... |
|
|
256 |
.................... While(TRUE) |
|
|
257 |
.................... { |
|
|
258 |
.................... if(!input(PIN_B0)) |
|
|
259 |
00BC: BSF 03.5 |
|
|
260 |
00BD: BSF 06.0 |
|
|
261 |
00BE: BCF 03.5 |
|
|
262 |
00BF: BTFSC 06.0 |
|
|
263 |
00C0: GOTO 0EA |
|
|
264 |
.................... { |
|
|
265 |
.................... while(!input(PIN_B0)) |
|
|
266 |
.................... { |
|
|
267 |
00C1: BSF 03.5 |
|
|
268 |
00C2: BSF 06.0 |
|
|
269 |
00C3: BCF 03.5 |
|
|
270 |
00C4: BTFSC 06.0 |
|
|
271 |
00C5: GOTO 0E9 |
|
|
272 |
.................... output_high(PIN_A3); |
|
|
273 |
00C6: BSF 03.5 |
|
|
274 |
00C7: BCF 05.3 |
|
|
275 |
00C8: BCF 03.5 |
|
|
276 |
00C9: BSF 05.3 |
|
|
277 |
.................... delay_ms(500); |
|
|
278 |
00CA: MOVLW 02 |
|
|
279 |
00CB: MOVWF 2B |
|
|
280 |
00CC: CLRF 28 |
|
|
281 |
00CD: BTFSC 0B.7 |
|
|
282 |
00CE: BSF 28.7 |
|
|
283 |
00CF: BCF 0B.7 |
|
|
284 |
00D0: MOVLW FA |
|
|
285 |
00D1: MOVWF 2E |
|
|
286 |
00D2: CALL 035 |
|
|
287 |
00D3: BTFSC 28.7 |
|
|
288 |
00D4: BSF 0B.7 |
|
|
289 |
00D5: DECFSZ 2B,F |
|
|
290 |
00D6: GOTO 0CC |
|
|
291 |
.................... output_low(PIN_A3); |
|
|
292 |
00D7: BSF 03.5 |
|
|
293 |
00D8: BCF 05.3 |
|
|
294 |
00D9: BCF 03.5 |
|
|
295 |
00DA: BCF 05.3 |
|
|
296 |
.................... delay_ms(500); |
|
|
297 |
00DB: MOVLW 02 |
|
|
298 |
00DC: MOVWF 2B |
|
|
299 |
00DD: CLRF 28 |
|
|
300 |
00DE: BTFSC 0B.7 |
|
|
301 |
00DF: BSF 28.7 |
|
|
302 |
00E0: BCF 0B.7 |
|
|
303 |
00E1: MOVLW FA |
|
|
304 |
00E2: MOVWF 2E |
|
|
305 |
00E3: CALL 035 |
|
|
306 |
00E4: BTFSC 28.7 |
|
|
307 |
00E5: BSF 0B.7 |
|
|
308 |
00E6: DECFSZ 2B,F |
|
|
309 |
00E7: GOTO 0DD |
|
|
310 |
.................... } |
|
|
311 |
00E8: GOTO 0C1 |
|
|
312 |
.................... } |
|
|
313 |
.................... else |
|
|
314 |
00E9: GOTO 105 |
|
|
315 |
.................... { |
|
|
316 |
.................... while(TRUE) |
|
|
317 |
.................... { |
|
|
318 |
.................... delay_us(200); |
|
|
319 |
00EA: CLRWDT |
|
|
320 |
00EB: MOVLW 42 |
|
|
321 |
00EC: MOVWF 77 |
|
|
322 |
00ED: DECFSZ 77,F |
|
|
323 |
00EE: GOTO 0ED |
|
|
324 |
.................... pipak=~pipak; // Membrana reproduktoru sem/tam |
|
|
325 |
00EF: MOVLW 01 |
|
|
326 |
00F0: XORWF 2A,F |
|
|
327 |
.................... if(pipak) |
|
|
328 |
00F1: BTFSS 2A.0 |
|
|
329 |
00F2: GOTO 0FC |
|
|
330 |
.................... { |
|
|
331 |
.................... output_high(PIN_A4); |
|
|
332 |
00F3: BSF 03.5 |
|
|
333 |
00F4: BCF 05.4 |
|
|
334 |
00F5: BCF 03.5 |
|
|
335 |
00F6: BSF 05.4 |
|
|
336 |
.................... output_low(PIN_A5); |
|
|
337 |
00F7: BSF 03.5 |
|
|
338 |
00F8: BCF 05.5 |
|
|
339 |
00F9: BCF 03.5 |
|
|
340 |
00FA: BCF 05.5 |
|
|
341 |
.................... } |
|
|
342 |
.................... else |
|
|
343 |
00FB: GOTO 104 |
|
|
344 |
.................... { |
|
|
345 |
.................... output_low(PIN_A4); |
|
|
346 |
00FC: BSF 03.5 |
|
|
347 |
00FD: BCF 05.4 |
|
|
348 |
00FE: BCF 03.5 |
|
|
349 |
00FF: BCF 05.4 |
|
|
350 |
.................... output_high(PIN_A5); |
|
|
351 |
0100: BSF 03.5 |
|
|
352 |
0101: BCF 05.5 |
|
|
353 |
0102: BCF 03.5 |
|
|
354 |
0103: BSF 05.5 |
|
|
355 |
.................... } |
|
|
356 |
.................... } |
|
|
357 |
0104: GOTO 0EA |
|
|
358 |
.................... } |
|
|
359 |
.................... } |
|
|
360 |
0105: GOTO 0BC |
|
|
361 |
.................... } |
|
|
362 |
0106: SLEEP |
|
|
363 |
|
|
|
364 |
Configuration Fuses: |
|
|
365 |
Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT |