Rev 160 Rev 165
Line 1... Line 1...
1 CCS PCM C Compiler, Version 4.059d, 15399 03-III-07 19:39 1 CCS PCM C Compiler, Version 4.059d, 15399 19-III-07 15:20
2   2  
3 Filename: main.lst 3 Filename: main.lst
4   4  
5 ROM used: 252 words (12%) 5 ROM used: 268 words (13%)
6 Largest free fragment is 1796 6 Largest free fragment is 1780
7 RAM used: 8 (2%) at main() level 7 RAM used: 8 (2%) at main() level
8 8 (2%) worst case 8 8 (2%) worst case
9 Stack: 0 locations 9 Stack: 0 locations
10   10  
11 * 11 *
12 0000: MOVLW 00 12 0000: MOVLW 00
13 0001: MOVWF 0A 13 0001: MOVWF 0A
14 0002: GOTO 004 14 0002: GOTO 004
15 0003: NOP 15 0003: NOP
16 .................... /**** Analog to Digital Converter ****/ 16 ....................
17 .................... #include "main.h" 17 .................... #include "main.h"
18 .................... #include <16F877A.h> 18 .................... #include <16F877A.h>
19 .................... //////// Standard Header file for the PIC16F877A device //////////////// 19 .................... //////// Standard Header file for the PIC16F877A device ////////////////
20 .................... #device PIC16F877A 20 .................... #device PIC16F877A
21 .................... #list 21 .................... #list
Line 62... Line 62...
62 0012: BSF 1F.1 62 0012: BSF 1F.1
63 0013: BSF 1F.2 63 0013: BSF 1F.2
64 0014: BCF 1F.3 64 0014: BCF 1F.3
65 0015: MOVLW 07 65 0015: MOVLW 07
66 0016: MOVWF 1C 66 0016: MOVWF 1C
67 .................... int8 t; // Promenna pro nacteni hodnoty z potenciometru 67 .................... int8 t; // Promenna pro nacteni hodnoty z cidla
68 .................... 68 ....................
69 .................... setup_adc_ports(AN0); // Povolime analogovy vstup 0 69 .................... setup_adc_ports(AN0); // Povolime analogovy vstup 0
70 * 70 *
71 001A: BSF 03.5 71 001A: BSF 03.5
72 001B: BCF 1F.0 72 001B: BCF 1F.0
Line 154... Line 154...
154 005D: CLRWDT 154 005D: CLRWDT
155 005E: MOVLW 06 155 005E: MOVLW 06
156 005F: MOVWF 77 156 005F: MOVWF 77
157 0060: DECFSZ 77,F 157 0060: DECFSZ 77,F
158 0061: GOTO 060 158 0061: GOTO 060
159 .................... //t=read_adc(); // Prvni precteni cidla -  
160 .................... 159 ....................
-   160 ....................
-   161 ....................
161 .................... while(TRUE){ 162 .................... while(TRUE){
162 .................... t=read_adc(); // Prvni precteni cidla 163 .................... t=read_adc(); // Prvni precteni cidla
163 0062: BSF 1F.2 164 0062: BSF 1F.2
164 0063: BTFSC 1F.2 165 0063: BTFSC 1F.2
165 0064: GOTO 063 166 0064: GOTO 063
166 0065: MOVF 1E,W 167 0065: MOVF 1E,W
167 0066: MOVWF 21 168 0066: MOVWF 21
168 .................... 169 .................... //printf("%d\n\r",t);
169 .................... 170 ....................
170 .................... if(t>00&&t<50){ 171 .................... if(t>00&&t<40){
171 0067: MOVF 21,F 172 0067: MOVF 21,F
172 0068: BTFSC 03.2 173 0068: BTFSC 03.2
173 0069: GOTO 073 174 0069: GOTO 07B
174 006A: MOVF 21,W 175 006A: MOVF 21,W
175 006B: SUBLW 31 176 006B: SUBLW 27
176 006C: BTFSS 03.0 177 006C: BTFSS 03.0
177 006D: GOTO 073 178 006D: GOTO 07B
178 .................... output_high(LED1); 179 .................... output_low(LED2);
179 006E: BSF 03.5 180 006E: BSF 03.5
180 006F: BCF 05.2 181 006F: BCF 05.3
181 0070: BCF 03.5 182 0070: BCF 03.5
-   183 0071: BCF 05.3
-   184 .................... output_low(LED3);
-   185 0072: BSF 03.5
-   186 0073: BCF 05.5
-   187 0074: BCF 03.5
-   188 0075: BCF 05.5
-   189 .................... output_high(LED1);
-   190 0076: BSF 03.5
-   191 0077: BCF 05.2
-   192 0078: BCF 03.5
182 0071: BSF 05.2 193 0079: BSF 05.2
183 .................... //rozsvit modrou 194 .................... //rozsvit modrou
184 .................... } 195 .................... }
185 .................... else if(t>50&&t<80){ 196 .................... else if(t>39&&t<60){
186 0072: GOTO 0FA 197 007A: GOTO 10A
187 0073: MOVF 21,W 198 007B: MOVF 21,W
188 0074: SUBLW 32 199 007C: SUBLW 27
189 0075: BTFSC 03.0 200 007D: BTFSC 03.0
190 0076: GOTO 0A4 201 007E: GOTO 0B0
191 0077: MOVF 21,W 202 007F: MOVF 21,W
192 0078: SUBLW 4F 203 0080: SUBLW 3B
193 0079: BTFSS 03.0 204 0081: BTFSS 03.0
194 007A: GOTO 0A4 205 0082: GOTO 0B0
-   206 .................... output_low(LED3);
-   207 0083: BSF 03.5
-   208 0084: BCF 05.5
-   209 0085: BCF 03.5
-   210 0086: BCF 05.5
195 .................... output_high (LED1); // Zhasneme LED 211 .................... output_high (LED1); // Zhasneme LED
196 007B: BSF 03.5 212 0087: BSF 03.5
197 007C: BCF 05.2 213 0088: BCF 05.2
198 007D: BCF 03.5 214 0089: BCF 03.5
199 007E: BSF 05.2 215 008A: BSF 05.2
200 .................... delay_us(100); 216 .................... delay_us(100);
201 007F: CLRWDT 217 008B: CLRWDT
202 0080: MOVLW 20 218 008C: MOVLW 20
203 0081: MOVWF 77 219 008D: MOVWF 77
204 0082: DECFSZ 77,F 220 008E: DECFSZ 77,F
205 0083: GOTO 082 221 008F: GOTO 08E
206 0084: GOTO 085 222 0090: GOTO 091
207 .................... output_low (LED1); // Rozsvitime LED 223 .................... output_low (LED1); // Rozsvitime LED
208 0085: BSF 03.5 224 0091: BSF 03.5
209 0086: BCF 05.2 225 0092: BCF 05.2
210 0087: BCF 03.5 226 0093: BCF 03.5
211 0088: BCF 05.2 227 0094: BCF 05.2
212 .................... delay_us(100); 228 .................... delay_us(100);
213 0089: CLRWDT 229 0095: CLRWDT
214 008A: MOVLW 20 230 0096: MOVLW 20
215 008B: MOVWF 77 231 0097: MOVWF 77
216 008C: DECFSZ 77,F 232 0098: DECFSZ 77,F
217 008D: GOTO 08C 233 0099: GOTO 098
218 008E: GOTO 08F 234 009A: GOTO 09B
219 .................... output_low (LED2); // Rozsvitime LED 235 .................... output_low (LED2); // Rozsvitime LED
220 008F: BSF 03.5 236 009B: BSF 03.5
221 0090: BCF 05.3 237 009C: BCF 05.3
222 0091: BCF 03.5 238 009D: BCF 03.5
223 0092: BCF 05.3 239 009E: BCF 05.3
224 .................... delay_us(100); 240 .................... delay_us(100);
225 0093: CLRWDT 241 009F: CLRWDT
226 0094: MOVLW 20 242 00A0: MOVLW 20
227 0095: MOVWF 77 243 00A1: MOVWF 77
228 0096: DECFSZ 77,F 244 00A2: DECFSZ 77,F
229 0097: GOTO 096 245 00A3: GOTO 0A2
230 0098: GOTO 099 246 00A4: GOTO 0A5
231 .................... output_high (LED2); // Zhasneme LED 247 .................... output_high (LED2); // Zhasneme LED
232 0099: BSF 03.5 248 00A5: BSF 03.5
233 009A: BCF 05.3 249 00A6: BCF 05.3
234 009B: BCF 03.5 250 00A7: BCF 03.5
235 009C: BSF 05.3 251 00A8: BSF 05.3
236 .................... delay_us(100); 252 .................... delay_us(100);
237 009D: CLRWDT 253 00A9: CLRWDT
238 009E: MOVLW 20 254 00AA: MOVLW 20
239 009F: MOVWF 77 255 00AB: MOVWF 77
240 00A0: DECFSZ 77,F 256 00AC: DECFSZ 77,F
241 00A1: GOTO 0A0 257 00AD: GOTO 0AC
242 00A2: GOTO 0A3 258 00AE: GOTO 0AF
243 .................... //rozsvit modrou+zelenou 259 .................... //rozsvit modrou+zelenou
244 .................... } 260 .................... }
245 .................... else if(t>80&&t<120){ 261 .................... else if(t>59&&t<80){
246 00A3: GOTO 0FA 262 00AF: GOTO 10A
247 00A4: MOVF 21,W 263 00B0: MOVF 21,W
248 00A5: SUBLW 50 264 00B1: SUBLW 3B
249 00A6: BTFSC 03.0 265 00B2: BTFSC 03.0
250 00A7: GOTO 0C1 266 00B3: GOTO 0C5
251 00A8: MOVF 21,W 267 00B4: MOVF 21,W
252 00A9: SUBLW 77 268 00B5: SUBLW 4F
253 00AA: BTFSS 03.0 269 00B6: BTFSS 03.0
254 00AB: GOTO 0C1 270 00B7: GOTO 0C5
-   271 .................... output_low(LED3);
-   272 00B8: BSF 03.5
-   273 00B9: BCF 05.5
-   274 00BA: BCF 03.5
-   275 00BB: BCF 05.5
-   276 .................... output_low(LED1);
-   277 00BC: BSF 03.5
-   278 00BD: BCF 05.2
-   279 00BE: BCF 03.5
-   280 00BF: BCF 05.2
255 .................... //output_high(LED2); 281 .................... output_high(LED2);
-   282 00C0: BSF 03.5
-   283 00C1: BCF 05.3
-   284 00C2: BCF 03.5
-   285 00C3: BSF 05.3
256 .................... //rozvit zelenou 286 .................... //rozvit zelenou
257 .................... output_low (LED2); // Rozsvitime LED -  
258 00AC: BSF 03.5 -  
259 00AD: BCF 05.3 -  
260 00AE: BCF 03.5 -  
261 00AF: BCF 05.3 -  
262 .................... delay_us(100); -  
263 00B0: CLRWDT -  
264 00B1: MOVLW 20 -  
265 00B2: MOVWF 77 -  
266 00B3: DECFSZ 77,F -  
267 00B4: GOTO 0B3 -  
268 00B5: GOTO 0B6 -  
269 .................... output_high (LED2); // Zhasneme LED -  
270 00B6: BSF 03.5 -  
271 00B7: BCF 05.3 -  
272 00B8: BCF 03.5 -  
273 00B9: BSF 05.3 -  
274 .................... delay_us(100); -  
275 00BA: CLRWDT -  
276 00BB: MOVLW 20 -  
277 00BC: MOVWF 77 -  
278 00BD: DECFSZ 77,F -  
279 00BE: GOTO 0BD -  
280 00BF: GOTO 0C0 -  
281 .................... } 287 .................... }
282 .................... else if(t>120&&t<160){ 288 .................... else if(t>79&&t<100){
283 00C0: GOTO 0FA -  
284 00C1: MOVF 21,W -  
285 00C2: SUBLW 78 -  
286 00C3: BTFSC 03.0 -  
287 00C4: GOTO 0F2 289 00C4: GOTO 10A
288 00C5: MOVF 21,W 290 00C5: MOVF 21,W
289 00C6: SUBLW 9F 291 00C6: SUBLW 4F
290 00C7: BTFSS 03.0 292 00C7: BTFSC 03.0
291 00C8: GOTO 0F2 293 00C8: GOTO 0FA
-   294 00C9: MOVF 21,W
-   295 00CA: SUBLW 63
-   296 00CB: BTFSS 03.0
-   297 00CC: GOTO 0FA
-   298 .................... output_low(LED1);
-   299 00CD: BSF 03.5
-   300 00CE: BCF 05.2
-   301 00CF: BCF 03.5
-   302 00D0: BCF 05.2
292 .................... output_high (LED3); // Zhasneme LED 303 .................... output_high (LED3); // Zhasneme LED
293 00C9: BSF 03.5 304 00D1: BSF 03.5
294 00CA: BCF 05.5 305 00D2: BCF 05.5
295 00CB: BCF 03.5 306 00D3: BCF 03.5
296 00CC: BSF 05.5 307 00D4: BSF 05.5
297 .................... delay_us(100); 308 .................... delay_us(100);
298 00CD: CLRWDT 309 00D5: CLRWDT
299 00CE: MOVLW 20 310 00D6: MOVLW 20
300 00CF: MOVWF 77 311 00D7: MOVWF 77
301 00D0: DECFSZ 77,F 312 00D8: DECFSZ 77,F
302 00D1: GOTO 0D0 313 00D9: GOTO 0D8
303 00D2: GOTO 0D3 314 00DA: GOTO 0DB
304 .................... output_low (LED3); // Rozsvitime LED 315 .................... output_low (LED3); // Rozsvitime LED
305 00D3: BSF 03.5 316 00DB: BSF 03.5
306 00D4: BCF 05.5 317 00DC: BCF 05.5
307 00D5: BCF 03.5 318 00DD: BCF 03.5
308 00D6: BCF 05.5 319 00DE: BCF 05.5
309 .................... delay_us(100); 320 .................... delay_us(100);
310 00D7: CLRWDT 321 00DF: CLRWDT
311 00D8: MOVLW 20 322 00E0: MOVLW 20
312 00D9: MOVWF 77 323 00E1: MOVWF 77
313 00DA: DECFSZ 77,F 324 00E2: DECFSZ 77,F
314 00DB: GOTO 0DA 325 00E3: GOTO 0E2
315 00DC: GOTO 0DD 326 00E4: GOTO 0E5
316 .................... output_low (LED2); // Rozsvitime LED 327 .................... output_low (LED2); // Rozsvitime LED
317 00DD: BSF 03.5 328 00E5: BSF 03.5
318 00DE: BCF 05.3 329 00E6: BCF 05.3
319 00DF: BCF 03.5 330 00E7: BCF 03.5
320 00E0: BCF 05.3 331 00E8: BCF 05.3
321 .................... delay_us(100); 332 .................... delay_us(100);
322 00E1: CLRWDT 333 00E9: CLRWDT
323 00E2: MOVLW 20 334 00EA: MOVLW 20
324 00E3: MOVWF 77 335 00EB: MOVWF 77
325 00E4: DECFSZ 77,F 336 00EC: DECFSZ 77,F
326 00E5: GOTO 0E4 337 00ED: GOTO 0EC
327 00E6: GOTO 0E7 338 00EE: GOTO 0EF
328 .................... output_high (LED2); // Zhasneme LED 339 .................... output_high (LED2); // Zhasneme LED
329 00E7: BSF 03.5 340 00EF: BSF 03.5
330 00E8: BCF 05.3 341 00F0: BCF 05.3
331 00E9: BCF 03.5 342 00F1: BCF 03.5
332 00EA: BSF 05.3 343 00F2: BSF 05.3
333 .................... delay_us(100); 344 .................... delay_us(100);
334 00EB: CLRWDT 345 00F3: CLRWDT
335 00EC: MOVLW 20 346 00F4: MOVLW 20
336 00ED: MOVWF 77 347 00F5: MOVWF 77
337 00EE: DECFSZ 77,F 348 00F6: DECFSZ 77,F
338 00EF: GOTO 0EE 349 00F7: GOTO 0F6
339 00F0: GOTO 0F1 350 00F8: GOTO 0F9
340 .................... //rozsvit zelenou+cervenou 351 .................... //rozsvit zelenou+cervenou
341 .................... } 352 .................... }
342 .................... else if(t>160){ 353 .................... else if(t>99){
343 00F1: GOTO 0FA 354 00F9: GOTO 10A
344 00F2: MOVF 21,W 355 00FA: MOVF 21,W
345 00F3: SUBLW A0 356 00FB: SUBLW 63
346 00F4: BTFSC 03.0 357 00FC: BTFSC 03.0
347 00F5: GOTO 0FA 358 00FD: GOTO 10A
-   359 .................... output_low(LED1);
-   360 00FE: BSF 03.5
-   361 00FF: BCF 05.2
-   362 0100: BCF 03.5
-   363 0101: BCF 05.2
-   364 .................... output_low(LED2);
-   365 0102: BSF 03.5
-   366 0103: BCF 05.3
-   367 0104: BCF 03.5
-   368 0105: BCF 05.3
348 .................... output_high(LED3); 369 .................... output_high(LED3);
349 00F6: BSF 03.5 370 0106: BSF 03.5
350 00F7: BCF 05.5 371 0107: BCF 05.5
351 00F8: BCF 03.5 372 0108: BCF 03.5
352 00F9: BSF 05.5 373 0109: BSF 05.5
353 .................... //rozsvit cervenou 374 .................... //rozsvit cervenou
354 .................... } 375 .................... }
355 .................... -  
356 .................... }} 376 .................... }}
357 00FA: GOTO 062 377 010A: GOTO 062
358 .................... 378 ....................
359 .................... 379 ....................
360 00FB: SLEEP 380 010B: SLEEP
361   381  
362 Configuration Fuses: 382 Configuration Fuses:
363 Word 1: 3939 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD WRT_50% 383 Word 1: 3939 XT NOWDT NOPUT NODEBUG NOPROTECT NOBROWNOUT NOLVP NOCPD WRT_50%