1045 |
jacho |
1 |
CCS PCM C Compiler, Version 4.106, 47914 06-4-13 21:54 |
|
|
2 |
|
|
|
3 |
Filename: c:\users\honza\documents\pic\i2c_bat_pam\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 909 words (11%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 6 (2%) at main() level |
|
|
8 |
21 (6%) worst case |
|
|
9 |
Stack: 2 locations |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 01 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 177 |
|
|
15 |
0003: NOP |
|
|
16 |
.................... #include "C:\Users\Honza\Documents\pic\I2C_bat_pam\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 INTRC //Internal RC Osc |
|
|
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=8000000) |
|
|
39 |
* |
|
|
40 |
00BE: MOVLW 2B |
|
|
41 |
00BF: MOVWF 04 |
|
|
42 |
00C0: BCF 03.7 |
|
|
43 |
00C1: MOVF 00,W |
|
|
44 |
00C2: BTFSC 03.2 |
|
|
45 |
00C3: GOTO 0D1 |
|
|
46 |
00C4: MOVLW 02 |
|
|
47 |
00C5: MOVWF 78 |
|
|
48 |
00C6: CLRF 77 |
|
|
49 |
00C7: DECFSZ 77,F |
|
|
50 |
00C8: GOTO 0C7 |
|
|
51 |
00C9: DECFSZ 78,F |
|
|
52 |
00CA: GOTO 0C6 |
|
|
53 |
00CB: MOVLW 97 |
|
|
54 |
00CC: MOVWF 77 |
|
|
55 |
00CD: DECFSZ 77,F |
|
|
56 |
00CE: GOTO 0CD |
|
|
57 |
00CF: DECFSZ 00,F |
|
|
58 |
00D0: GOTO 0C4 |
|
|
59 |
00D1: RETURN |
|
|
60 |
.................... |
|
|
61 |
.................... |
|
|
62 |
.................... #define EEPROM_SDA PIN_B0 |
|
|
63 |
.................... #define EEPROM_SCL PIN_B1 |
|
|
64 |
.................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL) |
|
|
65 |
* |
|
|
66 |
008A: MOVLW 08 |
|
|
67 |
008B: MOVWF 78 |
|
|
68 |
008C: NOP |
|
|
69 |
008D: BCF 06.1 |
|
|
70 |
008E: BSF 03.5 |
|
|
71 |
008F: BCF 06.1 |
|
|
72 |
0090: NOP |
|
|
73 |
0091: BCF 03.5 |
|
|
74 |
0092: RLF 2B,F |
|
|
75 |
0093: BCF 06.0 |
|
|
76 |
0094: BTFSS 03.0 |
|
|
77 |
0095: GOTO 099 |
|
|
78 |
0096: BSF 03.5 |
|
|
79 |
0097: BSF 06.0 |
|
|
80 |
0098: BCF 03.5 |
|
|
81 |
0099: BTFSC 03.0 |
|
|
82 |
009A: GOTO 09E |
|
|
83 |
009B: BSF 03.5 |
|
|
84 |
009C: BCF 06.0 |
|
|
85 |
009D: BCF 03.5 |
|
|
86 |
009E: BSF 03.5 |
|
|
87 |
009F: BSF 06.1 |
|
|
88 |
00A0: BCF 03.5 |
|
|
89 |
00A1: BTFSS 06.1 |
|
|
90 |
00A2: GOTO 0A1 |
|
|
91 |
00A3: DECFSZ 78,F |
|
|
92 |
00A4: GOTO 08C |
|
|
93 |
00A5: NOP |
|
|
94 |
00A6: BCF 06.1 |
|
|
95 |
00A7: BSF 03.5 |
|
|
96 |
00A8: BCF 06.1 |
|
|
97 |
00A9: NOP |
|
|
98 |
00AA: BSF 06.0 |
|
|
99 |
00AB: NOP |
|
|
100 |
00AC: NOP |
|
|
101 |
00AD: BSF 06.1 |
|
|
102 |
00AE: BCF 03.5 |
|
|
103 |
00AF: BTFSS 06.1 |
|
|
104 |
00B0: GOTO 0AF |
|
|
105 |
00B1: CLRF 78 |
|
|
106 |
00B2: NOP |
|
|
107 |
00B3: BTFSC 06.0 |
|
|
108 |
00B4: BSF 78.0 |
|
|
109 |
00B5: BCF 06.1 |
|
|
110 |
00B6: BSF 03.5 |
|
|
111 |
00B7: BCF 06.1 |
|
|
112 |
00B8: BCF 03.5 |
|
|
113 |
00B9: BCF 06.0 |
|
|
114 |
00BA: BSF 03.5 |
|
|
115 |
00BB: BCF 06.0 |
|
|
116 |
00BC: BCF 03.5 |
|
|
117 |
00BD: RETURN |
|
|
118 |
* |
|
|
119 |
00D2: MOVLW 08 |
|
|
120 |
00D3: MOVWF 2C |
|
|
121 |
00D4: MOVF 77,W |
|
|
122 |
00D5: MOVWF 2D |
|
|
123 |
00D6: BSF 03.5 |
|
|
124 |
00D7: BSF 06.0 |
|
|
125 |
00D8: NOP |
|
|
126 |
00D9: BSF 06.1 |
|
|
127 |
00DA: BCF 03.5 |
|
|
128 |
00DB: BTFSS 06.1 |
|
|
129 |
00DC: GOTO 0DB |
|
|
130 |
00DD: BTFSC 06.0 |
|
|
131 |
00DE: BSF 03.0 |
|
|
132 |
00DF: BTFSS 06.0 |
|
|
133 |
00E0: BCF 03.0 |
|
|
134 |
00E1: RLF 78,F |
|
|
135 |
00E2: NOP |
|
|
136 |
00E3: BSF 03.5 |
|
|
137 |
00E4: BCF 06.1 |
|
|
138 |
00E5: BCF 03.5 |
|
|
139 |
00E6: BCF 06.1 |
|
|
140 |
00E7: DECFSZ 2C,F |
|
|
141 |
00E8: GOTO 0D6 |
|
|
142 |
00E9: BSF 03.5 |
|
|
143 |
00EA: BSF 06.0 |
|
|
144 |
00EB: NOP |
|
|
145 |
00EC: BCF 03.5 |
|
|
146 |
00ED: BCF 06.0 |
|
|
147 |
00EE: MOVF 2D,W |
|
|
148 |
00EF: BTFSC 03.2 |
|
|
149 |
00F0: GOTO 0F4 |
|
|
150 |
00F1: BSF 03.5 |
|
|
151 |
00F2: BCF 06.0 |
|
|
152 |
00F3: BCF 03.5 |
|
|
153 |
00F4: NOP |
|
|
154 |
00F5: BSF 03.5 |
|
|
155 |
00F6: BSF 06.1 |
|
|
156 |
00F7: BCF 03.5 |
|
|
157 |
00F8: BTFSS 06.1 |
|
|
158 |
00F9: GOTO 0F8 |
|
|
159 |
00FA: NOP |
|
|
160 |
00FB: BCF 06.1 |
|
|
161 |
00FC: BSF 03.5 |
|
|
162 |
00FD: BCF 06.1 |
|
|
163 |
00FE: NOP |
|
|
164 |
00FF: BCF 03.5 |
|
|
165 |
0100: BCF 06.0 |
|
|
166 |
0101: BSF 03.5 |
|
|
167 |
0102: BCF 06.0 |
|
|
168 |
0103: BCF 03.5 |
|
|
169 |
0104: BCF 0A.3 |
|
|
170 |
0105: BCF 0A.4 |
|
|
171 |
0106: GOTO 2C1 (RETURN) |
|
|
172 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD |
|
|
173 |
* |
|
|
174 |
0020: BSF 03.5 |
|
|
175 |
0021: BCF 06.3 |
|
|
176 |
0022: BCF 03.5 |
|
|
177 |
0023: BCF 06.3 |
|
|
178 |
0024: MOVLW 08 |
|
|
179 |
0025: MOVWF 78 |
|
|
180 |
0026: GOTO 027 |
|
|
181 |
0027: NOP |
|
|
182 |
0028: BSF 78.7 |
|
|
183 |
0029: GOTO 038 |
|
|
184 |
002A: BCF 78.7 |
|
|
185 |
002B: RRF 2F,F |
|
|
186 |
002C: BTFSC 03.0 |
|
|
187 |
002D: BSF 06.3 |
|
|
188 |
002E: BTFSS 03.0 |
|
|
189 |
002F: BCF 06.3 |
|
|
190 |
0030: BSF 78.6 |
|
|
191 |
0031: GOTO 038 |
|
|
192 |
0032: BCF 78.6 |
|
|
193 |
0033: DECFSZ 78,F |
|
|
194 |
0034: GOTO 02B |
|
|
195 |
0035: GOTO 036 |
|
|
196 |
0036: NOP |
|
|
197 |
0037: BSF 06.3 |
|
|
198 |
0038: MOVLW 3F |
|
|
199 |
0039: MOVWF 04 |
|
|
200 |
003A: DECFSZ 04,F |
|
|
201 |
003B: GOTO 03A |
|
|
202 |
003C: NOP |
|
|
203 |
003D: BTFSC 78.7 |
|
|
204 |
003E: GOTO 02A |
|
|
205 |
003F: BTFSC 78.6 |
|
|
206 |
0040: GOTO 032 |
|
|
207 |
0041: RETURN |
|
|
208 |
.................... |
|
|
209 |
.................... |
|
|
210 |
.................... void main() |
|
|
211 |
.................... { |
|
|
212 |
* |
|
|
213 |
0177: CLRF 04 |
|
|
214 |
0178: BCF 03.7 |
|
|
215 |
0179: MOVLW 1F |
|
|
216 |
017A: ANDWF 03,F |
|
|
217 |
017B: MOVLW 71 |
|
|
218 |
017C: BSF 03.5 |
|
|
219 |
017D: MOVWF 0F |
|
|
220 |
017E: MOVF 0F,W |
|
|
221 |
017F: BCF 06.3 |
|
|
222 |
0180: BCF 03.5 |
|
|
223 |
0181: BSF 06.3 |
|
|
224 |
0182: BSF 03.5 |
|
|
225 |
0183: BSF 03.6 |
|
|
226 |
0184: MOVF 09,W |
|
|
227 |
0185: ANDLW C0 |
|
|
228 |
0186: MOVWF 09 |
|
|
229 |
0187: BCF 03.6 |
|
|
230 |
0188: BCF 1F.4 |
|
|
231 |
0189: BCF 1F.5 |
|
|
232 |
018A: MOVLW 00 |
|
|
233 |
018B: BSF 03.6 |
|
|
234 |
018C: MOVWF 08 |
|
|
235 |
018D: BCF 03.5 |
|
|
236 |
018E: CLRF 07 |
|
|
237 |
018F: CLRF 08 |
|
|
238 |
0190: CLRF 09 |
|
|
239 |
.................... |
|
|
240 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
241 |
* |
|
|
242 |
0194: BSF 03.5 |
|
|
243 |
0195: BSF 03.6 |
|
|
244 |
0196: MOVF 09,W |
|
|
245 |
0197: ANDLW C0 |
|
|
246 |
0198: MOVWF 09 |
|
|
247 |
0199: BCF 03.6 |
|
|
248 |
019A: BCF 1F.4 |
|
|
249 |
019B: BCF 1F.5 |
|
|
250 |
019C: MOVLW 00 |
|
|
251 |
019D: BSF 03.6 |
|
|
252 |
019E: MOVWF 08 |
|
|
253 |
.................... setup_adc(ADC_CLOCK_DIV_2); |
|
|
254 |
019F: BCF 03.5 |
|
|
255 |
01A0: BCF 03.6 |
|
|
256 |
01A1: BCF 1F.6 |
|
|
257 |
01A2: BCF 1F.7 |
|
|
258 |
01A3: BSF 03.5 |
|
|
259 |
01A4: BCF 1F.7 |
|
|
260 |
01A5: BCF 03.5 |
|
|
261 |
01A6: BSF 1F.0 |
|
|
262 |
.................... setup_spi(SPI_SS_DISABLED); |
|
|
263 |
01A7: BCF 14.5 |
|
|
264 |
01A8: BCF 20.5 |
|
|
265 |
01A9: MOVF 20,W |
|
|
266 |
01AA: BSF 03.5 |
|
|
267 |
01AB: MOVWF 07 |
|
|
268 |
01AC: BCF 03.5 |
|
|
269 |
01AD: BSF 20.4 |
|
|
270 |
01AE: MOVF 20,W |
|
|
271 |
01AF: BSF 03.5 |
|
|
272 |
01B0: MOVWF 07 |
|
|
273 |
01B1: BCF 03.5 |
|
|
274 |
01B2: BCF 20.3 |
|
|
275 |
01B3: MOVF 20,W |
|
|
276 |
01B4: BSF 03.5 |
|
|
277 |
01B5: MOVWF 07 |
|
|
278 |
01B6: MOVLW 01 |
|
|
279 |
01B7: BCF 03.5 |
|
|
280 |
01B8: MOVWF 14 |
|
|
281 |
01B9: MOVLW 00 |
|
|
282 |
01BA: BSF 03.5 |
|
|
283 |
01BB: MOVWF 14 |
|
|
284 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
285 |
01BC: MOVF 01,W |
|
|
286 |
01BD: ANDLW C7 |
|
|
287 |
01BE: IORLW 08 |
|
|
288 |
01BF: MOVWF 01 |
|
|
289 |
.................... setup_timer_1(T1_DISABLED); |
|
|
290 |
01C0: BCF 03.5 |
|
|
291 |
01C1: CLRF 10 |
|
|
292 |
.................... setup_timer_2(T2_DISABLED,0,1); |
|
|
293 |
01C2: MOVLW 00 |
|
|
294 |
01C3: MOVWF 78 |
|
|
295 |
01C4: MOVWF 12 |
|
|
296 |
01C5: MOVLW 00 |
|
|
297 |
01C6: BSF 03.5 |
|
|
298 |
01C7: MOVWF 12 |
|
|
299 |
.................... setup_ccp1(CCP_OFF); |
|
|
300 |
01C8: BCF 03.5 |
|
|
301 |
01C9: BSF 20.2 |
|
|
302 |
01CA: MOVF 20,W |
|
|
303 |
01CB: BSF 03.5 |
|
|
304 |
01CC: MOVWF 07 |
|
|
305 |
01CD: BCF 03.5 |
|
|
306 |
01CE: CLRF 17 |
|
|
307 |
01CF: BSF 03.5 |
|
|
308 |
01D0: CLRF 1B |
|
|
309 |
01D1: CLRF 1C |
|
|
310 |
01D2: MOVLW 01 |
|
|
311 |
01D3: MOVWF 1D |
|
|
312 |
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
|
|
313 |
01D4: BCF 03.5 |
|
|
314 |
01D5: BSF 03.6 |
|
|
315 |
01D6: CLRF 07 |
|
|
316 |
01D7: CLRF 08 |
|
|
317 |
01D8: CLRF 09 |
|
|
318 |
.................... |
|
|
319 |
.................... printf("Simple Thermomether \r\n",); |
|
|
320 |
01D9: MOVLW 04 |
|
|
321 |
01DA: MOVWF 0D |
|
|
322 |
01DB: MOVLW 00 |
|
|
323 |
01DC: MOVWF 0F |
|
|
324 |
01DD: BCF 03.6 |
|
|
325 |
01DE: GOTO 042 |
|
|
326 |
.................... unsigned int8 STAV1,STAV2; |
|
|
327 |
.................... |
|
|
328 |
.................... unsigned int16 SOUCET, SOUCET1; |
|
|
329 |
.................... unsigned int8 LSB=0,ZK,k=0; |
|
|
330 |
01DF: CLRF 27 |
|
|
331 |
01E0: CLRF 29 |
|
|
332 |
.................... //unsigned int8 |
|
|
333 |
.................... |
|
|
334 |
.................... while(TRUE) |
|
|
335 |
.................... { |
|
|
336 |
.................... |
|
|
337 |
.................... |
|
|
338 |
.................... |
|
|
339 |
.................... |
|
|
340 |
.................... i2c_start(); //blockdatacontrol |
|
|
341 |
01E1: BSF 03.5 |
|
|
342 |
01E2: BSF 06.0 |
|
|
343 |
01E3: NOP |
|
|
344 |
01E4: BSF 06.1 |
|
|
345 |
01E5: NOP |
|
|
346 |
01E6: BCF 03.5 |
|
|
347 |
01E7: BCF 06.0 |
|
|
348 |
01E8: BSF 03.5 |
|
|
349 |
01E9: BCF 06.0 |
|
|
350 |
01EA: NOP |
|
|
351 |
01EB: BCF 03.5 |
|
|
352 |
01EC: BCF 06.1 |
|
|
353 |
01ED: BSF 03.5 |
|
|
354 |
01EE: BCF 06.1 |
|
|
355 |
.................... I2C_Write(0xAA); |
|
|
356 |
01EF: MOVLW AA |
|
|
357 |
01F0: BCF 03.5 |
|
|
358 |
01F1: MOVWF 2B |
|
|
359 |
01F2: CALL 08A |
|
|
360 |
.................... I2C_write(0x61); |
|
|
361 |
01F3: MOVLW 61 |
|
|
362 |
01F4: MOVWF 2B |
|
|
363 |
01F5: CALL 08A |
|
|
364 |
.................... i2c_start(); |
|
|
365 |
01F6: BSF 03.5 |
|
|
366 |
01F7: BSF 06.0 |
|
|
367 |
01F8: NOP |
|
|
368 |
01F9: BSF 06.1 |
|
|
369 |
01FA: NOP |
|
|
370 |
01FB: BCF 03.5 |
|
|
371 |
01FC: BTFSS 06.1 |
|
|
372 |
01FD: GOTO 1FC |
|
|
373 |
01FE: BCF 06.0 |
|
|
374 |
01FF: BSF 03.5 |
|
|
375 |
0200: BCF 06.0 |
|
|
376 |
0201: NOP |
|
|
377 |
0202: BCF 03.5 |
|
|
378 |
0203: BCF 06.1 |
|
|
379 |
0204: BSF 03.5 |
|
|
380 |
0205: BCF 06.1 |
|
|
381 |
.................... I2C_Write(0xAA); |
|
|
382 |
0206: MOVLW AA |
|
|
383 |
0207: BCF 03.5 |
|
|
384 |
0208: MOVWF 2B |
|
|
385 |
0209: CALL 08A |
|
|
386 |
.................... i2c_write(0x00); |
|
|
387 |
020A: CLRF 2B |
|
|
388 |
020B: CALL 08A |
|
|
389 |
.................... i2c_stop(); |
|
|
390 |
020C: BSF 03.5 |
|
|
391 |
020D: BCF 06.0 |
|
|
392 |
020E: NOP |
|
|
393 |
020F: BSF 06.1 |
|
|
394 |
0210: BCF 03.5 |
|
|
395 |
0211: BTFSS 06.1 |
|
|
396 |
0212: GOTO 211 |
|
|
397 |
0213: NOP |
|
|
398 |
0214: GOTO 215 |
|
|
399 |
0215: NOP |
|
|
400 |
0216: BSF 03.5 |
|
|
401 |
0217: BSF 06.0 |
|
|
402 |
0218: NOP |
|
|
403 |
.................... delay_ms (1); |
|
|
404 |
0219: MOVLW 01 |
|
|
405 |
021A: BCF 03.5 |
|
|
406 |
021B: MOVWF 2B |
|
|
407 |
021C: CALL 0BE |
|
|
408 |
.................... |
|
|
409 |
.................... |
|
|
410 |
.................... i2c_start();//dataflashclass |
|
|
411 |
021D: BSF 03.5 |
|
|
412 |
021E: BSF 06.0 |
|
|
413 |
021F: NOP |
|
|
414 |
0220: BSF 06.1 |
|
|
415 |
0221: NOP |
|
|
416 |
0222: BCF 03.5 |
|
|
417 |
0223: BCF 06.0 |
|
|
418 |
0224: BSF 03.5 |
|
|
419 |
0225: BCF 06.0 |
|
|
420 |
0226: NOP |
|
|
421 |
0227: BCF 03.5 |
|
|
422 |
0228: BCF 06.1 |
|
|
423 |
0229: BSF 03.5 |
|
|
424 |
022A: BCF 06.1 |
|
|
425 |
.................... I2C_Write(0xAA); |
|
|
426 |
022B: MOVLW AA |
|
|
427 |
022C: BCF 03.5 |
|
|
428 |
022D: MOVWF 2B |
|
|
429 |
022E: CALL 08A |
|
|
430 |
.................... I2C_write(0x3e); |
|
|
431 |
022F: MOVLW 3E |
|
|
432 |
0230: MOVWF 2B |
|
|
433 |
0231: CALL 08A |
|
|
434 |
.................... |
|
|
435 |
.................... i2c_start(); |
|
|
436 |
0232: BSF 03.5 |
|
|
437 |
0233: BSF 06.0 |
|
|
438 |
0234: NOP |
|
|
439 |
0235: BSF 06.1 |
|
|
440 |
0236: NOP |
|
|
441 |
0237: BCF 03.5 |
|
|
442 |
0238: BTFSS 06.1 |
|
|
443 |
0239: GOTO 238 |
|
|
444 |
023A: BCF 06.0 |
|
|
445 |
023B: BSF 03.5 |
|
|
446 |
023C: BCF 06.0 |
|
|
447 |
023D: NOP |
|
|
448 |
023E: BCF 03.5 |
|
|
449 |
023F: BCF 06.1 |
|
|
450 |
0240: BSF 03.5 |
|
|
451 |
0241: BCF 06.1 |
|
|
452 |
.................... I2C_Write(0xAA); |
|
|
453 |
0242: MOVLW AA |
|
|
454 |
0243: BCF 03.5 |
|
|
455 |
0244: MOVWF 2B |
|
|
456 |
0245: CALL 08A |
|
|
457 |
.................... i2c_write(0x40); |
|
|
458 |
0246: MOVLW 40 |
|
|
459 |
0247: MOVWF 2B |
|
|
460 |
0248: CALL 08A |
|
|
461 |
.................... i2c_stop(); |
|
|
462 |
0249: BSF 03.5 |
|
|
463 |
024A: BCF 06.0 |
|
|
464 |
024B: NOP |
|
|
465 |
024C: BSF 06.1 |
|
|
466 |
024D: BCF 03.5 |
|
|
467 |
024E: BTFSS 06.1 |
|
|
468 |
024F: GOTO 24E |
|
|
469 |
0250: NOP |
|
|
470 |
0251: GOTO 252 |
|
|
471 |
0252: NOP |
|
|
472 |
0253: BSF 03.5 |
|
|
473 |
0254: BSF 06.0 |
|
|
474 |
0255: NOP |
|
|
475 |
.................... delay_ms (1); |
|
|
476 |
0256: MOVLW 01 |
|
|
477 |
0257: BCF 03.5 |
|
|
478 |
0258: MOVWF 2B |
|
|
479 |
0259: CALL 0BE |
|
|
480 |
.................... |
|
|
481 |
.................... |
|
|
482 |
.................... i2c_start();//dataflashblock |
|
|
483 |
025A: BSF 03.5 |
|
|
484 |
025B: BSF 06.0 |
|
|
485 |
025C: NOP |
|
|
486 |
025D: BSF 06.1 |
|
|
487 |
025E: NOP |
|
|
488 |
025F: BCF 03.5 |
|
|
489 |
0260: BCF 06.0 |
|
|
490 |
0261: BSF 03.5 |
|
|
491 |
0262: BCF 06.0 |
|
|
492 |
0263: NOP |
|
|
493 |
0264: BCF 03.5 |
|
|
494 |
0265: BCF 06.1 |
|
|
495 |
0266: BSF 03.5 |
|
|
496 |
0267: BCF 06.1 |
|
|
497 |
.................... I2C_Write(0xAA); |
|
|
498 |
0268: MOVLW AA |
|
|
499 |
0269: BCF 03.5 |
|
|
500 |
026A: MOVWF 2B |
|
|
501 |
026B: CALL 08A |
|
|
502 |
.................... I2C_write(0x3f); |
|
|
503 |
026C: MOVLW 3F |
|
|
504 |
026D: MOVWF 2B |
|
|
505 |
026E: CALL 08A |
|
|
506 |
.................... |
|
|
507 |
.................... i2c_start(); |
|
|
508 |
026F: BSF 03.5 |
|
|
509 |
0270: BSF 06.0 |
|
|
510 |
0271: NOP |
|
|
511 |
0272: BSF 06.1 |
|
|
512 |
0273: NOP |
|
|
513 |
0274: BCF 03.5 |
|
|
514 |
0275: BTFSS 06.1 |
|
|
515 |
0276: GOTO 275 |
|
|
516 |
0277: BCF 06.0 |
|
|
517 |
0278: BSF 03.5 |
|
|
518 |
0279: BCF 06.0 |
|
|
519 |
027A: NOP |
|
|
520 |
027B: BCF 03.5 |
|
|
521 |
027C: BCF 06.1 |
|
|
522 |
027D: BSF 03.5 |
|
|
523 |
027E: BCF 06.1 |
|
|
524 |
.................... I2C_Write(0xAA); |
|
|
525 |
027F: MOVLW AA |
|
|
526 |
0280: BCF 03.5 |
|
|
527 |
0281: MOVWF 2B |
|
|
528 |
0282: CALL 08A |
|
|
529 |
.................... I2C_write(0x00); |
|
|
530 |
0283: CLRF 2B |
|
|
531 |
0284: CALL 08A |
|
|
532 |
.................... i2c_stop(); |
|
|
533 |
0285: BSF 03.5 |
|
|
534 |
0286: BCF 06.0 |
|
|
535 |
0287: NOP |
|
|
536 |
0288: BSF 06.1 |
|
|
537 |
0289: BCF 03.5 |
|
|
538 |
028A: BTFSS 06.1 |
|
|
539 |
028B: GOTO 28A |
|
|
540 |
028C: NOP |
|
|
541 |
028D: GOTO 28E |
|
|
542 |
028E: NOP |
|
|
543 |
028F: BSF 03.5 |
|
|
544 |
0290: BSF 06.0 |
|
|
545 |
0291: NOP |
|
|
546 |
.................... |
|
|
547 |
.................... delay_ms (1); |
|
|
548 |
0292: MOVLW 01 |
|
|
549 |
0293: BCF 03.5 |
|
|
550 |
0294: MOVWF 2B |
|
|
551 |
0295: CALL 0BE |
|
|
552 |
.................... |
|
|
553 |
.................... i2c_start();//blockdata |
|
|
554 |
0296: BSF 03.5 |
|
|
555 |
0297: BSF 06.0 |
|
|
556 |
0298: NOP |
|
|
557 |
0299: BSF 06.1 |
|
|
558 |
029A: NOP |
|
|
559 |
029B: BCF 03.5 |
|
|
560 |
029C: BCF 06.0 |
|
|
561 |
029D: BSF 03.5 |
|
|
562 |
029E: BCF 06.0 |
|
|
563 |
029F: NOP |
|
|
564 |
02A0: BCF 03.5 |
|
|
565 |
02A1: BCF 06.1 |
|
|
566 |
02A2: BSF 03.5 |
|
|
567 |
02A3: BCF 06.1 |
|
|
568 |
.................... I2C_Write(0xAA); |
|
|
569 |
02A4: MOVLW AA |
|
|
570 |
02A5: BCF 03.5 |
|
|
571 |
02A6: MOVWF 2B |
|
|
572 |
02A7: CALL 08A |
|
|
573 |
.................... I2C_write(0x44); |
|
|
574 |
02A8: MOVLW 44 |
|
|
575 |
02A9: MOVWF 2B |
|
|
576 |
02AA: CALL 08A |
|
|
577 |
.................... |
|
|
578 |
.................... i2c_start(); |
|
|
579 |
02AB: BSF 03.5 |
|
|
580 |
02AC: BSF 06.0 |
|
|
581 |
02AD: NOP |
|
|
582 |
02AE: BSF 06.1 |
|
|
583 |
02AF: NOP |
|
|
584 |
02B0: BCF 03.5 |
|
|
585 |
02B1: BTFSS 06.1 |
|
|
586 |
02B2: GOTO 2B1 |
|
|
587 |
02B3: BCF 06.0 |
|
|
588 |
02B4: BSF 03.5 |
|
|
589 |
02B5: BCF 06.0 |
|
|
590 |
02B6: NOP |
|
|
591 |
02B7: BCF 03.5 |
|
|
592 |
02B8: BCF 06.1 |
|
|
593 |
02B9: BSF 03.5 |
|
|
594 |
02BA: BCF 06.1 |
|
|
595 |
.................... I2C_Write(0xAB); |
|
|
596 |
02BB: MOVLW AB |
|
|
597 |
02BC: BCF 03.5 |
|
|
598 |
02BD: MOVWF 2B |
|
|
599 |
02BE: CALL 08A |
|
|
600 |
.................... ZK=I2C_read(0); |
|
|
601 |
02BF: CLRF 77 |
|
|
602 |
02C0: GOTO 0D2 |
|
|
603 |
02C1: MOVF 78,W |
|
|
604 |
02C2: MOVWF 28 |
|
|
605 |
.................... i2c_stop(); |
|
|
606 |
02C3: BSF 03.5 |
|
|
607 |
02C4: BCF 06.0 |
|
|
608 |
02C5: NOP |
|
|
609 |
02C6: BSF 06.1 |
|
|
610 |
02C7: BCF 03.5 |
|
|
611 |
02C8: BTFSS 06.1 |
|
|
612 |
02C9: GOTO 2C8 |
|
|
613 |
02CA: NOP |
|
|
614 |
02CB: GOTO 2CC |
|
|
615 |
02CC: NOP |
|
|
616 |
02CD: BSF 03.5 |
|
|
617 |
02CE: BSF 06.0 |
|
|
618 |
02CF: NOP |
|
|
619 |
.................... |
|
|
620 |
.................... delay_ms (1); |
|
|
621 |
02D0: MOVLW 01 |
|
|
622 |
02D1: BCF 03.5 |
|
|
623 |
02D2: MOVWF 2B |
|
|
624 |
02D3: CALL 0BE |
|
|
625 |
.................... |
|
|
626 |
.................... printf("LED %lX \r\n", ZK); |
|
|
627 |
02D4: MOVLW 10 |
|
|
628 |
02D5: BSF 03.6 |
|
|
629 |
02D6: MOVWF 0D |
|
|
630 |
02D7: MOVLW 00 |
|
|
631 |
02D8: MOVWF 0F |
|
|
632 |
02D9: BCF 03.0 |
|
|
633 |
02DA: MOVLW 04 |
|
|
634 |
02DB: BCF 03.6 |
|
|
635 |
02DC: MOVWF 2B |
|
|
636 |
02DD: CALL 107 |
|
|
637 |
02DE: MOVF 28,W |
|
|
638 |
02DF: MOVWF 2B |
|
|
639 |
02E0: MOVLW 37 |
|
|
640 |
02E1: MOVWF 2C |
|
|
641 |
02E2: CALL 156 |
|
|
642 |
02E3: MOVLW 20 |
|
|
643 |
02E4: MOVWF 2F |
|
|
644 |
02E5: CALL 020 |
|
|
645 |
02E6: MOVLW 0D |
|
|
646 |
02E7: MOVWF 2F |
|
|
647 |
02E8: CALL 020 |
|
|
648 |
02E9: MOVLW 0A |
|
|
649 |
02EA: MOVWF 2F |
|
|
650 |
02EB: CALL 020 |
|
|
651 |
.................... |
|
|
652 |
.................... if(ZK==0x53) |
|
|
653 |
02EC: MOVF 28,W |
|
|
654 |
02ED: SUBLW 53 |
|
|
655 |
02EE: BTFSS 03.2 |
|
|
656 |
02EF: GOTO 30C |
|
|
657 |
.................... { |
|
|
658 |
.................... LSB=LSB-1; |
|
|
659 |
02F0: MOVLW 01 |
|
|
660 |
02F1: SUBWF 27,F |
|
|
661 |
.................... printf("Vysledne LSB %lX \r\n", LSB); |
|
|
662 |
02F2: MOVLW 16 |
|
|
663 |
02F3: BSF 03.6 |
|
|
664 |
02F4: MOVWF 0D |
|
|
665 |
02F5: MOVLW 00 |
|
|
666 |
02F6: MOVWF 0F |
|
|
667 |
02F7: BCF 03.0 |
|
|
668 |
02F8: MOVLW 0D |
|
|
669 |
02F9: BCF 03.6 |
|
|
670 |
02FA: MOVWF 2B |
|
|
671 |
02FB: CALL 107 |
|
|
672 |
02FC: MOVF 27,W |
|
|
673 |
02FD: MOVWF 2B |
|
|
674 |
02FE: MOVLW 37 |
|
|
675 |
02FF: MOVWF 2C |
|
|
676 |
0300: CALL 156 |
|
|
677 |
0301: MOVLW 20 |
|
|
678 |
0302: MOVWF 2F |
|
|
679 |
0303: CALL 020 |
|
|
680 |
0304: MOVLW 0D |
|
|
681 |
0305: MOVWF 2F |
|
|
682 |
0306: CALL 020 |
|
|
683 |
0307: MOVLW 0A |
|
|
684 |
0308: MOVWF 2F |
|
|
685 |
0309: CALL 020 |
|
|
686 |
.................... while(TRUE) |
|
|
687 |
.................... { |
|
|
688 |
.................... } |
|
|
689 |
030A: GOTO 30A |
|
|
690 |
.................... } |
|
|
691 |
.................... |
|
|
692 |
.................... else |
|
|
693 |
030B: GOTO 386 |
|
|
694 |
.................... { |
|
|
695 |
.................... i2c_start();//blockdata |
|
|
696 |
030C: BSF 03.5 |
|
|
697 |
030D: BSF 06.0 |
|
|
698 |
030E: NOP |
|
|
699 |
030F: BSF 06.1 |
|
|
700 |
0310: NOP |
|
|
701 |
0311: BCF 03.5 |
|
|
702 |
0312: BCF 06.0 |
|
|
703 |
0313: BSF 03.5 |
|
|
704 |
0314: BCF 06.0 |
|
|
705 |
0315: NOP |
|
|
706 |
0316: BCF 03.5 |
|
|
707 |
0317: BCF 06.1 |
|
|
708 |
0318: BSF 03.5 |
|
|
709 |
0319: BCF 06.1 |
|
|
710 |
.................... I2C_Write(0xAA); |
|
|
711 |
031A: MOVLW AA |
|
|
712 |
031B: BCF 03.5 |
|
|
713 |
031C: MOVWF 2B |
|
|
714 |
031D: CALL 08A |
|
|
715 |
.................... I2C_write(0x44); |
|
|
716 |
031E: MOVLW 44 |
|
|
717 |
031F: MOVWF 2B |
|
|
718 |
0320: CALL 08A |
|
|
719 |
.................... |
|
|
720 |
.................... i2c_start(); |
|
|
721 |
0321: BSF 03.5 |
|
|
722 |
0322: BSF 06.0 |
|
|
723 |
0323: NOP |
|
|
724 |
0324: BSF 06.1 |
|
|
725 |
0325: NOP |
|
|
726 |
0326: BCF 03.5 |
|
|
727 |
0327: BTFSS 06.1 |
|
|
728 |
0328: GOTO 327 |
|
|
729 |
0329: BCF 06.0 |
|
|
730 |
032A: BSF 03.5 |
|
|
731 |
032B: BCF 06.0 |
|
|
732 |
032C: NOP |
|
|
733 |
032D: BCF 03.5 |
|
|
734 |
032E: BCF 06.1 |
|
|
735 |
032F: BSF 03.5 |
|
|
736 |
0330: BCF 06.1 |
|
|
737 |
.................... I2C_Write(0xAA); |
|
|
738 |
0331: MOVLW AA |
|
|
739 |
0332: BCF 03.5 |
|
|
740 |
0333: MOVWF 2B |
|
|
741 |
0334: CALL 08A |
|
|
742 |
.................... I2C_write(0x53); |
|
|
743 |
0335: MOVLW 53 |
|
|
744 |
0336: MOVWF 2B |
|
|
745 |
0337: CALL 08A |
|
|
746 |
.................... i2c_stop(); |
|
|
747 |
0338: BSF 03.5 |
|
|
748 |
0339: BCF 06.0 |
|
|
749 |
033A: NOP |
|
|
750 |
033B: BSF 06.1 |
|
|
751 |
033C: BCF 03.5 |
|
|
752 |
033D: BTFSS 06.1 |
|
|
753 |
033E: GOTO 33D |
|
|
754 |
033F: NOP |
|
|
755 |
0340: GOTO 341 |
|
|
756 |
0341: NOP |
|
|
757 |
0342: BSF 03.5 |
|
|
758 |
0343: BSF 06.0 |
|
|
759 |
0344: NOP |
|
|
760 |
.................... |
|
|
761 |
.................... |
|
|
762 |
.................... int i=64; |
|
|
763 |
0345: MOVLW 40 |
|
|
764 |
0346: BCF 03.5 |
|
|
765 |
0347: MOVWF 2A |
|
|
766 |
.................... SOUCET=0; |
|
|
767 |
0348: CLRF 24 |
|
|
768 |
0349: CLRF 23 |
|
|
769 |
.................... SOUCET1=0; |
|
|
770 |
034A: CLRF 26 |
|
|
771 |
034B: CLRF 25 |
|
|
772 |
.................... |
|
|
773 |
.................... /* |
|
|
774 |
.................... for (i=64;i<96;++i) |
|
|
775 |
.................... { |
|
|
776 |
.................... printf("%u\r\n",i); |
|
|
777 |
.................... i2c_stop(); |
|
|
778 |
.................... |
|
|
779 |
.................... i2c_start();//blockdata |
|
|
780 |
.................... I2C_Write(0xAA); |
|
|
781 |
.................... I2C_write(i); |
|
|
782 |
.................... |
|
|
783 |
.................... i2c_start(); |
|
|
784 |
.................... I2C_Write(0xAB); |
|
|
785 |
.................... STAV1=I2C_read(0); |
|
|
786 |
.................... i2c_stop(); |
|
|
787 |
.................... |
|
|
788 |
.................... printf("STAV %lX \r\n", STAV1); |
|
|
789 |
.................... SOUCET=SOUCET+STAV1; |
|
|
790 |
.................... |
|
|
791 |
.................... |
|
|
792 |
.................... |
|
|
793 |
.................... |
|
|
794 |
.................... |
|
|
795 |
.................... } |
|
|
796 |
.................... printf("SOUCET: %lX (procenta)\r\n", SOUCET); |
|
|
797 |
.................... SOUCET1=SOUCET; |
|
|
798 |
.................... SOUCET1=SOUCET1>>8; |
|
|
799 |
.................... printf("Deleno 256: %lX (procenta)\r\n", SOUCET1); |
|
|
800 |
.................... SOUCET1=SOUCET-SOUCET1; |
|
|
801 |
.................... printf("Soucet - soucet/256: %lX \r\n", SOUCET1); |
|
|
802 |
.................... LSB=(unsigned int8)SOUCET1; |
|
|
803 |
.................... printf("LSB: %lX\r\n", LSB); |
|
|
804 |
.................... //printf("Stav: %X (procenta)\r\n", STAV2); |
|
|
805 |
.................... */ |
|
|
806 |
.................... |
|
|
807 |
.................... i2c_start();//blockdata |
|
|
808 |
034C: BSF 03.5 |
|
|
809 |
034D: BSF 06.0 |
|
|
810 |
034E: NOP |
|
|
811 |
034F: BSF 06.1 |
|
|
812 |
0350: NOP |
|
|
813 |
0351: BCF 03.5 |
|
|
814 |
0352: BCF 06.0 |
|
|
815 |
0353: BSF 03.5 |
|
|
816 |
0354: BCF 06.0 |
|
|
817 |
0355: NOP |
|
|
818 |
0356: BCF 03.5 |
|
|
819 |
0357: BCF 06.1 |
|
|
820 |
0358: BSF 03.5 |
|
|
821 |
0359: BCF 06.1 |
|
|
822 |
.................... I2C_Write(0xAA); |
|
|
823 |
035A: MOVLW AA |
|
|
824 |
035B: BCF 03.5 |
|
|
825 |
035C: MOVWF 2B |
|
|
826 |
035D: CALL 08A |
|
|
827 |
.................... I2C_write(0x60); |
|
|
828 |
035E: MOVLW 60 |
|
|
829 |
035F: MOVWF 2B |
|
|
830 |
0360: CALL 08A |
|
|
831 |
.................... |
|
|
832 |
.................... i2c_start(); |
|
|
833 |
0361: BSF 03.5 |
|
|
834 |
0362: BSF 06.0 |
|
|
835 |
0363: NOP |
|
|
836 |
0364: BSF 06.1 |
|
|
837 |
0365: NOP |
|
|
838 |
0366: BCF 03.5 |
|
|
839 |
0367: BTFSS 06.1 |
|
|
840 |
0368: GOTO 367 |
|
|
841 |
0369: BCF 06.0 |
|
|
842 |
036A: BSF 03.5 |
|
|
843 |
036B: BCF 06.0 |
|
|
844 |
036C: NOP |
|
|
845 |
036D: BCF 03.5 |
|
|
846 |
036E: BCF 06.1 |
|
|
847 |
036F: BSF 03.5 |
|
|
848 |
0370: BCF 06.1 |
|
|
849 |
.................... I2C_Write(0xAA); |
|
|
850 |
0371: MOVLW AA |
|
|
851 |
0372: BCF 03.5 |
|
|
852 |
0373: MOVWF 2B |
|
|
853 |
0374: CALL 08A |
|
|
854 |
.................... I2C_write(LSB); |
|
|
855 |
0375: MOVF 27,W |
|
|
856 |
0376: MOVWF 2B |
|
|
857 |
0377: CALL 08A |
|
|
858 |
.................... i2c_stop(); |
|
|
859 |
0378: BSF 03.5 |
|
|
860 |
0379: BCF 06.0 |
|
|
861 |
037A: NOP |
|
|
862 |
037B: BSF 06.1 |
|
|
863 |
037C: BCF 03.5 |
|
|
864 |
037D: BTFSS 06.1 |
|
|
865 |
037E: GOTO 37D |
|
|
866 |
037F: NOP |
|
|
867 |
0380: GOTO 381 |
|
|
868 |
0381: NOP |
|
|
869 |
0382: BSF 03.5 |
|
|
870 |
0383: BSF 06.0 |
|
|
871 |
0384: NOP |
|
|
872 |
0385: BCF 03.5 |
|
|
873 |
.................... |
|
|
874 |
.................... } |
|
|
875 |
.................... |
|
|
876 |
.................... LSB=LSB+1; |
|
|
877 |
0386: MOVLW 01 |
|
|
878 |
0387: ADDWF 27,F |
|
|
879 |
.................... |
|
|
880 |
.................... delay_ms (100); |
|
|
881 |
0388: MOVLW 64 |
|
|
882 |
0389: MOVWF 2B |
|
|
883 |
038A: CALL 0BE |
|
|
884 |
.................... } |
|
|
885 |
038B: GOTO 1E1 |
|
|
886 |
.................... } |
|
|
887 |
038C: SLEEP |
|
|
888 |
|
|
|
889 |
Configuration Fuses: |
|
|
890 |
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
891 |
Word 2: 3FFF NOWRT BORV40 |