3458 |
kaklik |
1 |
CCS PCM C Compiler, Version 4.106, 47914 01-II-14 20:13 |
|
|
2 |
|
|
|
3 |
Filename: Z:\home\kaklik\svn\svnMLAB\Designs\Measuring_instruments\RMDS01C\SW\PIC887\main.lst |
|
|
4 |
|
|
|
5 |
ROM used: 786 words (10%) |
|
|
6 |
Largest free fragment is 2048 |
|
|
7 |
RAM used: 67 (18%) at main() level |
|
|
8 |
80 (22%) worst case |
|
|
9 |
Stack: 2 worst case (1 in main + 1 for interrupts) |
|
|
10 |
|
|
|
11 |
* |
|
|
12 |
0000: MOVLW 02 |
|
|
13 |
0001: MOVWF 0A |
|
|
14 |
0002: GOTO 21C |
|
|
15 |
0003: NOP |
|
|
16 |
0004: MOVWF 7F |
|
|
17 |
0005: SWAPF 03,W |
|
|
18 |
0006: CLRF 03 |
|
|
19 |
0007: MOVWF 21 |
|
|
20 |
0008: MOVF 0A,W |
|
|
21 |
0009: MOVWF 20 |
|
|
22 |
000A: CLRF 0A |
|
|
23 |
000B: MOVF 04,W |
|
|
24 |
000C: MOVWF 22 |
|
|
25 |
000D: MOVF 77,W |
|
|
26 |
000E: MOVWF 23 |
|
|
27 |
000F: MOVF 78,W |
|
|
28 |
0010: MOVWF 24 |
|
|
29 |
0011: MOVF 79,W |
|
|
30 |
0012: MOVWF 25 |
|
|
31 |
0013: MOVF 7A,W |
|
|
32 |
0014: MOVWF 26 |
|
|
33 |
0015: BCF 03.7 |
|
|
34 |
0016: BCF 03.5 |
|
|
35 |
0017: MOVLW 8C |
|
|
36 |
0018: MOVWF 04 |
|
|
37 |
0019: BTFSS 00.1 |
|
|
38 |
001A: GOTO 01D |
|
|
39 |
001B: BTFSC 0C.1 |
|
|
40 |
001C: GOTO 034 |
|
|
41 |
001D: MOVLW 8C |
|
|
42 |
001E: MOVWF 04 |
|
|
43 |
001F: BTFSS 00.3 |
|
|
44 |
0020: GOTO 023 |
|
|
45 |
0021: BTFSC 0C.3 |
|
|
46 |
0022: GOTO 037 |
|
|
47 |
0023: MOVF 22,W |
|
|
48 |
0024: MOVWF 04 |
|
|
49 |
0025: MOVF 23,W |
|
|
50 |
0026: MOVWF 77 |
|
|
51 |
0027: MOVF 24,W |
|
|
52 |
0028: MOVWF 78 |
|
|
53 |
0029: MOVF 25,W |
|
|
54 |
002A: MOVWF 79 |
|
|
55 |
002B: MOVF 26,W |
|
|
56 |
002C: MOVWF 7A |
|
|
57 |
002D: MOVF 20,W |
|
|
58 |
002E: MOVWF 0A |
|
|
59 |
002F: SWAPF 21,W |
|
|
60 |
0030: MOVWF 03 |
|
|
61 |
0031: SWAPF 7F,F |
|
|
62 |
0032: SWAPF 7F,W |
|
|
63 |
0033: RETFIE |
|
|
64 |
0034: BCF 0A.3 |
|
|
65 |
0035: BCF 0A.4 |
|
|
66 |
0036: GOTO 0B0 |
|
|
67 |
0037: BCF 0A.3 |
|
|
68 |
0038: BCF 0A.4 |
|
|
69 |
0039: GOTO 066 |
|
|
70 |
.................... #include "main.h" |
|
|
71 |
.................... #include <16F887.h> |
|
|
72 |
.................... //////// Standard Header file for the PIC16F887 device //////////////// |
|
|
73 |
.................... #device PIC16F887 |
|
|
74 |
.................... #list |
|
|
75 |
.................... |
|
|
76 |
.................... #device adc=8 |
|
|
77 |
.................... |
|
|
78 |
.................... #FUSES NOWDT //No Watch Dog Timer |
|
|
79 |
.................... #FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD) |
|
|
80 |
.................... #FUSES NOPUT //No Power Up Timer |
|
|
81 |
.................... #FUSES MCLR //Master Clear pin enabled |
|
|
82 |
.................... #FUSES NOPROTECT //Code not protected from reading |
|
|
83 |
.................... #FUSES NOCPD //No EE protection |
|
|
84 |
.................... #FUSES NOBROWNOUT //No brownout reset |
|
|
85 |
.................... #FUSES IESO //Internal External Switch Over mode enabled |
|
|
86 |
.................... #FUSES FCMEN //Fail-safe clock monitor enabled |
|
|
87 |
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
|
|
88 |
.................... #FUSES NODEBUG //No Debug mode for ICD |
|
|
89 |
.................... #FUSES NOWRT //Program memory not write protected |
|
|
90 |
.................... #FUSES BORV40 //Brownout reset at 4.0V |
|
|
91 |
.................... |
|
|
92 |
.................... #use delay(clock=20000000) |
|
|
93 |
* |
|
|
94 |
00DC: MOVLW 5F |
|
|
95 |
00DD: MOVWF 04 |
|
|
96 |
00DE: BCF 03.7 |
|
|
97 |
00DF: MOVF 00,W |
|
|
98 |
00E0: BTFSC 03.2 |
|
|
99 |
00E1: GOTO 0EF |
|
|
100 |
00E2: MOVLW 06 |
|
|
101 |
00E3: MOVWF 78 |
|
|
102 |
00E4: CLRF 77 |
|
|
103 |
00E5: DECFSZ 77,F |
|
|
104 |
00E6: GOTO 0E5 |
|
|
105 |
00E7: DECFSZ 78,F |
|
|
106 |
00E8: GOTO 0E4 |
|
|
107 |
00E9: MOVLW 7B |
|
|
108 |
00EA: MOVWF 77 |
|
|
109 |
00EB: DECFSZ 77,F |
|
|
110 |
00EC: GOTO 0EB |
|
|
111 |
00ED: DECFSZ 00,F |
|
|
112 |
00EE: GOTO 0E2 |
|
|
113 |
00EF: RETURN |
|
|
114 |
* |
|
|
115 |
013A: MOVLW 03 |
|
|
116 |
013B: SUBWF 5F,F |
|
|
117 |
013C: BTFSS 03.0 |
|
|
118 |
013D: GOTO 148 |
|
|
119 |
013E: MOVLW 5F |
|
|
120 |
013F: MOVWF 04 |
|
|
121 |
0140: BCF 03.7 |
|
|
122 |
0141: MOVF 00,W |
|
|
123 |
0142: BTFSC 03.2 |
|
|
124 |
0143: GOTO 148 |
|
|
125 |
0144: GOTO 146 |
|
|
126 |
0145: GOTO 146 |
|
|
127 |
0146: DECFSZ 00,F |
|
|
128 |
0147: GOTO 145 |
|
|
129 |
0148: BCF 0A.3 |
|
|
130 |
0149: BCF 0A.4 |
|
|
131 |
014A: GOTO 2C1 (RETURN) |
|
|
132 |
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,errors) |
|
|
133 |
.................... |
|
|
134 |
.................... //NOTE: Must declare MASTER before SLAVE, i2c_isr_state() returns 0 |
|
|
135 |
.................... // when MASTER is the most recent #use i2c |
|
|
136 |
.................... //#use i2c(MASTER, sda=PIN_C1, scl=PIN_C0, stream=I2CM) |
|
|
137 |
.................... #use i2c(SLAVE, Fast, sda=PIN_C4, scl=PIN_C3, force_hw, address=0xA0) |
|
|
138 |
* |
|
|
139 |
00A1: MOVF 6A,W |
|
|
140 |
00A2: MOVWF 13 |
|
|
141 |
00A3: BSF 14.4 |
|
|
142 |
00A4: BCF 0C.3 |
|
|
143 |
00A5: BSF 03.5 |
|
|
144 |
00A6: BTFSC 14.0 |
|
|
145 |
00A7: GOTO 0A6 |
|
|
146 |
00A8: CLRF 78 |
|
|
147 |
00A9: BCF 03.5 |
|
|
148 |
00AA: BTFSC 14.4 |
|
|
149 |
00AB: INCF 78,F |
|
|
150 |
.................... |
|
|
151 |
.................... |
|
|
152 |
.................... |
|
|
153 |
.................... |
|
|
154 |
.................... #define LED PIN_E1 |
|
|
155 |
.................... #define CE PIN_E2 |
|
|
156 |
.................... |
|
|
157 |
.................... int16 count; |
|
|
158 |
.................... |
|
|
159 |
.................... int8 rcv_buf[0x10]; // I2C receive buffer |
|
|
160 |
.................... int8 snd_buf[0x10]; // I2C send buffer |
|
|
161 |
.................... |
|
|
162 |
.................... int8 buffer[0x10]; // I2C buffer |
|
|
163 |
.................... int8 address; |
|
|
164 |
.................... |
|
|
165 |
.................... const char cmd[40]={0xB5, 0x62, 0x06, 0x31, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x80, 0x84, 0x1E, 0x00, 0xE0, 0xC8, 0x10, 0x00, 0x40, 0x42, 0x0F, 0x00, 0xA0, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00, 0x00, 0x00, 0x12, 0x03}; |
|
|
166 |
.................... |
|
|
167 |
.................... #INT_SSP |
|
|
168 |
.................... void ssp_interupt () |
|
|
169 |
.................... { |
|
|
170 |
.................... BYTE incoming, state; |
|
|
171 |
.................... |
|
|
172 |
.................... state = i2c_isr_state(); |
|
|
173 |
* |
|
|
174 |
0066: BSF 03.5 |
|
|
175 |
0067: BTFSC 14.5 |
|
|
176 |
0068: GOTO 071 |
|
|
177 |
0069: BCF 03.5 |
|
|
178 |
006A: CLRF 5C |
|
|
179 |
006B: BSF 03.5 |
|
|
180 |
006C: BTFSS 14.2 |
|
|
181 |
006D: GOTO 071 |
|
|
182 |
006E: BCF 03.5 |
|
|
183 |
006F: BSF 5C.7 |
|
|
184 |
0070: BSF 03.5 |
|
|
185 |
0071: BCF 03.5 |
|
|
186 |
0072: MOVF 5C,W |
|
|
187 |
0073: INCF 5C,F |
|
|
188 |
0074: MOVWF 68 |
|
|
189 |
.................... |
|
|
190 |
.................... if(state < 0x80) //Master is sending data |
|
|
191 |
0075: MOVF 68,W |
|
|
192 |
0076: SUBLW 7F |
|
|
193 |
0077: BTFSS 03.0 |
|
|
194 |
0078: GOTO 095 |
|
|
195 |
.................... { |
|
|
196 |
.................... incoming = i2c_read(); |
|
|
197 |
0079: BCF 14.6 |
|
|
198 |
007A: BTFSS 0C.3 |
|
|
199 |
007B: GOTO 07A |
|
|
200 |
007C: MOVF 13,W |
|
|
201 |
007D: BSF 14.4 |
|
|
202 |
007E: MOVWF 67 |
|
|
203 |
.................... if(state == 1) //First received byte is address |
|
|
204 |
007F: DECFSZ 68,W |
|
|
205 |
0080: GOTO 08B |
|
|
206 |
.................... { |
|
|
207 |
.................... address = incoming; |
|
|
208 |
0081: MOVF 67,W |
|
|
209 |
0082: MOVWF 5B |
|
|
210 |
.................... if (incoming == 2) |
|
|
211 |
0083: MOVF 67,W |
|
|
212 |
0084: SUBLW 02 |
|
|
213 |
0085: BTFSS 03.2 |
|
|
214 |
0086: GOTO 08B |
|
|
215 |
.................... { |
|
|
216 |
.................... buffer[0]=make8(count,0); |
|
|
217 |
0087: MOVF 29,W |
|
|
218 |
0088: MOVWF 4B |
|
|
219 |
.................... buffer[1]=make8(count,1); |
|
|
220 |
0089: MOVF 2A,W |
|
|
221 |
008A: MOVWF 4C |
|
|
222 |
.................... } |
|
|
223 |
.................... } |
|
|
224 |
.................... if(state == 2) //Second received byte is data |
|
|
225 |
008B: MOVF 68,W |
|
|
226 |
008C: SUBLW 02 |
|
|
227 |
008D: BTFSS 03.2 |
|
|
228 |
008E: GOTO 095 |
|
|
229 |
.................... buffer[address] = incoming; |
|
|
230 |
008F: MOVLW 4B |
|
|
231 |
0090: ADDWF 5B,W |
|
|
232 |
0091: MOVWF 04 |
|
|
233 |
0092: BCF 03.7 |
|
|
234 |
0093: MOVF 67,W |
|
|
235 |
0094: MOVWF 00 |
|
|
236 |
.................... |
|
|
237 |
.................... |
|
|
238 |
.................... } |
|
|
239 |
.................... if(state == 0x80) //Master is requesting data |
|
|
240 |
0095: MOVF 68,W |
|
|
241 |
0096: SUBLW 80 |
|
|
242 |
0097: BTFSS 03.2 |
|
|
243 |
0098: GOTO 0AC |
|
|
244 |
.................... { |
|
|
245 |
.................... i2c_write(buffer[address]); |
|
|
246 |
0099: MOVLW 4B |
|
|
247 |
009A: ADDWF 5B,W |
|
|
248 |
009B: MOVWF 04 |
|
|
249 |
009C: BCF 03.7 |
|
|
250 |
009D: MOVF 00,W |
|
|
251 |
009E: MOVWF 69 |
|
|
252 |
009F: MOVF 69,W |
|
|
253 |
00A0: MOVWF 6A |
|
|
254 |
.................... } |
|
|
255 |
.................... } |
|
|
256 |
.................... |
|
|
257 |
.................... |
|
|
258 |
* |
|
|
259 |
00AC: BCF 0C.3 |
|
|
260 |
00AD: BCF 0A.3 |
|
|
261 |
00AE: BCF 0A.4 |
|
|
262 |
00AF: GOTO 023 |
|
|
263 |
.................... #int_TIMER2 // every 10 ms |
|
|
264 |
.................... void TIMER2_isr(void) |
|
|
265 |
.................... { |
|
|
266 |
.................... output_low(CE); |
|
|
267 |
00B0: BSF 03.5 |
|
|
268 |
00B1: BCF 09.2 |
|
|
269 |
00B2: BCF 03.5 |
|
|
270 |
00B3: BCF 09.2 |
|
|
271 |
.................... count=get_timer1(); |
|
|
272 |
00B4: MOVF 0F,W |
|
|
273 |
00B5: MOVWF 7A |
|
|
274 |
00B6: MOVF 0E,W |
|
|
275 |
00B7: MOVWF 77 |
|
|
276 |
00B8: MOVF 0F,W |
|
|
277 |
00B9: SUBWF 7A,W |
|
|
278 |
00BA: BTFSS 03.2 |
|
|
279 |
00BB: GOTO 0B4 |
|
|
280 |
00BC: MOVF 77,W |
|
|
281 |
00BD: MOVWF 29 |
|
|
282 |
00BE: MOVF 7A,W |
|
|
283 |
00BF: MOVWF 2A |
|
|
284 |
.................... set_timer1(0); |
|
|
285 |
00C0: CLRF 0F |
|
|
286 |
00C1: CLRF 0E |
|
|
287 |
.................... output_high(CE); |
|
|
288 |
00C2: BSF 03.5 |
|
|
289 |
00C3: BCF 09.2 |
|
|
290 |
00C4: BCF 03.5 |
|
|
291 |
00C5: BSF 09.2 |
|
|
292 |
.................... } |
|
|
293 |
.................... |
|
|
294 |
.................... |
|
|
295 |
00C6: BCF 0C.1 |
|
|
296 |
00C7: BCF 0A.3 |
|
|
297 |
00C8: BCF 0A.4 |
|
|
298 |
00C9: GOTO 023 |
|
|
299 |
.................... void main() |
|
|
300 |
.................... { |
|
|
301 |
* |
|
|
302 |
021C: CLRF 04 |
|
|
303 |
021D: BCF 03.7 |
|
|
304 |
021E: MOVLW 1F |
|
|
305 |
021F: ANDWF 03,F |
|
|
306 |
0220: BSF 03.5 |
|
|
307 |
0221: BSF 03.6 |
|
|
308 |
0222: BSF 07.3 |
|
|
309 |
0223: MOVLW 08 |
|
|
310 |
0224: BCF 03.6 |
|
|
311 |
0225: MOVWF 19 |
|
|
312 |
0226: MOVLW 02 |
|
|
313 |
0227: MOVWF 1A |
|
|
314 |
0228: MOVLW A6 |
|
|
315 |
0229: MOVWF 18 |
|
|
316 |
022A: MOVLW 90 |
|
|
317 |
022B: BCF 03.5 |
|
|
318 |
022C: MOVWF 18 |
|
|
319 |
022D: BSF 28.3 |
|
|
320 |
022E: MOVF 28,W |
|
|
321 |
022F: BSF 03.5 |
|
|
322 |
0230: MOVWF 07 |
|
|
323 |
0231: BCF 03.5 |
|
|
324 |
0232: BSF 28.4 |
|
|
325 |
0233: MOVF 28,W |
|
|
326 |
0234: BSF 03.5 |
|
|
327 |
0235: MOVWF 07 |
|
|
328 |
0236: MOVLW A0 |
|
|
329 |
0237: MOVWF 13 |
|
|
330 |
0238: MOVLW 36 |
|
|
331 |
0239: BCF 03.5 |
|
|
332 |
023A: MOVWF 14 |
|
|
333 |
023B: BSF 03.5 |
|
|
334 |
023C: BSF 03.6 |
|
|
335 |
023D: MOVF 09,W |
|
|
336 |
023E: ANDLW C0 |
|
|
337 |
023F: MOVWF 09 |
|
|
338 |
0240: BCF 03.6 |
|
|
339 |
0241: BCF 1F.4 |
|
|
340 |
0242: BCF 1F.5 |
|
|
341 |
0243: MOVLW 00 |
|
|
342 |
0244: BSF 03.6 |
|
|
343 |
0245: MOVWF 08 |
|
|
344 |
0246: BCF 03.5 |
|
|
345 |
0247: CLRF 07 |
|
|
346 |
0248: CLRF 08 |
|
|
347 |
0249: CLRF 09 |
|
|
348 |
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD); |
|
|
349 |
* |
|
|
350 |
0250: BSF 03.5 |
|
|
351 |
0251: BSF 03.6 |
|
|
352 |
0252: MOVF 09,W |
|
|
353 |
0253: ANDLW C0 |
|
|
354 |
0254: MOVWF 09 |
|
|
355 |
0255: BCF 03.6 |
|
|
356 |
0256: BCF 1F.4 |
|
|
357 |
0257: BCF 1F.5 |
|
|
358 |
0258: MOVLW 00 |
|
|
359 |
0259: BSF 03.6 |
|
|
360 |
025A: MOVWF 08 |
|
|
361 |
.................... setup_adc(ADC_OFF); |
|
|
362 |
025B: BCF 03.5 |
|
|
363 |
025C: BCF 03.6 |
|
|
364 |
025D: BCF 1F.0 |
|
|
365 |
.................... // setup_spi(SPI_SS_DISABLED); |
|
|
366 |
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
|
|
367 |
025E: BSF 03.5 |
|
|
368 |
025F: MOVF 01,W |
|
|
369 |
0260: ANDLW C7 |
|
|
370 |
0261: IORLW 08 |
|
|
371 |
0262: MOVWF 01 |
|
|
372 |
.................... // setup_wdt(WDT_144MS); |
|
|
373 |
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1); |
|
|
374 |
0263: MOVLW 07 |
|
|
375 |
0264: BCF 03.5 |
|
|
376 |
0265: MOVWF 10 |
|
|
377 |
.................... setup_timer_2(T2_DIV_BY_16,196,16); |
|
|
378 |
0266: MOVLW 78 |
|
|
379 |
0267: MOVWF 78 |
|
|
380 |
0268: IORLW 06 |
|
|
381 |
0269: MOVWF 12 |
|
|
382 |
026A: MOVLW C4 |
|
|
383 |
026B: BSF 03.5 |
|
|
384 |
026C: MOVWF 12 |
|
|
385 |
.................... setup_ccp1(CCP_OFF); |
|
|
386 |
026D: BCF 03.5 |
|
|
387 |
026E: BSF 28.2 |
|
|
388 |
026F: MOVF 28,W |
|
|
389 |
0270: BSF 03.5 |
|
|
390 |
0271: MOVWF 07 |
|
|
391 |
0272: BCF 03.5 |
|
|
392 |
0273: CLRF 17 |
|
|
393 |
0274: BSF 03.5 |
|
|
394 |
0275: CLRF 1B |
|
|
395 |
0276: CLRF 1C |
|
|
396 |
0277: MOVLW 01 |
|
|
397 |
0278: MOVWF 1D |
|
|
398 |
.................... setup_comparator(NC_NC_NC_NC); |
|
|
399 |
0279: BCF 03.5 |
|
|
400 |
027A: BSF 03.6 |
|
|
401 |
027B: CLRF 07 |
|
|
402 |
027C: CLRF 08 |
|
|
403 |
027D: CLRF 09 |
|
|
404 |
.................... setup_vref(FALSE); |
|
|
405 |
027E: BSF 03.5 |
|
|
406 |
027F: BCF 03.6 |
|
|
407 |
0280: CLRF 17 |
|
|
408 |
.................... |
|
|
409 |
.................... delay_ms(1000); |
|
|
410 |
0281: MOVLW 04 |
|
|
411 |
0282: BCF 03.5 |
|
|
412 |
0283: MOVWF 5E |
|
|
413 |
0284: MOVLW FA |
|
|
414 |
0285: MOVWF 5F |
|
|
415 |
0286: CALL 0DC |
|
|
416 |
0287: DECFSZ 5E,F |
|
|
417 |
0288: GOTO 284 |
|
|
418 |
.................... int n; |
|
|
419 |
.................... for (n=0;n<40;n++) |
|
|
420 |
0289: CLRF 5D |
|
|
421 |
028A: MOVF 5D,W |
|
|
422 |
028B: SUBLW 27 |
|
|
423 |
028C: BTFSS 03.0 |
|
|
424 |
028D: GOTO 295 |
|
|
425 |
.................... { |
|
|
426 |
.................... putc(cmd[n]); |
|
|
427 |
028E: MOVF 5D,W |
|
|
428 |
028F: CALL 03A |
|
|
429 |
0290: BTFSS 0C.4 |
|
|
430 |
0291: GOTO 290 |
|
|
431 |
0292: MOVWF 19 |
|
|
432 |
.................... } |
|
|
433 |
0293: INCF 5D,F |
|
|
434 |
0294: GOTO 28A |
|
|
435 |
.................... |
|
|
436 |
.................... printf("cvak...\r\n"); |
|
|
437 |
0295: MOVLW CA |
|
|
438 |
0296: BSF 03.6 |
|
|
439 |
0297: MOVWF 0D |
|
|
440 |
0298: MOVLW 00 |
|
|
441 |
0299: MOVWF 0F |
|
|
442 |
029A: BCF 03.6 |
|
|
443 |
029B: GOTO 0F0 |
|
|
444 |
.................... snd_buf[2]=0x55; |
|
|
445 |
029C: MOVLW 55 |
|
|
446 |
029D: MOVWF 3D |
|
|
447 |
.................... snd_buf[3]=0xAA; |
|
|
448 |
029E: MOVLW AA |
|
|
449 |
029F: MOVWF 3E |
|
|
450 |
.................... |
|
|
451 |
.................... set_timer1(0); |
|
|
452 |
02A0: CLRF 0F |
|
|
453 |
02A1: CLRF 0E |
|
|
454 |
.................... enable_interrupts(INT_SSP); |
|
|
455 |
02A2: BSF 03.5 |
|
|
456 |
02A3: BSF 0C.3 |
|
|
457 |
.................... // enable_interrupts(INT_TIMER2); |
|
|
458 |
.................... enable_interrupts(GLOBAL); |
|
|
459 |
02A4: MOVLW C0 |
|
|
460 |
02A5: BCF 03.5 |
|
|
461 |
02A6: IORWF 0B,F |
|
|
462 |
.................... |
|
|
463 |
.................... while(true) |
|
|
464 |
.................... { |
|
|
465 |
.................... |
|
|
466 |
.................... output_high(LED); |
|
|
467 |
02A7: BSF 03.5 |
|
|
468 |
02A8: BCF 09.1 |
|
|
469 |
02A9: BCF 03.5 |
|
|
470 |
02AA: BSF 09.1 |
|
|
471 |
.................... output_low(LED); |
|
|
472 |
02AB: BSF 03.5 |
|
|
473 |
02AC: BCF 09.1 |
|
|
474 |
02AD: BCF 03.5 |
|
|
475 |
02AE: BCF 09.1 |
|
|
476 |
.................... set_timer1(0); |
|
|
477 |
02AF: CLRF 0F |
|
|
478 |
02B0: CLRF 0E |
|
|
479 |
.................... output_high(CE); |
|
|
480 |
02B1: BSF 03.5 |
|
|
481 |
02B2: BCF 09.2 |
|
|
482 |
02B3: BCF 03.5 |
|
|
483 |
02B4: BSF 09.2 |
|
|
484 |
.................... delay_ms(999); |
|
|
485 |
02B5: MOVLW 09 |
|
|
486 |
02B6: MOVWF 5E |
|
|
487 |
02B7: MOVLW 6F |
|
|
488 |
02B8: MOVWF 5F |
|
|
489 |
02B9: CALL 0DC |
|
|
490 |
02BA: DECFSZ 5E,F |
|
|
491 |
02BB: GOTO 2B7 |
|
|
492 |
.................... delay_us(966); |
|
|
493 |
02BC: MOVLW 06 |
|
|
494 |
02BD: MOVWF 5E |
|
|
495 |
02BE: MOVLW A0 |
|
|
496 |
02BF: MOVWF 5F |
|
|
497 |
02C0: GOTO 13A |
|
|
498 |
02C1: DECFSZ 5E,F |
|
|
499 |
02C2: GOTO 2BE |
|
|
500 |
.................... output_low(CE); |
|
|
501 |
02C3: BSF 03.5 |
|
|
502 |
02C4: BCF 09.2 |
|
|
503 |
02C5: BCF 03.5 |
|
|
504 |
02C6: BCF 09.2 |
|
|
505 |
.................... count=get_timer1(); |
|
|
506 |
02C7: MOVF 0F,W |
|
|
507 |
02C8: MOVWF 7A |
|
|
508 |
02C9: MOVF 0E,W |
|
|
509 |
02CA: MOVWF 77 |
|
|
510 |
02CB: MOVF 0F,W |
|
|
511 |
02CC: SUBWF 7A,W |
|
|
512 |
02CD: BTFSS 03.2 |
|
|
513 |
02CE: GOTO 2C7 |
|
|
514 |
02CF: MOVF 77,W |
|
|
515 |
02D0: MOVWF 29 |
|
|
516 |
02D1: MOVF 7A,W |
|
|
517 |
02D2: MOVWF 2A |
|
|
518 |
.................... |
|
|
519 |
.................... printf("count: %Lu %X %X %X %X\r\n",count, buffer[0],buffer[1],buffer[2],buffer[3]); |
|
|
520 |
02D3: MOVLW CF |
|
|
521 |
02D4: BSF 03.6 |
|
|
522 |
02D5: MOVWF 0D |
|
|
523 |
02D6: MOVLW 00 |
|
|
524 |
02D7: MOVWF 0F |
|
|
525 |
02D8: BCF 03.0 |
|
|
526 |
02D9: MOVLW 07 |
|
|
527 |
02DA: BCF 03.6 |
|
|
528 |
02DB: MOVWF 5E |
|
|
529 |
02DC: GOTO 14B |
|
|
530 |
02DD: MOVLW 10 |
|
|
531 |
02DE: MOVWF 04 |
|
|
532 |
02DF: MOVF 2A,W |
|
|
533 |
02E0: MOVWF 5F |
|
|
534 |
02E1: MOVF 29,W |
|
|
535 |
02E2: MOVWF 5E |
|
|
536 |
02E3: GOTO 19E |
|
|
537 |
02E4: MOVLW 20 |
|
|
538 |
02E5: BTFSS 0C.4 |
|
|
539 |
02E6: GOTO 2E5 |
|
|
540 |
02E7: MOVWF 19 |
|
|
541 |
02E8: MOVF 4B,W |
|
|
542 |
02E9: MOVWF 5E |
|
|
543 |
02EA: MOVLW 37 |
|
|
544 |
02EB: MOVWF 5F |
|
|
545 |
02EC: CALL 1F9 |
|
|
546 |
02ED: MOVLW 20 |
|
|
547 |
02EE: BTFSS 0C.4 |
|
|
548 |
02EF: GOTO 2EE |
|
|
549 |
02F0: MOVWF 19 |
|
|
550 |
02F1: MOVF 4C,W |
|
|
551 |
02F2: MOVWF 5E |
|
|
552 |
02F3: MOVLW 37 |
|
|
553 |
02F4: MOVWF 5F |
|
|
554 |
02F5: CALL 1F9 |
|
|
555 |
02F6: MOVLW 20 |
|
|
556 |
02F7: BTFSS 0C.4 |
|
|
557 |
02F8: GOTO 2F7 |
|
|
558 |
02F9: MOVWF 19 |
|
|
559 |
02FA: MOVF 4D,W |
|
|
560 |
02FB: MOVWF 5E |
|
|
561 |
02FC: MOVLW 37 |
|
|
562 |
02FD: MOVWF 5F |
|
|
563 |
02FE: CALL 1F9 |
|
|
564 |
02FF: MOVLW 20 |
|
|
565 |
0300: BTFSS 0C.4 |
|
|
566 |
0301: GOTO 300 |
|
|
567 |
0302: MOVWF 19 |
|
|
568 |
0303: MOVF 4E,W |
|
|
569 |
0304: MOVWF 5E |
|
|
570 |
0305: MOVLW 37 |
|
|
571 |
0306: MOVWF 5F |
|
|
572 |
0307: CALL 1F9 |
|
|
573 |
0308: MOVLW 0D |
|
|
574 |
0309: BTFSS 0C.4 |
|
|
575 |
030A: GOTO 309 |
|
|
576 |
030B: MOVWF 19 |
|
|
577 |
030C: MOVLW 0A |
|
|
578 |
030D: BTFSS 0C.4 |
|
|
579 |
030E: GOTO 30D |
|
|
580 |
030F: MOVWF 19 |
|
|
581 |
.................... } |
|
|
582 |
0310: GOTO 2A7 |
|
|
583 |
.................... } |
|
|
584 |
0311: SLEEP |
|
|
585 |
|
|
|
586 |
Configuration Fuses: |
|
|
587 |
Word 1: 2CF2 HS NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG |
|
|
588 |
Word 2: 3FFF NOWRT BORV40 |