Rev Author Line No. Line
221 svejda 1 CCS PCM C Compiler, Version 4.058s, 42064 12-IV-08 21:55
2  
3 Filename: C:\RS\Prog\finalni\main.lst
4  
5 ROM used: 386 words (5%)
6 Largest free fragment is 2048
7 RAM used: 10 (3%) at main() level
8 10 (3%) worst case
9 Stack: 1 locations
10  
11 *
12 0000: MOVLW 00
13 0001: MOVWF 0A
14 0002: GOTO 069
15 0003: NOP
16 .................... #include "C:\RS\Prog\finalni\main.h"
17 .................... #include <16F877A.h>
18 .................... //////// Standard Header file for the PIC16F877A device ////////////////
19 .................... #device PIC16F877A
20 .................... #list
21 ....................
22 .................... #device adc=8
23 ....................
24 .................... #FUSES NOWDT //No Watch Dog Timer
25 .................... #FUSES XT //Crystal osc <= 4mhz
26 .................... #FUSES NOPUT //No Power Up Timer
27 .................... #FUSES NOPROTECT //Code not protected from reading
28 .................... #FUSES NODEBUG //No Debug mode for ICD
29 .................... #FUSES NOBROWNOUT //No brownout reset
30 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
31 .................... #FUSES NOCPD //No EE protection
32 .................... #FUSES NOWRT //Program memory not write protected
33 ....................
34 .................... #use delay(clock=4000000,RESTART_WDT)
35 0051: MOVLW 23
36 0052: MOVWF 04
37 0053: BCF 03.7
38 0054: MOVF 00,W
39 0055: BTFSC 03.2
40 0056: GOTO 068
41 0057: MOVLW 01
42 0058: MOVWF 78
43 0059: MOVLW BF
44 005A: MOVWF 77
45 005B: CLRWDT
46 005C: DECFSZ 77,F
47 005D: GOTO 05B
48 005E: DECFSZ 78,F
49 005F: GOTO 059
50 0060: MOVLW 4A
51 0061: MOVWF 77
52 0062: DECFSZ 77,F
53 0063: GOTO 062
54 0064: NOP
55 0065: CLRWDT
56 0066: DECFSZ 00,F
57 0067: GOTO 057
58 0068: RETLW 00
59 ....................
60 ....................
61 ....................
62 ....................
63 .................... void main()
64 .................... {
65 0069: CLRF 04
66 006A: BCF 03.7
67 006B: MOVLW 1F
68 006C: ANDWF 03,F
69 006D: BSF 03.5
70 006E: BSF 1F.0
71 006F: BSF 1F.1
72 0070: BSF 1F.2
73 0071: BCF 1F.3
74 0072: MOVLW 07
75 0073: MOVWF 1C
76 .................... int cas;
77 .................... int8 hall;
78 ....................
79 .................... const int8 A[7]={0b00000001,0b11110110,0b11110110,0b11110110,0b00000001,0b11111111,0b11111111};
80 .................... const int8 B[7]={0b00000000,0b01110110,0b01110110,0b01110110,0b10001001,0b11111111,0b11111111};
81 .................... const int8 C[7]={0b10000001,0b01111110,0b01111110,0b01111110,0b10111101,0b11111111,0b11111111};
82 .................... const int8 D[7]={0b00000000,0b01111110,0b01111110,0b01111110,0b10000001,0b11111111,0b11111111};
83 .................... const int8 E[7]={0b00000000,0b01110110,0b01110110,0b01111110,0b01111110,0b11111111,0b11111111};
84 .................... const int8 F[7]={0b00000000,0b11110110,0b11110110,0b11111110,0b11111110,0b11111111,0b11111111};
85 .................... const int8 G[7]={0b10000001,0b01111110,0b01110110,0b01110110,0b10000101,0b11111111,0b11111111};
86 .................... const int8 H[7]={0b00000000,0b11110111,0b11110111,0b11110111,0b00000000,0b11111111,0b11111111};
87 .................... const int8 I[7]={0b01111110,0b01111110,0b00000000,0b01111110,0b01111110,0b11111111,0b11111111};
88 .................... const int8 J[7]={0b10111110,0b01111110,0b01111110,0b01111110,0b10000000,0b11111111,0b11111111};
89 .................... const int8 K[7]={0b00000000,0b11110111,0b11110111,0b11101011,0b00011100,0b11111111,0b11111111};
90 .................... const int8 L[7]={0b00000000,0b01111111,0b01111111,0b01111111,0b01111111,0b11111111,0b11111111};
91 .................... const int8 M[7]={0b00000000,0b11111110,0b11110000,0b11111110,0b00000000,0b11111111,0b11111111};
92 .................... const int8 N[7]={0b00000000,0b11101111,0b11011111,0b10111111,0b00000000,0b11111111,0b11111111};
93 .................... const int8 O[7]={0b10000001,0b01111110,0b01111110,0b01111110,0b10000001,0b11111111,0b11111111};
94 .................... const int8 P[7]={0b00000000,0b11110110,0b11110110,0b11110110,0b11111001,0b11111111,0b11111111};
95 .................... const int8 Q[7]={0b10000001,0b01111110,0b01111110,0b01111110,0b00000001,0b01111111,0b11111111};
96 .................... const int8 R[7]={0b00000000,0b11110110,0b11110110,0b11110110,0b00001001,0b11111111,0b11111111};
97 .................... const int8 S[7]={0b10111001,0b01110110,0b01110110,0b01110110,0b10001101,0b11111111,0b11111111};
98 .................... const int8 T[7]={0b11111110,0b11111110,0b00000000,0b11111110,0b11111110,0b11111111,0b11111111};
99 .................... const int8 U[7]={0b10000000,0b01111111,0b01111111,0b01111111,0b10000000,0b11111111,0b11111111};
100 .................... const int8 V[7]={0b11000000,0b10111111,0b01111111,0b10111111,0b11000000,0b11111111,0b11111111};
101 .................... const int8 W[7]={0b10000000,0b01111111,0b10000000,0b01111111,0b10000000,0b11111111,0b11111111};
102 .................... const int8 X[7]={0b00011100,0b11101011,0b11110111,0b11101011,0b00011100,0b11111111,0b11111111};
103 .................... const int8 Y[7]={0b11111000,0b11110111,0b00000111,0b11110111,0b11111000,0b11111111,0b11111111};
104 .................... const int8 Z[7]={0b00011110,0b01101110,0b01110110,0b01111010,0b01111100,0b11111111,0b11111111};
105 .................... const int8 null [7]={0b00000000,0b01111110,0b01111110,0b01111110,0b00000000,0b11111111,0b11111111};
106 .................... const int8 one [7]={0b01111011,0b01111101,0b00000000,0b01111111,0b01111111,0b11111111,0b11111111};
107 .................... const int8 two [7]={0b00111101,0b01011110,0b01101110,0b01110110,0b01111001,0b11111111,0b11111111};
108 .................... const int8 three[7]={0b10111101,0b01111110,0b01110110,0b01110110,0b10001001,0b11111111,0b11111111};
109 .................... const int8 four [7]={0b11110000,0b11110111,0b11110111,0b00000001,0b11110111,0b11111111,0b11111111};
110 .................... const int8 five [7]={0b10111000,0b01110110,0b01110110,0b01110110,0b10001110,0b11111111,0b11111111};
111 .................... const int8 six [7]={0b10000001,0b01110110,0b01110110,0b01110110,0b10001101,0b11111111,0b11111111};
112 .................... const int8 seven[7]={0b11111110,0b11111110,0b00001110,0b11110110,0b11111000,0b11111111,0b11111111};
113 .................... const int8 eight[7]={0b10001001,0b01110110,0b01110110,0b01110110,0b10001001,0b11111111,0b11111111};
114 .................... const int8 nine [7]={0b10111001,0b01110110,0b01110110,0b01110110,0b10000001,0b11111111,0b11111111};
115 ....................
116 .................... const int8 mezera[7]={0b11111111,0b11111111,0b11111111,0b11111111,0b11111111,0b11111111,0b11111111};
117 ....................
118 .................... setup_adc_ports(AN0);
119 *
120 0077: BSF 03.5
121 0078: BCF 1F.0
122 0079: BSF 1F.1
123 007A: BSF 1F.2
124 007B: BSF 1F.3
125 .................... setup_adc(ADC_CLOCK_DIV_8);
126 007C: BCF 1F.6
127 007D: BCF 03.5
128 007E: BSF 1F.6
129 007F: BCF 1F.7
130 0080: BSF 03.5
131 0081: BCF 1F.7
132 0082: BCF 03.5
133 0083: BSF 1F.0
134 .................... setup_psp(PSP_DISABLED);
135 0084: BSF 03.5
136 0085: BCF 09.4
137 .................... setup_spi(SPI_SS_DISABLED);
138 *
139 0074: MOVLW FF
140 0075: BCF 03.5
141 0076: MOVWF 20
142 *
143 0086: BCF 03.5
144 0087: BCF 14.5
145 0088: BCF 20.5
146 0089: MOVF 20,W
147 008A: BSF 03.5
148 008B: MOVWF 07
149 008C: BCF 03.5
150 008D: BSF 20.4
151 008E: MOVF 20,W
152 008F: BSF 03.5
153 0090: MOVWF 07
154 0091: BCF 03.5
155 0092: BCF 20.3
156 0093: MOVF 20,W
157 0094: BSF 03.5
158 0095: MOVWF 07
159 0096: MOVLW 01
160 0097: BCF 03.5
161 0098: MOVWF 14
162 0099: MOVLW 00
163 009A: BSF 03.5
164 009B: MOVWF 14
165 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
166 009C: MOVF 01,W
167 009D: ANDLW C7
168 009E: IORLW 08
169 009F: MOVWF 01
170 .................... setup_timer_1(T1_DISABLED);
171 00A0: BCF 03.5
172 00A1: CLRF 10
173 .................... setup_timer_2(T2_DISABLED,0,1);
174 00A2: MOVLW 00
175 00A3: MOVWF 78
176 00A4: MOVWF 12
177 00A5: MOVLW 00
178 00A6: BSF 03.5
179 00A7: MOVWF 12
180 .................... setup_comparator(NC_NC_NC_NC);
181 00A8: MOVLW 07
182 00A9: MOVWF 1C
183 00AA: MOVF 05,W
184 00AB: CLRWDT
185 00AC: MOVLW 02
186 00AD: MOVWF 77
187 00AE: DECFSZ 77,F
188 00AF: GOTO 0AE
189 00B0: GOTO 0B1
190 00B1: MOVF 1C,W
191 00B2: BCF 03.5
192 00B3: BCF 0D.6
193 .................... setup_vref(FALSE);
194 00B4: BSF 03.5
195 00B5: CLRF 1D
196 ....................
197 .................... set_adc_channel(0);
198 00B6: MOVLW 00
199 00B7: MOVWF 78
200 00B8: BCF 03.5
201 00B9: MOVF 1F,W
202 00BA: ANDLW C7
203 00BB: IORWF 78,W
204 00BC: MOVWF 1F
205 .................... delay_us(10);
206 00BD: CLRWDT
207 00BE: MOVLW 02
208 00BF: MOVWF 77
209 00C0: DECFSZ 77,F
210 00C1: GOTO 0C0
211 00C2: GOTO 0C3
212 ....................
213 .................... while(TRUE)
214 .................... {
215 .................... hall=read_adc();
216 00C3: BSF 1F.2
217 00C4: BTFSC 1F.2
218 00C5: GOTO 0C4
219 00C6: MOVF 1E,W
220 00C7: MOVWF 22
221 .................... if(hall>10)
222 00C8: MOVF 22,W
223 00C9: SUBLW 0A
224 00CA: BTFSC 03.0
225 00CB: GOTO 180
226 .................... {
227 ....................
228 .................... for(cas=0;cas<7;cas++)
229 00CC: CLRF 21
230 00CD: MOVF 21,W
231 00CE: SUBLW 06
232 00CF: BTFSS 03.0
233 00D0: GOTO 0DE
234 .................... {
235 .................... output_B(L[cas]);
236 00D1: MOVF 21,W
237 00D2: CALL 030
238 00D3: MOVWF 23
239 00D4: BSF 03.5
240 00D5: CLRF 06
241 00D6: BCF 03.5
242 00D7: MOVF 23,W
243 00D8: MOVWF 06
244 .................... delay_ms(1);
245 00D9: MOVLW 01
246 00DA: MOVWF 23
247 00DB: CALL 051
248 .................... }
249 00DC: INCF 21,F
250 00DD: GOTO 0CD
251 .................... for(cas=0;cas<7;cas++)
252 00DE: CLRF 21
253 00DF: MOVF 21,W
254 00E0: SUBLW 06
255 00E1: BTFSS 03.0
256 00E2: GOTO 0F0
257 .................... {
258 .................... output_B(E[cas]);
259 00E3: MOVF 21,W
260 00E4: CALL 01A
261 00E5: MOVWF 23
262 00E6: BSF 03.5
263 00E7: CLRF 06
264 00E8: BCF 03.5
265 00E9: MOVF 23,W
266 00EA: MOVWF 06
267 .................... delay_ms(1);
268 00EB: MOVLW 01
269 00EC: MOVWF 23
270 00ED: CALL 051
271 .................... }
272 00EE: INCF 21,F
273 00EF: GOTO 0DF
274 .................... for(cas=0;cas<7;cas++)
275 00F0: CLRF 21
276 00F1: MOVF 21,W
277 00F2: SUBLW 06
278 00F3: BTFSS 03.0
279 00F4: GOTO 102
280 .................... {
281 .................... output_B(D[cas]);
282 00F5: MOVF 21,W
283 00F6: CALL 00F
284 00F7: MOVWF 23
285 00F8: BSF 03.5
286 00F9: CLRF 06
287 00FA: BCF 03.5
288 00FB: MOVF 23,W
289 00FC: MOVWF 06
290 .................... delay_ms(1);
291 00FD: MOVLW 01
292 00FE: MOVWF 23
293 00FF: CALL 051
294 .................... }
295 0100: INCF 21,F
296 0101: GOTO 0F1
297 .................... for(cas=0;cas<7;cas++)
298 0102: CLRF 21
299 0103: MOVF 21,W
300 0104: SUBLW 06
301 0105: BTFSS 03.0
302 0106: GOTO 114
303 .................... {
304 .................... output_B(mezera[cas]);
305 0107: MOVF 21,W
306 0108: CALL 046
307 0109: MOVWF 23
308 010A: BSF 03.5
309 010B: CLRF 06
310 010C: BCF 03.5
311 010D: MOVF 23,W
312 010E: MOVWF 06
313 .................... delay_ms(1);
314 010F: MOVLW 01
315 0110: MOVWF 23
316 0111: CALL 051
317 .................... }
318 0112: INCF 21,F
319 0113: GOTO 103
320 .................... for(cas=0;cas<7;cas++)
321 0114: CLRF 21
322 0115: MOVF 21,W
323 0116: SUBLW 06
324 0117: BTFSS 03.0
325 0118: GOTO 126
326 .................... {
327 .................... output_B(E[cas]);
328 0119: MOVF 21,W
329 011A: CALL 01A
330 011B: MOVWF 23
331 011C: BSF 03.5
332 011D: CLRF 06
333 011E: BCF 03.5
334 011F: MOVF 23,W
335 0120: MOVWF 06
336 .................... delay_ms(1);
337 0121: MOVLW 01
338 0122: MOVWF 23
339 0123: CALL 051
340 .................... }
341 0124: INCF 21,F
342 0125: GOTO 115
343 .................... for(cas=0;cas<7;cas++)
344 0126: CLRF 21
345 0127: MOVF 21,W
346 0128: SUBLW 06
347 0129: BTFSS 03.0
348 012A: GOTO 138
349 .................... {
350 .................... output_B(F[cas]);
351 012B: MOVF 21,W
352 012C: CALL 025
353 012D: MOVWF 23
354 012E: BSF 03.5
355 012F: CLRF 06
356 0130: BCF 03.5
357 0131: MOVF 23,W
358 0132: MOVWF 06
359 .................... delay_ms(1);
360 0133: MOVLW 01
361 0134: MOVWF 23
362 0135: CALL 051
363 .................... }
364 0136: INCF 21,F
365 0137: GOTO 127
366 .................... for(cas=0;cas<7;cas++)
367 0138: CLRF 21
368 0139: MOVF 21,W
369 013A: SUBLW 06
370 013B: BTFSS 03.0
371 013C: GOTO 14A
372 .................... {
373 .................... output_B(F[cas]);
374 013D: MOVF 21,W
375 013E: CALL 025
376 013F: MOVWF 23
377 0140: BSF 03.5
378 0141: CLRF 06
379 0142: BCF 03.5
380 0143: MOVF 23,W
381 0144: MOVWF 06
382 .................... delay_ms(1);
383 0145: MOVLW 01
384 0146: MOVWF 23
385 0147: CALL 051
386 .................... }
387 0148: INCF 21,F
388 0149: GOTO 139
389 .................... for(cas=0;cas<7;cas++)
390 014A: CLRF 21
391 014B: MOVF 21,W
392 014C: SUBLW 06
393 014D: BTFSS 03.0
394 014E: GOTO 15C
395 .................... {
396 .................... output_B(E[cas]);
397 014F: MOVF 21,W
398 0150: CALL 01A
399 0151: MOVWF 23
400 0152: BSF 03.5
401 0153: CLRF 06
402 0154: BCF 03.5
403 0155: MOVF 23,W
404 0156: MOVWF 06
405 .................... delay_ms(1);
406 0157: MOVLW 01
407 0158: MOVWF 23
408 0159: CALL 051
409 .................... }
410 015A: INCF 21,F
411 015B: GOTO 14B
412 .................... for(cas=0;cas<7;cas++)
413 015C: CLRF 21
414 015D: MOVF 21,W
415 015E: SUBLW 06
416 015F: BTFSS 03.0
417 0160: GOTO 16E
418 .................... {
419 .................... output_B(C[cas]);
420 0161: MOVF 21,W
421 0162: CALL 004
422 0163: MOVWF 23
423 0164: BSF 03.5
424 0165: CLRF 06
425 0166: BCF 03.5
426 0167: MOVF 23,W
427 0168: MOVWF 06
428 .................... delay_ms(1);
429 0169: MOVLW 01
430 016A: MOVWF 23
431 016B: CALL 051
432 .................... }
433 016C: INCF 21,F
434 016D: GOTO 15D
435 .................... for(cas=0;cas<7;cas++)
436 016E: CLRF 21
437 016F: MOVF 21,W
438 0170: SUBLW 06
439 0171: BTFSS 03.0
440 0172: GOTO 180
441 .................... {
442 .................... output_B(T[cas]);
443 0173: MOVF 21,W
444 0174: CALL 03B
445 0175: MOVWF 23
446 0176: BSF 03.5
447 0177: CLRF 06
448 0178: BCF 03.5
449 0179: MOVF 23,W
450 017A: MOVWF 06
451 .................... delay_ms(1);
452 017B: MOVLW 01
453 017C: MOVWF 23
454 017D: CALL 051
455 .................... }
456 017E: INCF 21,F
457 017F: GOTO 16F
458 ....................
459 .................... }
460 .................... }
461 0180: GOTO 0C3
462 .................... }
463 0181: SLEEP
464  
465 Configuration Fuses:
466 Word 1: 3F39 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD NOWRT