Rev Author Line No. Line
4370 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 24-12-15 11:07
2  
3 Filename: C:\Users\Honza\Documents\PIC\ledbar\main.lst
4  
5 ROM used: 243 words (3%)
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 018
15 0003: NOP
16 .................... #include "main.h"
17 .................... #include <16F887.h>
18 .................... //////// Standard Header file for the PIC16F887 device ////////////////
19 .................... #device PIC16F887
20 .................... #list
21 ....................
22 .................... #device adc=8
23 ....................
24 .................... #FUSES NOWDT //No Watch Dog Timer
25 .................... #FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
26 .................... #FUSES NOPUT //No Power Up Timer
27 .................... #FUSES MCLR //Master Clear pin enabled
28 .................... #FUSES NOPROTECT //Code not protected from reading
29 .................... #FUSES NOCPD //No EE protection
30 .................... #FUSES NOBROWNOUT //No brownout reset
31 .................... #FUSES IESO //Internal External Switch Over mode enabled
32 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
33 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
34 .................... #FUSES NODEBUG //No Debug mode for ICD
35 .................... #FUSES NOWRT //Program memory not write protected
36 .................... #FUSES BORV40 //Brownout reset at 4.0V
37 ....................
38 .................... #use delay(clock=20000000)
39 *
40 0004: MOVLW 23
41 0005: MOVWF 04
42 0006: BCF 03.7
43 0007: MOVF 00,W
44 0008: BTFSC 03.2
45 0009: GOTO 017
46 000A: MOVLW 06
47 000B: MOVWF 78
48 000C: CLRF 77
49 000D: DECFSZ 77,F
50 000E: GOTO 00D
51 000F: DECFSZ 78,F
52 0010: GOTO 00C
53 0011: MOVLW 7B
54 0012: MOVWF 77
55 0013: DECFSZ 77,F
56 0014: GOTO 013
57 0015: DECFSZ 00,F
58 0016: GOTO 00A
59 0017: RETURN
60 ....................
61 ....................
62 ....................
63 ....................
64 .................... #define MAX 1024
65 ....................
66 .................... // Vystup PWM je na nozickach C1 a C2
67 ....................
68 .................... void main()
69 .................... {
70 0018: CLRF 04
71 0019: BCF 03.7
72 001A: MOVLW 1F
73 001B: ANDWF 03,F
74 001C: BSF 03.5
75 001D: BSF 03.6
76 001E: MOVF 09,W
77 001F: ANDLW C0
78 0020: MOVWF 09
79 0021: BCF 03.6
80 0022: BCF 1F.4
81 0023: BCF 1F.5
82 0024: MOVLW 00
83 0025: BSF 03.6
84 0026: MOVWF 08
85 0027: BCF 03.5
86 0028: CLRF 07
87 0029: CLRF 08
88 002A: CLRF 09
89 .................... int16 pwm;
90 ....................
91 .................... setup_adc_ports(NO_ANALOGS);
92 *
93 002E: BSF 03.5
94 002F: BSF 03.6
95 0030: MOVF 09,W
96 0031: ANDLW C0
97 0032: MOVWF 09
98 0033: BCF 03.6
99 0034: BCF 1F.4
100 0035: BCF 1F.5
101 0036: MOVLW 00
102 0037: BSF 03.6
103 0038: MOVWF 08
104 .................... setup_adc(ADC_OFF);
105 0039: BCF 03.5
106 003A: BCF 03.6
107 003B: BCF 1F.0
108 .................... setup_spi(SPI_SS_DISABLED);
109 003C: BCF 14.5
110 003D: BCF 20.5
111 003E: MOVF 20,W
112 003F: BSF 03.5
113 0040: MOVWF 07
114 0041: BCF 03.5
115 0042: BSF 20.4
116 0043: MOVF 20,W
117 0044: BSF 03.5
118 0045: MOVWF 07
119 0046: BCF 03.5
120 0047: BCF 20.3
121 0048: MOVF 20,W
122 0049: BSF 03.5
123 004A: MOVWF 07
124 004B: MOVLW 01
125 004C: BCF 03.5
126 004D: MOVWF 14
127 004E: MOVLW 00
128 004F: BSF 03.5
129 0050: MOVWF 14
130 .................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
131 0051: MOVF 01,W
132 0052: ANDLW C7
133 0053: IORLW 08
134 0054: MOVWF 01
135 .................... setup_timer_1(T1_DISABLED);
136 0055: BCF 03.5
137 0056: CLRF 10
138 .................... setup_timer_2(T2_DIV_BY_1,255,1);
139 0057: MOVLW 00
140 0058: MOVWF 78
141 0059: IORLW 04
142 005A: MOVWF 12
143 005B: MOVLW FF
144 005C: BSF 03.5
145 005D: MOVWF 12
146 .................... setup_ccp1(CCP_PWM);
147 005E: BCF 03.5
148 005F: BCF 20.2
149 0060: MOVF 20,W
150 0061: BSF 03.5
151 0062: MOVWF 07
152 0063: BCF 03.5
153 0064: BCF 07.2
154 0065: BSF 03.5
155 0066: BCF 09.6
156 0067: MOVLW 0C
157 0068: BCF 03.5
158 0069: MOVWF 17
159 006A: BSF 03.5
160 006B: CLRF 1B
161 006C: CLRF 1C
162 006D: MOVLW 01
163 006E: MOVWF 1D
164 .................... setup_ccp2(CCP_PWM);
165 006F: BCF 03.5
166 0070: BCF 20.1
167 0071: MOVF 20,W
168 0072: BSF 03.5
169 0073: MOVWF 07
170 0074: BCF 03.5
171 0075: BCF 07.1
172 0076: MOVLW 0C
173 0077: MOVWF 1D
174 0078: MOVLW 01
175 0079: MOVWF 00
176 .................... set_pwm1_duty(0);
177 007A: CLRF 15
178 .................... set_pwm2_duty(0);
179 007B: CLRF 1B
180 ....................
181 .................... port_b_pullups(TRUE);
182 007C: BSF 03.5
183 007D: MOVWF 15
184 007E: BCF 01.7
185 .................... pwm=0;
186 007F: BCF 03.5
187 0080: CLRF 22
188 0081: CLRF 21
189 ....................
190 ....................
191 .................... // Postupne zhasina a rozsveci stridave dve LED
192 .................... while(TRUE)
193 .................... {
194 .................... while(pwm<MAX)
195 .................... {
196 0082: MOVF 22,W
197 0083: SUBLW 03
198 0084: BTFSS 03.0
199 0085: GOTO 0B8
200 .................... pwm++;
201 0086: INCF 21,F
202 0087: BTFSC 03.2
203 0088: INCF 22,F
204 .................... delay_ms(5);
205 0089: MOVLW 05
206 008A: MOVWF 23
207 008B: CALL 004
208 .................... set_pwm1_duty(pwm);
209 008C: MOVF 22,W
210 008D: MOVWF 79
211 008E: MOVF 21,W
212 008F: MOVWF 78
213 0090: RRF 79,F
214 0091: RRF 78,F
215 0092: RRF 79,F
216 0093: RRF 78,F
217 0094: RRF 79,F
218 0095: MOVF 78,W
219 0096: MOVWF 15
220 0097: RRF 79,F
221 0098: RRF 79,W
222 0099: ANDLW 30
223 009A: MOVWF 77
224 009B: MOVF 17,W
225 009C: ANDLW CF
226 009D: IORWF 77,W
227 009E: MOVWF 17
228 .................... set_pwm2_duty(MAX-pwm);
229 009F: MOVF 21,W
230 00A0: SUBLW 00
231 00A1: MOVWF 23
232 00A2: MOVLW 04
233 00A3: MOVWF 24
234 00A4: MOVF 22,W
235 00A5: BTFSS 03.0
236 00A6: INCFSZ 22,W
237 00A7: SUBWF 24,F
238 00A8: RRF 24,F
239 00A9: RRF 23,F
240 00AA: RRF 24,F
241 00AB: RRF 23,F
242 00AC: RRF 24,F
243 00AD: MOVF 23,W
244 00AE: MOVWF 1B
245 00AF: RRF 24,F
246 00B0: RRF 24,W
247 00B1: ANDLW 30
248 00B2: MOVWF 77
249 00B3: MOVF 1D,W
250 00B4: ANDLW CF
251 00B5: IORWF 77,W
252 00B6: MOVWF 1D
253 .................... };
254 00B7: GOTO 082
255 .................... while(pwm>0)
256 .................... {
257 00B8: MOVF 21,F
258 00B9: BTFSS 03.2
259 00BA: GOTO 0BE
260 00BB: MOVF 22,F
261 00BC: BTFSC 03.2
262 00BD: GOTO 0F1
263 .................... pwm--;
264 00BE: MOVF 21,W
265 00BF: BTFSC 03.2
266 00C0: DECF 22,F
267 00C1: DECF 21,F
268 .................... delay_ms(5);
269 00C2: MOVLW 05
270 00C3: MOVWF 23
271 00C4: CALL 004
272 .................... set_pwm1_duty(pwm);
273 00C5: MOVF 22,W
274 00C6: MOVWF 79
275 00C7: MOVF 21,W
276 00C8: MOVWF 78
277 00C9: RRF 79,F
278 00CA: RRF 78,F
279 00CB: RRF 79,F
280 00CC: RRF 78,F
281 00CD: RRF 79,F
282 00CE: MOVF 78,W
283 00CF: MOVWF 15
284 00D0: RRF 79,F
285 00D1: RRF 79,W
286 00D2: ANDLW 30
287 00D3: MOVWF 77
288 00D4: MOVF 17,W
289 00D5: ANDLW CF
290 00D6: IORWF 77,W
291 00D7: MOVWF 17
292 .................... set_pwm2_duty(MAX-pwm);
293 00D8: MOVF 21,W
294 00D9: SUBLW 00
295 00DA: MOVWF 23
296 00DB: MOVLW 04
297 00DC: MOVWF 24
298 00DD: MOVF 22,W
299 00DE: BTFSS 03.0
300 00DF: INCFSZ 22,W
301 00E0: SUBWF 24,F
302 00E1: RRF 24,F
303 00E2: RRF 23,F
304 00E3: RRF 24,F
305 00E4: RRF 23,F
306 00E5: RRF 24,F
307 00E6: MOVF 23,W
308 00E7: MOVWF 1B
309 00E8: RRF 24,F
310 00E9: RRF 24,W
311 00EA: ANDLW 30
312 00EB: MOVWF 77
313 00EC: MOVF 1D,W
314 00ED: ANDLW CF
315 00EE: IORWF 77,W
316 00EF: MOVWF 1D
317 .................... }
318 00F0: GOTO 0B8
319 .................... }
320 00F1: GOTO 082
321 .................... }
322 00F2: SLEEP
323  
324 Configuration Fuses:
325 Word 1: 2CF2 HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
326 Word 2: 3FFF NOWRT BORV40