Rev Author Line No. Line
211 helcl 1 CCS PCM C Compiler, Version 4.059d, 15399 20-IV-06 14:11
2  
3 Filename: main.lst
4  
5 ROM used: 335 words (16%)
6 Largest free fragment is 1713
7 RAM used: 11 (3%) at main() level
8 15 (4%) worst case
9 Stack: 2 locations
10  
11 *
12 0000: MOVLW 00
13 0001: MOVWF 0A
14 0002: GOTO 081
15 0003: NOP
16 .................... #include "C:\RS\gmc\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 WRT_50% //Lower half of Program Memory is Write Protected
33 ....................
34 .................... #use delay(clock=4000000)
35 *
36 001F: MOVLW 25
37 0020: MOVWF 04
38 0021: BCF 03.7
39 0022: MOVF 00,W
40 0023: BTFSC 03.2
41 0024: GOTO 033
42 0025: MOVLW 01
43 0026: MOVWF 78
44 0027: CLRF 77
45 0028: DECFSZ 77,F
46 0029: GOTO 028
47 002A: DECFSZ 78,F
48 002B: GOTO 027
49 002C: MOVLW 4A
50 002D: MOVWF 77
51 002E: DECFSZ 77,F
52 002F: GOTO 02E
53 0030: GOTO 031
54 0031: DECFSZ 00,F
55 0032: GOTO 025
56 0033: RETLW 00
57 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
58 ....................
59 ....................
60 .................... //#define PIP1 output_high(PIN_A2)
61 .................... //#define PIP2 output_low(PIN_A3)
62 ....................
63 .................... void main()
64 .................... {
65 *
66 0081: CLRF 04
67 0082: BCF 03.7
68 0083: MOVLW 1F
69 0084: ANDWF 03,F
70 0085: MOVLW 19
71 0086: BSF 03.5
72 0087: MOVWF 19
73 0088: MOVLW A6
74 0089: MOVWF 18
75 008A: MOVLW 90
76 008B: BCF 03.5
77 008C: MOVWF 18
78 008D: BSF 03.5
79 008E: BSF 1F.0
80 008F: BSF 1F.1
81 0090: BSF 1F.2
82 0091: BCF 1F.3
83 0092: MOVLW 07
84 0093: MOVWF 1C
85 ....................
86 .................... unsigned int8 poc;
87 .................... //int8 delay;
88 .................... int cas;
89 .................... int b;
90 ....................
91 .................... b=0;
92 *
93 0097: CLRF 23
94 ....................
95 ....................
96 .................... setup_adc_ports(NO_ANALOGS);
97 0098: BSF 03.5
98 0099: BSF 1F.0
99 009A: BSF 1F.1
100 009B: BSF 1F.2
101 009C: BCF 1F.3
102 .................... setup_adc(ADC_OFF);
103 009D: BCF 03.5
104 009E: BCF 1F.0
105 .................... setup_psp(PSP_DISABLED);
106 009F: BSF 03.5
107 00A0: BCF 09.4
108 .................... setup_spi(SPI_SS_DISABLED);
109 *
110 0094: MOVLW FF
111 0095: BCF 03.5
112 0096: MOVWF 20
113 *
114 00A1: BCF 03.5
115 00A2: BCF 14.5
116 00A3: BCF 20.5
117 00A4: MOVF 20,W
118 00A5: BSF 03.5
119 00A6: MOVWF 07
120 00A7: BCF 03.5
121 00A8: BSF 20.4
122 00A9: MOVF 20,W
123 00AA: BSF 03.5
124 00AB: MOVWF 07
125 00AC: BCF 03.5
126 00AD: BCF 20.3
127 00AE: MOVF 20,W
128 00AF: BSF 03.5
129 00B0: MOVWF 07
130 00B1: MOVLW 01
131 00B2: BCF 03.5
132 00B3: MOVWF 14
133 00B4: MOVLW 00
134 00B5: BSF 03.5
135 00B6: MOVWF 14
136 .................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
137 00B7: MOVF 01,W
138 00B8: ANDLW C7
139 00B9: IORLW 28
140 00BA: MOVWF 01
141 .................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_8);
142 00BB: MOVLW B7
143 00BC: BCF 03.5
144 00BD: MOVWF 10
145 .................... setup_timer_2(T2_DIV_BY_1,1023,1);
146 00BE: MOVLW 00
147 00BF: MOVWF 78
148 00C0: IORLW 04
149 00C1: MOVWF 12
150 00C2: MOVLW FF
151 00C3: BSF 03.5
152 00C4: MOVWF 12
153 .................... setup_ccp1(CCP_PWM);
154 00C5: BCF 03.5
155 00C6: BCF 20.2
156 00C7: MOVF 20,W
157 00C8: BSF 03.5
158 00C9: MOVWF 07
159 00CA: BCF 03.5
160 00CB: BCF 07.2
161 00CC: MOVLW 0C
162 00CD: MOVWF 17
163 .................... setup_ccp2(CCP_PWM);
164 00CE: BCF 20.1
165 00CF: MOVF 20,W
166 00D0: BSF 03.5
167 00D1: MOVWF 07
168 00D2: BCF 03.5
169 00D3: BCF 07.1
170 00D4: MOVLW 0C
171 00D5: MOVWF 1D
172 .................... set_pwm1_duty(265);
173 00D6: MOVLW 42
174 00D7: MOVWF 15
175 00D8: MOVF 17,W
176 00D9: ANDLW CF
177 00DA: IORLW 10
178 00DB: MOVWF 17
179 .................... set_pwm2_duty(265);
180 00DC: MOVLW 42
181 00DD: MOVWF 1B
182 00DE: MOVF 1D,W
183 00DF: ANDLW CF
184 00E0: IORLW 10
185 00E1: MOVWF 1D
186 .................... setup_comparator(NC_NC_NC_NC);
187 00E2: MOVLW 07
188 00E3: BSF 03.5
189 00E4: MOVWF 1C
190 00E5: MOVF 05,W
191 00E6: MOVLW 03
192 00E7: MOVWF 77
193 00E8: DECFSZ 77,F
194 00E9: GOTO 0E8
195 00EA: MOVF 1C,W
196 00EB: BCF 03.5
197 00EC: BCF 0D.6
198 .................... setup_vref(FALSE);
199 00ED: BSF 03.5
200 00EE: CLRF 1D
201 ....................
202 ....................
203 ....................
204 ....................
205 .................... while(TRUE)
206 .................... {
207 .................... //set_timer0(0);
208 .................... for(b=0;b<5;b++)
209 00EF: BCF 03.5
210 00F0: CLRF 23
211 00F1: MOVF 23,W
212 00F2: SUBLW 04
213 00F3: BTFSS 03.0
214 00F4: GOTO 132
215 ....................
216 .................... {
217 .................... //delay=read_adc(); //pwm-ka je nastavena na pevnou hodnotu
218 .................... // set_pwm1_duty(delay);
219 .................... //set_pwm2_duty(delay);
220 ....................
221 ....................
222 .................... poc=get_timer0();
223 00F5: MOVF 01,W
224 00F6: MOVWF 21
225 .................... if (poc!=poc)
226 00F7: MOVF 21,W
227 00F8: SUBWF 21,W
228 00F9: BTFSC 03.2
229 00FA: GOTO 129
230 .................... {
231 .................... poc++;
232 00FB: INCF 21,F
233 ....................
234 .................... cas=get_timer1();
235 00FC: MOVF 0F,W
236 00FD: MOVWF 7A
237 00FE: MOVF 0E,W
238 00FF: MOVWF 77
239 0100: MOVF 0F,W
240 0101: SUBWF 7A,W
241 0102: BTFSS 03.2
242 0103: GOTO 0FC
243 0104: MOVF 77,W
244 0105: MOVWF 22
245 .................... cas++;
246 0106: INCF 22,F
247 .................... /*output_low(PIN_A2);
248 .................... output_high(PIN_A3);
249 .................... delay_us(500);
250 .................... output_high(PIN_A2);
251 .................... output_low(PIN_A3);*/
252 .................... if(cas=~cas)
253 0107: COMF 22,F
254 0108: BTFSC 03.2
255 0109: GOTO 129
256 .................... {
257 .................... output_low(PIN_C4);
258 010A: BCF 20.4
259 010B: MOVF 20,W
260 010C: BSF 03.5
261 010D: MOVWF 07
262 010E: BCF 03.5
263 010F: BCF 07.4
264 .................... output_high(PIN_C5);
265 0110: BCF 20.5
266 0111: MOVF 20,W
267 0112: BSF 03.5
268 0113: MOVWF 07
269 0114: BCF 03.5
270 0115: BSF 07.5
271 .................... delay_ms(300);
272 0116: MOVLW 02
273 0117: MOVWF 24
274 0118: MOVLW 96
275 0119: MOVWF 25
276 011A: CALL 01F
277 011B: DECFSZ 24,F
278 011C: GOTO 118
279 .................... output_high(PIN_C4);
280 011D: BCF 20.4
281 011E: MOVF 20,W
282 011F: BSF 03.5
283 0120: MOVWF 07
284 0121: BCF 03.5
285 0122: BSF 07.4
286 .................... output_low(PIN_C5);
287 0123: BCF 20.5
288 0124: MOVF 20,W
289 0125: BSF 03.5
290 0126: MOVWF 07
291 0127: BCF 03.5
292 0128: BCF 07.5
293 .................... }
294 .................... //!PIP1;
295 .................... //!PIP2;
296 .................... //delay_cycles(300);
297 .................... //PIP1;
298 .................... //PIP2;
299 .................... //delay_ms(110);
300 .................... }
301 ....................
302 ....................
303 ....................
304 .................... delay_ms(500);
305 0129: MOVLW 02
306 012A: MOVWF 24
307 012B: MOVLW FA
308 012C: MOVWF 25
309 012D: CALL 01F
310 012E: DECFSZ 24,F
311 012F: GOTO 12B
312 .................... }
313 0130: INCF 23,F
314 0131: GOTO 0F1
315 ....................
316 ....................
317 .................... printf("\n\r");
318 0132: MOVLW 0A
319 0133: BTFSS 0C.4
320 0134: GOTO 133
321 0135: MOVWF 19
322 0136: MOVLW 0D
323 0137: BTFSS 0C.4
324 0138: GOTO 137
325 0139: MOVWF 19
326 .................... printf("sum of peaks per 1s:\n\r");
327 013A: CLRF 24
328 013B: MOVF 24,W
329 013C: CALL 004
330 013D: INCF 24,F
331 013E: MOVWF 77
332 013F: MOVF 77,W
333 0140: BTFSS 0C.4
334 0141: GOTO 140
335 0142: MOVWF 19
336 0143: MOVLW 16
337 0144: SUBWF 24,W
338 0145: BTFSS 03.2
339 0146: GOTO 13B
340 .................... printf("%u",poc);
341 0147: MOVF 21,W
342 0148: MOVWF 24
343 0149: MOVLW 1B
344 014A: MOVWF 25
345 014B: GOTO 049
346 .................... set_timer0(0);
347 014C: CLRF 01
348 ....................
349 ....................
350 .................... }
351 014D: GOTO 0F0
352 ....................
353 ....................
354 .................... }
355 014E: SLEEP
356  
357 Configuration Fuses:
358 Word 1: 3939 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD WRT_50%