Rev Author Line No. Line
960 jacho 1 CCS PCM C Compiler, Version 4.106, 47914 20-4-13 20:07
2  
3 Filename: C:\Users\Honza\Documents\pic\meteo_stanice\Nová složka\main.lst
4  
5 ROM used: 6167 words (75%)
6 Largest free fragment is 1185
7 RAM used: 29 (8%) at main() level
8 144 (39%) worst case
9 Stack: 5 worst case (3 in main + 2 for interrupts)
10  
11 *
12 0000: MOVLW 18
13 0001: MOVWF 0A
14 0002: GOTO 000
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.0
38 001A: GOTO 01D
39 001B: BTFSC 0C.0
40 001C: GOTO 032
41 001D: BTFSS 0B.5
42 001E: GOTO 021
43 001F: BTFSC 0B.2
44 0020: GOTO 035
45 0021: MOVF 22,W
46 0022: MOVWF 04
47 0023: MOVF 23,W
48 0024: MOVWF 77
49 0025: MOVF 24,W
50 0026: MOVWF 78
51 0027: MOVF 25,W
52 0028: MOVWF 79
53 0029: MOVF 26,W
54 002A: MOVWF 7A
55 002B: MOVF 20,W
56 002C: MOVWF 0A
57 002D: SWAPF 21,W
58 002E: MOVWF 03
59 002F: SWAPF 7F,F
60 0030: SWAPF 7F,W
61 0031: RETFIE
62 0032: BCF 0A.3
63 0033: BCF 0A.4
64 0034: GOTO 123
65 0035: BCF 0A.3
66 0036: BCF 0A.4
67 0037: GOTO 191
68 ....................
69 .................... //Meteorologicka cast
70 .................... #define VERSION "0.1"
71 .................... #define AUTOR "Jan Chroust"
72 .................... #define DATE "15.4.2013"
73 ....................
74 .................... #include <main.h>
75 .................... #include <16F887.h>
76 .................... //////// Standard Header file for the PIC16F887 device ////////////////
77 .................... #device PIC16F887
78 .................... #list
79 ....................
80 .................... #device adc=8
81 ....................
82 ....................
83 ....................
84 .................... #FUSES WDT // Watch Dog Timer
85 .................... //#FUSES NOWDT //No Watch Dog Timer
86 .................... #FUSES INTRC //Internal RC Osc
87 .................... #FUSES NOPUT //No Power Up Timer
88 .................... #FUSES MCLR //Master Clear pin enabled
89 .................... #FUSES NOPROTECT //Code not protected from reading
90 .................... #FUSES NOCPD //No EE protection
91 .................... #FUSES NOBROWNOUT //No brownout reset
92 .................... #FUSES IESO //Internal External Switch Over mode enabled
93 .................... #FUSES FCMEN //Fail-safe clock monitor enabled
94 .................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
95 .................... #FUSES NODEBUG //No Debug mode for ICD
96 .................... #FUSES NOWRT //Program memory not write protected
97 .................... #FUSES BORV40 //Brownout reset at 4.0V
98 ....................
99 .................... #use delay(clock=8000000)
100 *
101 02F5: MOVLW 65
102 02F6: MOVWF 04
103 02F7: BCF 03.7
104 02F8: MOVF 00,W
105 02F9: BTFSC 03.2
106 02FA: GOTO 308
107 02FB: MOVLW 02
108 02FC: MOVWF 78
109 02FD: CLRF 77
110 02FE: DECFSZ 77,F
111 02FF: GOTO 2FE
112 0300: DECFSZ 78,F
113 0301: GOTO 2FD
114 0302: MOVLW 97
115 0303: MOVWF 77
116 0304: DECFSZ 77,F
117 0305: GOTO 304
118 0306: DECFSZ 00,F
119 0307: GOTO 2FB
120 0308: RETURN
121 ....................
122 .................... //set I2C
123 .................... #define PIN_SDA PIN_C4
124 .................... #define PIN_SCL PIN_C3
125 .................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL)
126 *
127 022E: MOVLW 08
128 022F: MOVWF 78
129 0230: NOP
130 0231: BCF 07.3
131 0232: BCF 28.3
132 0233: MOVF 28,W
133 0234: BSF 03.5
134 0235: MOVWF 07
135 0236: NOP
136 0237: RLF 73,F
137 0238: BCF 03.5
138 0239: BCF 07.4
139 023A: BTFSS 03.0
140 023B: GOTO 242
141 023C: BSF 28.4
142 023D: MOVF 28,W
143 023E: BSF 03.5
144 023F: MOVWF 07
145 0240: GOTO 246
146 0241: BCF 03.5
147 0242: BCF 28.4
148 0243: MOVF 28,W
149 0244: BSF 03.5
150 0245: MOVWF 07
151 0246: NOP
152 0247: BCF 03.5
153 0248: BSF 28.3
154 0249: MOVF 28,W
155 024A: BSF 03.5
156 024B: MOVWF 07
157 024C: BCF 03.5
158 024D: BTFSS 07.3
159 024E: GOTO 24D
160 024F: DECFSZ 78,F
161 0250: GOTO 230
162 0251: NOP
163 0252: BCF 07.3
164 0253: BCF 28.3
165 0254: MOVF 28,W
166 0255: BSF 03.5
167 0256: MOVWF 07
168 0257: NOP
169 0258: BCF 03.5
170 0259: BSF 28.4
171 025A: MOVF 28,W
172 025B: BSF 03.5
173 025C: MOVWF 07
174 025D: NOP
175 025E: NOP
176 025F: BCF 03.5
177 0260: BSF 28.3
178 0261: MOVF 28,W
179 0262: BSF 03.5
180 0263: MOVWF 07
181 0264: BCF 03.5
182 0265: BTFSS 07.3
183 0266: GOTO 265
184 0267: CLRF 78
185 0268: NOP
186 0269: BTFSC 07.4
187 026A: BSF 78.0
188 026B: BCF 07.3
189 026C: BCF 28.3
190 026D: MOVF 28,W
191 026E: BSF 03.5
192 026F: MOVWF 07
193 0270: BCF 03.5
194 0271: BCF 07.4
195 0272: BCF 28.4
196 0273: MOVF 28,W
197 0274: BSF 03.5
198 0275: MOVWF 07
199 0276: BCF 03.5
200 0277: RETURN
201 *
202 02B0: MOVLW 08
203 02B1: MOVWF 74
204 02B2: MOVF 77,W
205 02B3: MOVWF 75
206 02B4: BSF 28.4
207 02B5: MOVF 28,W
208 02B6: BSF 03.5
209 02B7: MOVWF 07
210 02B8: NOP
211 02B9: BCF 03.5
212 02BA: BSF 28.3
213 02BB: MOVF 28,W
214 02BC: BSF 03.5
215 02BD: MOVWF 07
216 02BE: BCF 03.5
217 02BF: BTFSS 07.3
218 02C0: GOTO 2BF
219 02C1: BTFSC 07.4
220 02C2: BSF 03.0
221 02C3: BTFSS 07.4
222 02C4: BCF 03.0
223 02C5: RLF 78,F
224 02C6: NOP
225 02C7: BCF 28.3
226 02C8: MOVF 28,W
227 02C9: BSF 03.5
228 02CA: MOVWF 07
229 02CB: BCF 03.5
230 02CC: BCF 07.3
231 02CD: DECFSZ 74,F
232 02CE: GOTO 2B4
233 02CF: BSF 28.4
234 02D0: MOVF 28,W
235 02D1: BSF 03.5
236 02D2: MOVWF 07
237 02D3: NOP
238 02D4: BCF 03.5
239 02D5: BCF 07.4
240 02D6: MOVF 75,W
241 02D7: BTFSC 03.2
242 02D8: GOTO 2DE
243 02D9: BCF 28.4
244 02DA: MOVF 28,W
245 02DB: BSF 03.5
246 02DC: MOVWF 07
247 02DD: BCF 03.5
248 02DE: NOP
249 02DF: BSF 28.3
250 02E0: MOVF 28,W
251 02E1: BSF 03.5
252 02E2: MOVWF 07
253 02E3: BCF 03.5
254 02E4: BTFSS 07.3
255 02E5: GOTO 2E4
256 02E6: NOP
257 02E7: BCF 07.3
258 02E8: BCF 28.3
259 02E9: MOVF 28,W
260 02EA: BSF 03.5
261 02EB: MOVWF 07
262 02EC: NOP
263 02ED: BCF 03.5
264 02EE: BCF 07.4
265 02EF: BCF 28.4
266 02F0: MOVF 28,W
267 02F1: BSF 03.5
268 02F2: MOVWF 07
269 02F3: BCF 03.5
270 02F4: RETURN
271 .................... //set RS232
272 .................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
273 *
274 03D1: BCF 28.7
275 03D2: MOVF 28,W
276 03D3: BSF 03.5
277 03D4: MOVWF 07
278 03D5: BCF 03.5
279 03D6: BCF 07.7
280 03D7: MOVLW 08
281 03D8: MOVWF 78
282 03D9: GOTO 3DA
283 03DA: NOP
284 03DB: BSF 78.7
285 03DC: GOTO 3EB
286 03DD: BCF 78.7
287 03DE: RRF 64,F
288 03DF: BTFSC 03.0
289 03E0: BSF 07.7
290 03E1: BTFSS 03.0
291 03E2: BCF 07.7
292 03E3: BSF 78.6
293 03E4: GOTO 3EB
294 03E5: BCF 78.6
295 03E6: DECFSZ 78,F
296 03E7: GOTO 3DE
297 03E8: GOTO 3E9
298 03E9: NOP
299 03EA: BSF 07.7
300 03EB: MOVLW 3F
301 03EC: MOVWF 04
302 03ED: DECFSZ 04,F
303 03EE: GOTO 3ED
304 03EF: NOP
305 03F0: BTFSC 78.7
306 03F1: GOTO 3DD
307 03F2: BTFSC 78.6
308 03F3: GOTO 3E5
309 03F4: RETURN
310 ....................
311 .................... #include <math.h>
312 .................... ////////////////////////////////////////////////////////////////////////////
313 .................... //// (C) Copyright 1996,2008 Custom Computer Services ////
314 .................... //// This source code may only be used by licensed users of the CCS C ////
315 .................... //// compiler. This source code may only be distributed to other ////
316 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
317 .................... //// or distribution is permitted without written permission. ////
318 .................... //// Derivative programs created using this software in object code ////
319 .................... //// form are not restricted in any way. ////
320 .................... ////////////////////////////////////////////////////////////////////////////
321 .................... //// ////
322 .................... //// History: ////
323 .................... //// * 9/20/2001 : Improvments are made to sin/cos code. ////
324 .................... //// The code now is small, much faster, ////
325 .................... //// and more accurate. ////
326 .................... //// * 2/21/2007 : Compiler handles & operator differently and does
327 .................... //// not return generic (int8 *) so type cast is done ////
328 .................... //// ////
329 .................... ////////////////////////////////////////////////////////////////////////////
330 ....................
331 .................... #ifndef MATH_H
332 .................... #define MATH_H
333 ....................
334 .................... #ifdef PI
335 .................... #undef PI
336 .................... #endif
337 .................... #define PI 3.1415926535897932
338 ....................
339 ....................
340 .................... #define SQRT2 1.4142135623730950
341 ....................
342 .................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279};
343 .................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718};
344 ....................
345 .................... ///////////////////////////// Round Functions //////////////////////////////
346 ....................
347 .................... float32 CEIL_FLOOR(float32 x, unsigned int8 n)
348 .................... {
349 .................... float32 y, res;
350 .................... unsigned int16 l;
351 .................... int1 s;
352 ....................
353 .................... s = 0;
354 .................... y = x;
355 ....................
356 .................... if (x < 0)
357 .................... {
358 .................... s = 1;
359 .................... y = -y;
360 .................... }
361 ....................
362 .................... if (y <= 32768.0)
363 .................... res = (float32)(unsigned int16)y;
364 ....................
365 .................... else if (y < 10000000.0)
366 .................... {
367 .................... l = (unsigned int16)(y/32768.0);
368 .................... y = 32768.0*(y/32768.0 - (float32)l);
369 .................... res = 32768.0*(float32)l;
370 .................... res += (float32)(unsigned int16)y;
371 .................... }
372 ....................
373 .................... else
374 .................... res = y;
375 ....................
376 .................... y = y - (float32)(unsigned int16)y;
377 ....................
378 .................... if (s)
379 .................... res = -res;
380 ....................
381 .................... if (y != 0)
382 .................... {
383 .................... if (s == 1 && n == 0)
384 .................... res -= 1.0;
385 ....................
386 .................... if (s == 0 && n == 1)
387 .................... res += 1.0;
388 .................... }
389 .................... if (x == 0)
390 .................... res = 0;
391 ....................
392 .................... return (res);
393 .................... }
394 ....................
395 .................... // Overloaded Functions to take care for new Data types in PCD
396 .................... // Overloaded function CEIL_FLOOR() for data type - Float48
397 .................... #if defined(__PCD__)
398 .................... float48 CEIL_FLOOR(float48 x, unsigned int8 n)
399 .................... {
400 .................... float48 y, res;
401 .................... unsigned int16 l;
402 .................... int1 s;
403 ....................
404 .................... s = 0;
405 .................... y = x;
406 ....................
407 .................... if (x < 0)
408 .................... {
409 .................... s = 1;
410 .................... y = -y;
411 .................... }
412 ....................
413 .................... if (y <= 32768.0)
414 .................... res = (float48)(unsigned int16)y;
415 ....................
416 .................... else if (y < 10000000.0)
417 .................... {
418 .................... l = (unsigned int16)(y/32768.0);
419 .................... y = 32768.0*(y/32768.0 - (float48)l);
420 .................... res = 32768.0*(float32)l;
421 .................... res += (float48)(unsigned int16)y;
422 .................... }
423 ....................
424 .................... else
425 .................... res = y;
426 ....................
427 .................... y = y - (float48)(unsigned int16)y;
428 ....................
429 .................... if (s)
430 .................... res = -res;
431 ....................
432 .................... if (y != 0)
433 .................... {
434 .................... if (s == 1 && n == 0)
435 .................... res -= 1.0;
436 ....................
437 .................... if (s == 0 && n == 1)
438 .................... res += 1.0;
439 .................... }
440 .................... if (x == 0)
441 .................... res = 0;
442 ....................
443 .................... return (res);
444 .................... }
445 ....................
446 ....................
447 .................... // Overloaded function CEIL_FLOOR() for data type - Float64
448 .................... float64 CEIL_FLOOR(float64 x, unsigned int8 n)
449 .................... {
450 .................... float64 y, res;
451 .................... unsigned int16 l;
452 .................... int1 s;
453 ....................
454 .................... s = 0;
455 .................... y = x;
456 ....................
457 .................... if (x < 0)
458 .................... {
459 .................... s = 1;
460 .................... y = -y;
461 .................... }
462 ....................
463 .................... if (y <= 32768.0)
464 .................... res = (float64)(unsigned int16)y;
465 ....................
466 .................... else if (y < 10000000.0)
467 .................... {
468 .................... l = (unsigned int16)(y/32768.0);
469 .................... y = 32768.0*(y/32768.0 - (float64)l);
470 .................... res = 32768.0*(float64)l;
471 .................... res += (float64)(unsigned int16)y;
472 .................... }
473 ....................
474 .................... else
475 .................... res = y;
476 ....................
477 .................... y = y - (float64)(unsigned int16)y;
478 ....................
479 .................... if (s)
480 .................... res = -res;
481 ....................
482 .................... if (y != 0)
483 .................... {
484 .................... if (s == 1 && n == 0)
485 .................... res -= 1.0;
486 ....................
487 .................... if (s == 0 && n == 1)
488 .................... res += 1.0;
489 .................... }
490 .................... if (x == 0)
491 .................... res = 0;
492 ....................
493 .................... return (res);
494 .................... }
495 .................... #endif
496 ....................
497 .................... ////////////////////////////////////////////////////////////////////////////
498 .................... // float floor(float x)
499 .................... ////////////////////////////////////////////////////////////////////////////
500 .................... // Description : rounds down the number x.
501 .................... // Date : N/A
502 .................... //
503 .................... float32 floor(float32 x)
504 .................... {
505 .................... return CEIL_FLOOR(x, 0);
506 .................... }
507 .................... // Following 2 functions are overloaded functions of floor() for PCD
508 .................... // Overloaded function floor() for data type - Float48
509 .................... #if defined(__PCD__)
510 .................... float48 floor(float48 x)
511 .................... {
512 .................... return CEIL_FLOOR(x, 0);
513 .................... }
514 ....................
515 .................... // Overloaded function floor() for data type - Float64
516 .................... float64 floor(float64 x)
517 .................... {
518 .................... return CEIL_FLOOR(x, 0);
519 .................... }
520 .................... #endif
521 ....................
522 ....................
523 .................... ////////////////////////////////////////////////////////////////////////////
524 .................... // float ceil(float x)
525 .................... ////////////////////////////////////////////////////////////////////////////
526 .................... // Description : rounds up the number x.
527 .................... // Date : N/A
528 .................... //
529 .................... float32 ceil(float32 x)
530 .................... {
531 .................... return CEIL_FLOOR(x, 1);
532 .................... }
533 .................... // Following 2 functions are overloaded functions of ceil() for PCD
534 .................... // Overloaded function ceil() for data type - Float48
535 .................... #if defined(__PCD__)
536 .................... float48 ceil(float48 x)
537 .................... {
538 .................... return CEIL_FLOOR(x, 1);
539 .................... }
540 ....................
541 .................... // Overloaded function ceil() for data type - Float64
542 .................... float64 ceil(float64 x)
543 .................... {
544 .................... return CEIL_FLOOR(x, 1);
545 .................... }
546 .................... #endif
547 ....................
548 .................... ////////////////////////////////////////////////////////////////////////////
549 .................... // float fabs(float x)
550 .................... ////////////////////////////////////////////////////////////////////////////
551 .................... // Description : Computes the absolute value of floating point number x
552 .................... // Returns : returns the absolute value of x
553 .................... // Date : N/A
554 .................... //
555 .................... #define fabs abs
556 ....................
557 .................... ////////////////////////////////////////////////////////////////////////////
558 .................... // float fmod(float x)
559 .................... ////////////////////////////////////////////////////////////////////////////
560 .................... // Description : Computes the floating point remainder of x/y
561 .................... // Returns : returns the value of x= i*y, for some integer i such that, if y
562 .................... // is non zero, the result has the same isgn of x na dmagnitude less than the
563 .................... // magnitude of y. If y is zero then a domain error occurs.
564 .................... // Date : N/A
565 .................... //
566 ....................
567 .................... float fmod(float32 x,float32 y)
568 .................... {
569 .................... float32 i;
570 .................... if (y!=0.0)
571 .................... {
572 .................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
573 .................... return(x-(i*y));
574 .................... }
575 .................... else
576 .................... {
577 .................... #ifdef _ERRNO
578 .................... {
579 .................... errno=EDOM;
580 .................... }
581 .................... #endif
582 .................... }
583 .................... }
584 .................... //Overloaded function for fmod() for PCD
585 .................... // Overloaded function fmod() for data type - Float48
586 .................... #if defined(__PCD__)
587 .................... float48 fmod(float48 x,float48 y)
588 .................... {
589 .................... float48 i;
590 .................... if (y!=0.0)
591 .................... {
592 .................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
593 .................... return(x-(i*y));
594 .................... }
595 .................... else
596 .................... {
597 .................... #ifdef _ERRNO
598 .................... {
599 .................... errno=EDOM;
600 .................... }
601 .................... #endif
602 .................... }
603 .................... }
604 .................... // Overloaded function fmod() for data type - Float64
605 .................... float64 fmod(float64 x,float64 y)
606 .................... {
607 .................... float64 i;
608 .................... if (y!=0.0)
609 .................... {
610 .................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
611 .................... return(x-(i*y));
612 .................... }
613 .................... else
614 .................... {
615 .................... #ifdef _ERRNO
616 .................... {
617 .................... errno=EDOM;
618 .................... }
619 .................... #endif
620 .................... }
621 .................... }
622 .................... #endif
623 .................... //////////////////// Exponential and logarithmic functions ////////////////////
624 .................... ////////////////////////////////////////////////////////////////////////////
625 .................... // float exp(float x)
626 .................... ////////////////////////////////////////////////////////////////////////////
627 .................... // Description : returns the value (e^x)
628 .................... // Date : N/A
629 .................... //
630 .................... #define LN2 0.6931471805599453
631 ....................
632 .................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093,
633 .................... 0.0554965651, 0.240227138, 0.693147172};
634 ....................
635 ....................
636 .................... float32 exp(float32 x)
637 .................... {
638 .................... float32 y, res, r;
639 .................... #if defined(__PCD__)
640 .................... int8 data1;
641 .................... #endif
642 .................... signed int8 n;
643 .................... int1 s;
644 .................... #ifdef _ERRNO
645 .................... if(x > 88.722838)
646 .................... {
647 .................... errno=ERANGE;
648 .................... return(0);
649 .................... }
650 .................... #endif
651 .................... n = (signed int16)(x/LN2);
652 .................... s = 0;
653 .................... y = x;
654 ....................
655 .................... if (x < 0)
656 .................... {
657 .................... s = 1;
658 .................... n = -n;
659 .................... y = -y;
660 .................... }
661 ....................
662 .................... res = 0.0;
663 .................... #if !defined(__PCD__)
664 .................... *((unsigned int8 *)(&res)) = n + 0x7F;
665 .................... #endif
666 ....................
667 .................... #if defined(__PCD__) // Takes care of IEEE format for PCD
668 .................... data1 = n+0x7F;
669 .................... if(bit_test(data1,0))
670 .................... bit_set(*(((unsigned int8 *)(&res)+2)),7);
671 .................... rotate_right(&data1,1);
672 .................... bit_clear(data1,7);
673 .................... *(((unsigned int8 *)(&res)+3)) = data1;
674 .................... #endif
675 ....................
676 .................... y = y/LN2 - (float32)n;
677 ....................
678 .................... r = pe[0]*y + pe[1];
679 .................... r = r*y + pe[2];
680 .................... r = r*y + pe[3];
681 .................... r = r*y + pe[4];
682 .................... r = r*y + pe[5];
683 ....................
684 .................... res = res*(1.0 + y*r);
685 ....................
686 .................... if (s)
687 .................... res = 1.0/res;
688 .................... return(res);
689 .................... }
690 ....................
691 ....................
692 .................... //Overloaded function for exp() for PCD
693 .................... // Overloaded function exp() for data type - Float48
694 .................... #if defined(__PCD__)
695 .................... float48 exp(float48 x)
696 .................... {
697 .................... float48 y, res, r;
698 .................... int8 data1;
699 .................... signed int8 n;
700 .................... int1 s;
701 .................... #ifdef _ERRNO
702 .................... if(x > 88.722838)
703 .................... {
704 .................... errno=ERANGE;
705 .................... return(0);
706 .................... }
707 .................... #endif
708 .................... n = (signed int16)(x/LN2);
709 .................... s = 0;
710 .................... y = x;
711 ....................
712 .................... if (x < 0)
713 .................... {
714 .................... s = 1;
715 .................... n = -n;
716 .................... y = -y;
717 .................... }
718 ....................
719 .................... res = 0.0;
720 ....................
721 .................... data1 = n+0x7F;
722 .................... if(bit_test(data1,0))
723 .................... bit_set(*(((unsigned int8 *)(&res)+4)),7);
724 .................... rotate_right(&data1,1);
725 .................... bit_clear(data1,7);
726 .................... *(((unsigned int8 *)(&res)+5)) = data1;
727 ....................
728 .................... y = y/LN2 - (float48)n;
729 ....................
730 .................... r = pe[0]*y + pe[1];
731 .................... r = r*y + pe[2];
732 .................... r = r*y + pe[3];
733 .................... r = r*y + pe[4];
734 .................... r = r*y + pe[5];
735 ....................
736 .................... res = res*(1.0 + y*r);
737 ....................
738 .................... if (s)
739 .................... res = 1.0/res;
740 .................... return(res);
741 .................... }
742 ....................
743 .................... // Overloaded function exp() for data type - Float64
744 .................... float64 exp(float64 x)
745 .................... {
746 .................... float64 y, res, r;
747 .................... unsigned int16 data1, data2;
748 .................... unsigned int16 *p;
749 .................... signed int16 n;
750 .................... int1 s;
751 .................... #ifdef _ERRNO
752 .................... if(x > 709.7827128)
753 .................... {
754 .................... errno=ERANGE;
755 .................... return(0);
756 .................... }
757 .................... #endif
758 .................... n = (signed int16)(x/LN2);
759 .................... s = 0;
760 .................... y = x;
761 ....................
762 .................... if (x < 0)
763 .................... {
764 .................... s = 1;
765 .................... n = -n;
766 .................... y = -y;
767 .................... }
768 ....................
769 .................... res = 0.0;
770 ....................
771 .................... #if !defined(__PCD__)
772 .................... *((unsigned int16 *)(&res)) = n + 0x7F;
773 .................... #endif
774 .................... p= (((unsigned int16 *)(&res))+3);
775 .................... data1 = *p;
776 .................... data2 = *p;
777 .................... data1 = n + 0x3FF;
778 .................... data1 = data1 <<4;
779 .................... if(bit_test(data2,15))
780 .................... bit_set(data1,15);
781 .................... data2 = data2 & 0x000F;
782 .................... data1 ^= data2;
783 ....................
784 .................... *(((unsigned int16 *)(&res)+3)) = data1;
785 ....................
786 ....................
787 .................... y = y/LN2 - (float64)n;
788 ....................
789 .................... r = pe[0]*y + pe[1];
790 .................... r = r*y + pe[2];
791 .................... r = r*y + pe[3];
792 .................... r = r*y + pe[4];
793 .................... r = r*y + pe[5];
794 ....................
795 .................... res = res*(1.0 + y*r);
796 ....................
797 .................... if (s)
798 .................... res = 1.0/res;
799 .................... return(res);
800 .................... }
801 ....................
802 .................... #ENDIF
803 ....................
804 ....................
805 .................... /************************************************************/
806 ....................
807 .................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
808 .................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
809 ....................
810 .................... ////////////////////////////////////////////////////////////////////////////
811 .................... // float log(float x)
812 .................... ////////////////////////////////////////////////////////////////////////////
813 .................... // Description : returns the the natural log of x
814 .................... // Date : N/A
815 .................... //
816 .................... float32 log(float32 x)
817 .................... {
818 .................... float32 y, res, r, y2;
819 .................... #if defined(__PCD__)
820 .................... unsigned int8 data1,data2;
821 .................... #endif
822 .................... signed int8 n;
823 .................... #ifdef _ERRNO
824 .................... if(x <0)
825 .................... {
826 .................... errno=EDOM;
827 .................... }
828 .................... if(x ==0)
829 .................... {
830 .................... errno=ERANGE;
831 .................... return(0);
832 .................... }
833 .................... #endif
834 .................... y = x;
835 ....................
836 .................... if (y != 1.0)
837 .................... {
838 .................... #if !defined(__PCD__)
839 .................... *((unsigned int8 *)(&y)) = 0x7E;
840 .................... #endif
841 ....................
842 .................... #if defined(__PCD__) // Takes care of IEEE format
843 .................... data2 = *(((unsigned int8 *)(&y))+3);
844 .................... *(((unsigned int8 *)(&y))+3) = 0x3F;
845 .................... data1 = *(((unsigned int8 *)(&y))+2);
846 .................... bit_clear(data1,7);
847 .................... *(((unsigned int8 *)(&y))+2) = data1;
848 .................... if(bit_test(data2,7))
849 .................... bit_set(*(((unsigned int8 *)(&y))+3),7);
850 .................... #endif
851 ....................
852 .................... y = (y - 1.0)/(y + 1.0);
853 ....................
854 .................... y2=y*y;
855 ....................
856 .................... res = pl[0]*y2 + pl[1];
857 .................... res = res*y2 + pl[2];
858 .................... res = res*y2 + pl[3];
859 ....................
860 .................... r = ql[0]*y2 + ql[1];
861 .................... r = r*y2 + ql[2];
862 .................... r = r*y2 + ql[3];
863 ....................
864 .................... res = y*res/r;
865 .................... #if !defined(__PCD__)
866 .................... n = *((unsigned int8 *)(&x)) - 0x7E;
867 .................... #endif
868 .................... #if defined(__PCD__)
869 .................... data1 = *(((unsigned int8 *)(&x)+3));
870 .................... rotate_left(&data1,1);
871 .................... data2 = *(((unsigned int8 *)(&x)+2));
872 .................... if(bit_test (data2,7))
873 .................... bit_set(data1,0);
874 .................... n = data1 - 0x7E;
875 .................... #endif
876 ....................
877 .................... if (n<0)
878 .................... r = -(float32)-n;
879 .................... else
880 .................... r = (float32)n;
881 ....................
882 .................... res += r*LN2;
883 .................... }
884 ....................
885 .................... else
886 .................... res = 0.0;
887 ....................
888 .................... return(res);
889 .................... }
890 ....................
891 .................... //Overloaded function for log() for PCD
892 .................... // Overloaded function log() for data type - Float48
893 .................... #if defined(__PCD__)
894 .................... float48 log(float48 x)
895 .................... {
896 .................... float48 y, res, r, y2;
897 .................... unsigned int8 data1,data2;
898 .................... signed int8 n;
899 .................... #ifdef _ERRNO
900 .................... if(x <0)
901 .................... {
902 .................... errno=EDOM;
903 .................... }
904 .................... if(x ==0)
905 .................... {
906 .................... errno=ERANGE;
907 .................... return(0);
908 .................... }
909 .................... #endif
910 .................... y = x;
911 ....................
912 .................... if (y != 1.0)
913 .................... {
914 ....................
915 .................... #if !defined(__PCD__)
916 .................... *((unsigned int8 *)(&y)) = 0x7E;
917 .................... #endif
918 .................... data2 = *(((unsigned int8 *)(&y))+5);
919 .................... *(((unsigned int8 *)(&y))+5) = 0x3F;
920 .................... data1 = *(((unsigned int8 *)(&y))+4);
921 .................... bit_clear(data1,7);
922 .................... *(((unsigned int8 *)(&y))+4) = data1;
923 ....................
924 .................... if(bit_test(data2,7))
925 .................... bit_set(*(((unsigned int8 *)(&y))+4),7);
926 .................... y = (y - 1.0)/(y + 1.0);
927 ....................
928 .................... y2=y*y;
929 ....................
930 .................... res = pl[0]*y2 + pl[1];
931 .................... res = res*y2 + pl[2];
932 .................... res = res*y2 + pl[3];
933 ....................
934 .................... r = ql[0]*y2 + ql[1];
935 .................... r = r*y2 + ql[2];
936 .................... r = r*y2 + ql[3];
937 ....................
938 .................... res = y*res/r;
939 ....................
940 .................... data1 = *(((unsigned int8 *)(&x)+5));
941 .................... rotate_left(&data1,1);
942 .................... data2 = *(((unsigned int8 *)(&x)+4));
943 .................... if(bit_test (data2,7))
944 .................... bit_set(data1,0);
945 ....................
946 .................... n = data1 - 0x7E;
947 ....................
948 .................... if (n<0)
949 .................... r = -(float48)-n;
950 .................... else
951 .................... r = (float48)n;
952 ....................
953 .................... res += r*LN2;
954 .................... }
955 ....................
956 .................... else
957 .................... res = 0.0;
958 ....................
959 .................... return(res);
960 .................... }
961 ....................
962 .................... // Overloaded function log() for data type - Float48
963 .................... #if defined(__PCD__)
964 .................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
965 .................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
966 .................... #endif
967 .................... float64 log(float64 x)
968 .................... {
969 .................... float64 y, res, r, y2;
970 .................... unsigned int16 data1,data2;
971 .................... unsigned int16 *p;
972 .................... signed int16 n;
973 .................... #ifdef _ERRNO
974 .................... if(x <0)
975 .................... {
976 .................... errno=EDOM;
977 .................... }
978 .................... if(x ==0)
979 .................... {
980 .................... errno=ERANGE;
981 .................... return(0);
982 .................... }
983 .................... #endif
984 .................... y = x;
985 ....................
986 .................... if (y != 1.0)
987 .................... {
988 .................... #if !defined(__PCD__)
989 .................... *((unsigned int8 *)(&y)) = 0x7E;
990 .................... #endif
991 .................... p= (((unsigned int16 *)(&y))+3);
992 .................... data1 = *p;
993 .................... data2 = *p;
994 .................... data1 = 0x3FE;
995 .................... data1 = data1 <<4;
996 .................... if(bit_test (data2,15))
997 .................... bit_set(data1,15);
998 .................... data2 = data2 & 0x000F;
999 .................... data1 ^=data2;
1000 ....................
1001 .................... *p = data1;
1002 ....................
1003 .................... y = (y - 1.0)/(y + 1.0);
1004 ....................
1005 .................... y2=y*y;
1006 ....................
1007 .................... res = pl_64[0]*y2 + pl_64[1];
1008 .................... res = res*y2 + pl_64[2];
1009 .................... res = res*y2 + pl_64[3];
1010 ....................
1011 .................... r = ql_64[0]*y2 + ql_64[1];
1012 .................... r = r*y2 + ql_64[2];
1013 .................... r = r*y2 + ql_64[3];
1014 ....................
1015 .................... res = y*res/r;
1016 ....................
1017 .................... p= (((unsigned int16 *)(&x))+3);
1018 .................... data1 = *p;
1019 .................... bit_clear(data1,15);
1020 .................... data1 = data1 >>4;
1021 .................... n = data1 - 0x3FE;
1022 ....................
1023 ....................
1024 .................... if (n<0)
1025 .................... r = -(float64)-n;
1026 .................... else
1027 .................... r = (float64)n;
1028 ....................
1029 .................... res += r*LN2;
1030 .................... }
1031 ....................
1032 .................... else
1033 .................... res = 0.0;
1034 ....................
1035 .................... return(res);
1036 .................... }
1037 .................... #endif
1038 ....................
1039 ....................
1040 .................... #define LN10 2.3025850929940456
1041 ....................
1042 .................... ////////////////////////////////////////////////////////////////////////////
1043 .................... // float log10(float x)
1044 .................... ////////////////////////////////////////////////////////////////////////////
1045 .................... // Description : returns the the log base 10 of x
1046 .................... // Date : N/A
1047 .................... //
1048 .................... float32 log10(float32 x)
1049 .................... {
1050 .................... float32 r;
1051 ....................
1052 .................... r = log(x);
1053 .................... r = r/LN10;
1054 .................... return(r);
1055 .................... }
1056 ....................
1057 .................... //Overloaded functions for log10() for PCD
1058 .................... // Overloaded function log10() for data type - Float48
1059 .................... #if defined(__PCD__)
1060 .................... float48 log10(float48 x)
1061 .................... {
1062 .................... float48 r;
1063 ....................
1064 .................... r = log(x);
1065 .................... r = r/LN10;
1066 .................... return(r);
1067 .................... }
1068 ....................
1069 .................... // Overloaded function log10() for data type - Float64
1070 .................... float64 log10(float64 x)
1071 .................... {
1072 .................... float64 r;
1073 ....................
1074 .................... r = log(x);
1075 .................... r = r/LN10;
1076 .................... return(r);
1077 .................... }
1078 .................... #endif
1079 .................... ////////////////////////////////////////////////////////////////////////////
1080 .................... // float modf(float x)
1081 .................... ////////////////////////////////////////////////////////////////////////////
1082 .................... // Description :breaks the argument value int integral and fractional parts,
1083 .................... // ach of which have the same sign as the argument. It stores the integral part
1084 .................... // as a float in the object pointed to by the iptr
1085 .................... // Returns : returns the signed fractional part of value.
1086 .................... // Date : N/A
1087 .................... //
1088 ....................
1089 .................... float32 modf(float32 value,float32 *iptr)
1090 .................... {
1091 .................... *iptr=(value < 0.0)? ceil(value): floor(value);
1092 .................... return(value - *iptr);
1093 .................... }
1094 .................... //Overloaded functions for modf() for PCD
1095 .................... // Overloaded function modf() for data type - Float48
1096 .................... #if defined(__PCD__)
1097 .................... float48 modf(float48 value,float48 *iptr)
1098 .................... {
1099 .................... *iptr=(value < 0.0)? ceil(value): floor(value);
1100 .................... return(value - *iptr);
1101 .................... }
1102 .................... // Overloaded function modf() for data type - Float64
1103 .................... float64 modf(float64 value,float64 *iptr)
1104 .................... {
1105 .................... *iptr=(value < 0.0)? ceil(value): floor(value);
1106 .................... return(value - *iptr);
1107 .................... }
1108 .................... #endif
1109 ....................
1110 .................... ////////////////////////////////////////////////////////////////////////////
1111 .................... // float pwr(float x,float y)
1112 .................... ////////////////////////////////////////////////////////////////////////////
1113 .................... // Description : returns the value (x^y)
1114 .................... // Date : N/A
1115 .................... // Note : 0 is returned when the function will generate an imaginary number
1116 .................... //
1117 .................... float32 pwr(float32 x,float32 y)
1118 .................... {
1119 .................... if(0 > x && fmod(y, 1) == 0) {
1120 .................... if(fmod(y, 2) == 0) {
1121 .................... return (exp(log(-x) * y));
1122 .................... } else {
1123 .................... return (-exp(log(-x) * y));
1124 .................... }
1125 .................... } else if(0 > x && fmod(y, 1) != 0) {
1126 .................... return 0;
1127 .................... } else {
1128 .................... if(x != 0 || 0 >= y) {
1129 .................... return (exp(log(x) * y));
1130 .................... }
1131 .................... }
1132 .................... }
1133 .................... //Overloaded functions for pwr() for PCD
1134 .................... // Overloaded function pwr() for data type - Float48
1135 .................... #if defined(__PCD__)
1136 .................... float48 pwr(float48 x,float48 y)
1137 .................... {
1138 .................... if(0 > x && fmod(y, 1) == 0) {
1139 .................... if(fmod(y, 2) == 0) {
1140 .................... return (exp(log(-x) * y));
1141 .................... } else {
1142 .................... return (-exp(log(-x) * y));
1143 .................... }
1144 .................... } else if(0 > x && fmod(y, 1) != 0) {
1145 .................... return 0;
1146 .................... } else {
1147 .................... if(x != 0 || 0 >= y) {
1148 .................... return (exp(log(x) * y));
1149 .................... }
1150 .................... }
1151 .................... }
1152 .................... // Overloaded function pwr() for data type - Float64
1153 .................... float64 pwr(float64 x,float64 y)
1154 .................... {
1155 .................... if(0 > x && fmod(y, 1) == 0) {
1156 .................... if(fmod(y, 2) == 0) {
1157 .................... return (exp(log(-x) * y));
1158 .................... } else {
1159 .................... return (-exp(log(-x) * y));
1160 .................... }
1161 .................... } else if(0 > x && fmod(y, 1) != 0) {
1162 .................... return 0;
1163 .................... } else {
1164 .................... if(x != 0 || 0 >= y) {
1165 .................... return (exp(log(x) * y));
1166 .................... }
1167 .................... }
1168 .................... }
1169 .................... #endif
1170 ....................
1171 .................... //////////////////// Power functions ////////////////////
1172 ....................
1173 .................... ////////////////////////////////////////////////////////////////////////////
1174 .................... // float pow(float x,float y)
1175 .................... ////////////////////////////////////////////////////////////////////////////
1176 .................... // Description : returns the value (x^y)
1177 .................... // Date : N/A
1178 .................... // Note : 0 is returned when the function will generate an imaginary number
1179 .................... //
1180 .................... float32 pow(float32 x,float32 y)
1181 .................... {
1182 .................... if(0 > x && fmod(y, 1) == 0) {
1183 .................... if(fmod(y, 2) == 0) {
1184 .................... return (exp(log(-x) * y));
1185 .................... } else {
1186 .................... return (-exp(log(-x) * y));
1187 .................... }
1188 .................... } else if(0 > x && fmod(y, 1) != 0) {
1189 .................... return 0;
1190 .................... } else {
1191 .................... if(x != 0 || 0 >= y) {
1192 .................... return (exp(log(x) * y));
1193 .................... }
1194 .................... }
1195 .................... }
1196 .................... //Overloaded functions for pow() for PCD
1197 .................... // Overloaded function for pow() data type - Float48
1198 .................... #if defined(__PCD__)
1199 .................... float48 pow(float48 x,float48 y)
1200 .................... {
1201 .................... if(0 > x && fmod(y, 1) == 0) {
1202 .................... if(fmod(y, 2) == 0) {
1203 .................... return (exp(log(-x) * y));
1204 .................... } else {
1205 .................... return (-exp(log(-x) * y));
1206 .................... }
1207 .................... } else if(0 > x && fmod(y, 1) != 0) {
1208 .................... return 0;
1209 .................... } else {
1210 .................... if(x != 0 || 0 >= y) {
1211 .................... return (exp(log(x) * y));
1212 .................... }
1213 .................... }
1214 .................... }
1215 ....................
1216 .................... // Overloaded function pow() for data type - Float64
1217 .................... float64 pow(float64 x,float64 y)
1218 .................... {
1219 .................... if(0 > x && fmod(y, 1) == 0) {
1220 .................... if(fmod(y, 2) == 0) {
1221 .................... return (exp(log(-x) * y));
1222 .................... } else {
1223 .................... return (-exp(log(-x) * y));
1224 .................... }
1225 .................... } else if(0 > x && fmod(y, 1) != 0) {
1226 .................... return 0;
1227 .................... } else {
1228 .................... if(x != 0 || 0 >= y) {
1229 .................... return (exp(log(x) * y));
1230 .................... }
1231 .................... }
1232 .................... }
1233 .................... #endif
1234 ....................
1235 .................... ////////////////////////////////////////////////////////////////////////////
1236 .................... // float sqrt(float x)
1237 .................... ////////////////////////////////////////////////////////////////////////////
1238 .................... // Description : returns the square root of x
1239 .................... // Date : N/A
1240 .................... //
1241 .................... float32 sqrt(float32 x)
1242 .................... {
1243 .................... float32 y, res;
1244 .................... #if defined(__PCD__)
1245 .................... unsigned int16 data1,data2;
1246 .................... #endif
1247 .................... BYTE *p;
1248 ....................
1249 .................... #ifdef _ERRNO
1250 .................... if(x < 0)
1251 .................... {
1252 .................... errno=EDOM;
1253 .................... }
1254 .................... #endif
1255 ....................
1256 .................... if( x<=0.0)
1257 .................... return(0.0);
1258 ....................
1259 .................... y=x;
1260 ....................
1261 .................... #if !defined(__PCD__)
1262 .................... p=&y;
1263 .................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
1264 .................... #endif
1265 ....................
1266 .................... #if defined(__PCD__)
1267 .................... p = (((unsigned int8 *)(&y))+3);
1268 .................... data1 = *(((unsigned int8 *)(&y))+3);
1269 .................... data2 = *(((unsigned int8 *)(&y))+2);
1270 .................... rotate_left(&data1,1);
1271 .................... if(bit_test(data2,7))
1272 .................... bit_set(data1,0);
1273 .................... data1 = ((data1+127) >>1);
1274 .................... bit_clear(data2,7);
1275 .................... if(bit_test(data1,0))
1276 .................... bit_set(data2,7);
1277 .................... data1 = data1 >>1;
1278 .................... *(((unsigned int8 *)(&y))+3) = data1;
1279 .................... *(((unsigned int8 *)(&y))+2) = data2;
1280 ....................
1281 .................... #endif
1282 ....................
1283 .................... do {
1284 .................... res=y;
1285 .................... y+=(x/y);
1286 ....................
1287 .................... #if !defined(__PCD__)
1288 .................... (*p)--;
1289 .................... #endif
1290 ....................
1291 .................... #if defined(__PCD__)
1292 .................... data1 = *(((unsigned int8 *)(&y))+3);
1293 .................... data2 = *(((unsigned int8 *)(&y))+2);
1294 .................... rotate_left(&data1,1);
1295 .................... if(bit_test(data2,7))
1296 .................... bit_set(data1,0);
1297 .................... data1--;
1298 .................... bit_clear(data2,7);
1299 .................... if(bit_test(data1,0))
1300 .................... bit_set(data2,7);
1301 .................... data1 = data1 >>1;
1302 .................... *(((unsigned int8 *)(&y))+3) = data1;
1303 .................... *(((unsigned int8 *)(&y))+2) = data2;
1304 ....................
1305 .................... #endif
1306 .................... } while(res != y);
1307 ....................
1308 .................... return(res);
1309 .................... }
1310 .................... //Overloaded functions for sqrt() for PCD
1311 .................... // Overloaded function sqrt() for data type - Float48
1312 .................... #if defined(__PCD__)
1313 .................... float48 sqrt(float48 x)
1314 .................... {
1315 .................... float48 y, res;
1316 .................... unsigned int16 data1,data2;
1317 .................... BYTE *p;
1318 ....................
1319 .................... #ifdef _ERRNO
1320 .................... if(x < 0)
1321 .................... {
1322 .................... errno=EDOM;
1323 .................... }
1324 .................... #endif
1325 ....................
1326 .................... if( x<=0.0)
1327 .................... return(0.0);
1328 ....................
1329 .................... y=x;
1330 ....................
1331 .................... #if !defined(__PCD__)
1332 .................... p=&y;
1333 .................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
1334 .................... #endif
1335 ....................
1336 .................... #if defined(__PCD__)
1337 .................... p = (((unsigned int8 *)(&y))+5);
1338 .................... data1 = *(((unsigned int8 *)(&y))+5);
1339 .................... data2 = *(((unsigned int8 *)(&y))+4);
1340 .................... rotate_left(&data1,1);
1341 .................... if(bit_test(data2,7))
1342 .................... bit_set(data1,0);
1343 .................... data1 = ((data1+127) >>1);
1344 .................... bit_clear(data2,7);
1345 .................... if(bit_test(data1,0))
1346 .................... bit_set(data2,7);
1347 .................... data1 = data1 >>1;
1348 .................... *(((unsigned int8 *)(&y))+5) = data1;
1349 .................... *(((unsigned int8 *)(&y))+4) = data2;
1350 ....................
1351 .................... #endif
1352 ....................
1353 .................... do {
1354 .................... res=y;
1355 .................... y+=(x/y);
1356 ....................
1357 .................... #if !defined(__PCD__)
1358 .................... (*p)--;
1359 .................... #endif
1360 ....................
1361 .................... data1 = *(((unsigned int8 *)(&y))+5);
1362 .................... data2 = *(((unsigned int8 *)(&y))+4);
1363 .................... rotate_left(&data1,1);
1364 .................... if(bit_test(data2,7))
1365 .................... bit_set(data1,0);
1366 .................... data1--;
1367 .................... bit_clear(data2,7);
1368 .................... if(bit_test(data1,0))
1369 .................... bit_set(data2,7);
1370 .................... data1 = data1 >>1;
1371 .................... *(((unsigned int8 *)(&y))+5) = data1;
1372 .................... *(((unsigned int8 *)(&y))+4) = data2;
1373 ....................
1374 .................... } while(res != y);
1375 ....................
1376 .................... return(res);
1377 .................... }
1378 ....................
1379 .................... // Overloaded function sqrt() for data type - Float64
1380 .................... float64 sqrt(float64 x)
1381 .................... {
1382 .................... float64 y, res;
1383 .................... unsigned int16 *p;
1384 .................... unsigned int16 temp1,temp2;
1385 ....................
1386 .................... #ifdef _ERRNO
1387 .................... if(x < 0)
1388 .................... {
1389 .................... errno=EDOM;
1390 .................... }
1391 .................... #endif
1392 ....................
1393 .................... if( x<=0.0)
1394 .................... return(0.0);
1395 ....................
1396 .................... y=x;
1397 .................... p= (((unsigned int16 *)(&y))+3);
1398 .................... temp1 = *p;
1399 .................... temp2 = *p;
1400 .................... bit_clear(temp1,15);
1401 .................... temp1 = (temp1>>4)+1023;
1402 .................... temp1 = temp1 >> 1;
1403 .................... temp1 = (temp1<<4) & 0xFFF0;
1404 .................... if(bit_test(temp2,15))
1405 .................... bit_set(temp1,15);
1406 .................... temp2 = temp2 & 0x000F;
1407 .................... temp1 ^= temp2;
1408 ....................
1409 .................... (*p) = temp1;
1410 ....................
1411 .................... do {
1412 .................... res=y;
1413 .................... y+=(x/y);
1414 .................... temp1 = *p;
1415 .................... temp2 = *p;
1416 .................... bit_clear(temp1,15);
1417 .................... temp1 = (temp1>>4);
1418 .................... temp1--;
1419 .................... temp1 = (temp1<<4) & 0xFFF0;
1420 .................... if(bit_test(temp2,15))
1421 .................... bit_set(temp1,15);
1422 .................... temp2 = temp2 & 0x000F;
1423 .................... temp1 ^= temp2;
1424 .................... (*p) = temp1;
1425 ....................
1426 .................... } while(res != y);
1427 ....................
1428 .................... return(res);
1429 .................... }
1430 .................... #endif
1431 ....................
1432 .................... ////////////////////////////// Trig Functions //////////////////////////////
1433 .................... #ifdef PI_DIV_BY_TWO
1434 .................... #undef PI_DIV_BY_TWO
1435 .................... #endif
1436 .................... #define PI_DIV_BY_TWO 1.5707963267948966
1437 .................... #ifdef TWOBYPI
1438 .................... #undef TWOBYPI
1439 .................... #define TWOBYPI 0.6366197723675813
1440 .................... #endif
1441 .................... ////////////////////////////////////////////////////////////////////////////
1442 .................... // float cos(float x)
1443 .................... ////////////////////////////////////////////////////////////////////////////
1444 .................... // Description : returns the cosine value of the angle x, which is in radian
1445 .................... // Date : 9/20/2001
1446 .................... //
1447 .................... float32 cos(float32 x)
1448 .................... {
1449 .................... float32 y, t, t2 = 1.0;
1450 .................... unsigned int8 quad, i;
1451 .................... float32 frac;
1452 .................... float32 p[6] = { //by the series definition for cosine
1453 .................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
1454 .................... 0.04166666666667,
1455 .................... -0.00138888888889,
1456 .................... 0.00002480158730,
1457 .................... -0.00000027557319,
1458 .................... 0.00000000208767,
1459 .................... //-0.00000000001147,
1460 .................... // 0.00000000000005
1461 .................... };
1462 ....................
1463 .................... if (x < 0) x = -x; // absolute value of input
1464 ....................
1465 .................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
1466 .................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
1467 .................... quad = quad % 4; // quadrant (0 to 3)
1468 ....................
1469 .................... if (quad == 0 || quad == 2)
1470 .................... t = frac * PI_DIV_BY_TWO;
1471 .................... else if (quad == 1)
1472 .................... t = (1-frac) * PI_DIV_BY_TWO;
1473 .................... else // should be 3
1474 .................... t = (frac-1) * PI_DIV_BY_TWO;
1475 ....................
1476 .................... y = 1.0;
1477 .................... t = t * t;
1478 .................... for (i = 0; i <= 5; i++)
1479 .................... {
1480 .................... t2 = t2 * t;
1481 .................... y = y + p[i] * t2;
1482 .................... }
1483 ....................
1484 .................... if (quad == 2 || quad == 1)
1485 .................... y = -y; // correct sign
1486 ....................
1487 .................... return (y);
1488 .................... }
1489 ....................
1490 ....................
1491 .................... //Overloaded functions for cos() for PCD
1492 .................... // Overloaded function cos() for data type - Float48
1493 .................... #if defined(__PCD__)
1494 .................... float48 cos(float48 x)
1495 .................... {
1496 .................... float48 y, t, t2 = 1.0;
1497 .................... unsigned int8 quad, i;
1498 .................... float48 frac;
1499 .................... float48 p[6] = { //by the series definition for cosine
1500 .................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
1501 .................... 0.04166666666667,
1502 .................... -0.00138888888889,
1503 .................... 0.00002480158730,
1504 .................... -0.00000027557319,
1505 .................... 0.00000000208767,
1506 .................... //-0.00000000001147,
1507 .................... // 0.00000000000005
1508 .................... };
1509 ....................
1510 .................... if (x < 0) x = -x; // absolute value of input
1511 ....................
1512 .................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
1513 .................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
1514 .................... quad = quad % 4; // quadrant (0 to 3)
1515 ....................
1516 .................... if (quad == 0 || quad == 2)
1517 .................... t = frac * PI_DIV_BY_TWO;
1518 .................... else if (quad == 1)
1519 .................... t = (1-frac) * PI_DIV_BY_TWO;
1520 .................... else // should be 3
1521 .................... t = (frac-1) * PI_DIV_BY_TWO;
1522 ....................
1523 .................... y = 0.999999999781;
1524 .................... t = t * t;
1525 .................... for (i = 0; i <= 5; i++)
1526 .................... {
1527 .................... t2 = t2 * t;
1528 .................... y = y + p[i] * t2;
1529 .................... }
1530 ....................
1531 .................... if (quad == 2 || quad == 1)
1532 .................... y = -y; // correct sign
1533 ....................
1534 .................... return (y);
1535 .................... }
1536 ....................
1537 .................... // Overloaded function cos() for data type - Float48
1538 .................... float64 cos(float64 x)
1539 .................... {
1540 .................... float64 y, t, t2 = 1.0;
1541 .................... unsigned int8 quad, i;
1542 .................... float64 frac;
1543 .................... float64 p[6] = { //by the series definition for cosine
1544 .................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
1545 .................... 0.04166666666667,
1546 .................... -0.00138888888889,
1547 .................... 0.00002480158730,
1548 .................... -0.00000027557319,
1549 .................... 0.00000000208767,
1550 .................... //-0.00000000001147,
1551 .................... // 0.00000000000005
1552 .................... };
1553 ....................
1554 .................... if (x < 0) x = -x; // absolute value of input
1555 ....................
1556 .................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
1557 .................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
1558 .................... quad = quad % 4; // quadrant (0 to 3)
1559 ....................
1560 .................... if (quad == 0 || quad == 2)
1561 .................... t = frac * PI_DIV_BY_TWO;
1562 .................... else if (quad == 1)
1563 .................... t = (1-frac) * PI_DIV_BY_TWO;
1564 .................... else // should be 3
1565 .................... t = (frac-1) * PI_DIV_BY_TWO;
1566 ....................
1567 .................... y = 0.999999999781;
1568 .................... t = t * t;
1569 .................... for (i = 0; i <= 5; i++)
1570 .................... {
1571 .................... t2 = t2 * t;
1572 .................... y = y + p[i] * t2;
1573 .................... }
1574 ....................
1575 .................... if (quad == 2 || quad == 1)
1576 .................... y = -y; // correct sign
1577 ....................
1578 .................... return (y);
1579 .................... }
1580 ....................
1581 .................... #endif
1582 ....................
1583 .................... ////////////////////////////////////////////////////////////////////////////
1584 .................... // float sin(float x)
1585 .................... ////////////////////////////////////////////////////////////////////////////
1586 .................... // Description : returns the sine value of the angle x, which is in radian
1587 .................... // Date : 9/20/2001
1588 .................... //
1589 .................... float32 sin(float32 x)
1590 .................... {
1591 .................... return cos(x - PI_DIV_BY_TWO);
1592 .................... }
1593 ....................
1594 .................... //Overloaded functions for sin() for PCD
1595 .................... // Overloaded function sin() for data type - Float48
1596 .................... #if defined(__PCD__)
1597 .................... float48 sin(float48 x)
1598 .................... {
1599 .................... return cos(x - PI_DIV_BY_TWO);
1600 .................... }
1601 ....................
1602 .................... // Overloaded function sin() for data type - Float48
1603 .................... float64 sin(float64 x)
1604 .................... {
1605 .................... return cos(x - PI_DIV_BY_TWO);
1606 .................... }
1607 .................... #endif
1608 ....................
1609 .................... ////////////////////////////////////////////////////////////////////////////
1610 .................... // float tan(float x)
1611 .................... ////////////////////////////////////////////////////////////////////////////
1612 .................... // Description : returns the tangent value of the angle x, which is in radian
1613 .................... // Date : 9/20/2001
1614 .................... //
1615 .................... float32 tan(float32 x)
1616 .................... {
1617 .................... float32 c, s;
1618 ....................
1619 .................... c = cos(x);
1620 .................... if (c == 0.0)
1621 .................... return (1.0e+36);
1622 ....................
1623 .................... s = sin(x);
1624 .................... return(s/c);
1625 .................... }
1626 .................... //Overloaded functions for tan() for PCD
1627 .................... // Overloaded function tan() for data type - Float48
1628 .................... #if defined(__PCD__)
1629 .................... float48 tan(float48 x)
1630 .................... {
1631 .................... float48 c, s;
1632 ....................
1633 .................... c = cos(x);
1634 .................... if (c == 0.0)
1635 .................... return (1.0e+36);
1636 ....................
1637 .................... s = sin(x);
1638 .................... return(s/c);
1639 .................... }
1640 ....................
1641 .................... // Overloaded function tan() for data type - Float48
1642 .................... float64 tan(float64 x)
1643 .................... {
1644 .................... float64 c, s;
1645 ....................
1646 .................... c = cos(x);
1647 .................... if (c == 0.0)
1648 .................... return (1.0e+36);
1649 ....................
1650 .................... s = sin(x);
1651 .................... return(s/c);
1652 .................... }
1653 .................... #endif
1654 ....................
1655 .................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290};
1656 .................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290};
1657 ....................
1658 .................... float32 ASIN_COS(float32 x, unsigned int8 n)
1659 .................... {
1660 .................... float32 y, res, r, y2;
1661 .................... int1 s;
1662 .................... #ifdef _ERRNO
1663 .................... if(x <-1 || x > 1)
1664 .................... {
1665 .................... errno=EDOM;
1666 .................... }
1667 .................... #endif
1668 .................... s = 0;
1669 .................... y = x;
1670 ....................
1671 .................... if (x < 0)
1672 .................... {
1673 .................... s = 1;
1674 .................... y = -y;
1675 .................... }
1676 ....................
1677 .................... if (y > 0.5)
1678 .................... {
1679 .................... y = sqrt((1.0 - y)/2.0);
1680 .................... n += 2;
1681 .................... }
1682 ....................
1683 .................... y2=y*y;
1684 ....................
1685 .................... res = pas[0]*y2 + pas[1];
1686 .................... res = res*y2 + pas[2];
1687 ....................
1688 .................... r = qas[0]*y2 + qas[1];
1689 .................... r = r*y2 + qas[2];
1690 ....................
1691 .................... res = y*res/r;
1692 ....................
1693 .................... if (n & 2) // |x| > 0.5
1694 .................... res = PI_DIV_BY_TWO - 2.0*res;
1695 .................... if (s)
1696 .................... res = -res;
1697 .................... if (n & 1) // take arccos
1698 .................... res = PI_DIV_BY_TWO - res;
1699 ....................
1700 .................... return(res);
1701 .................... }
1702 ....................
1703 .................... //Overloaded functions for ASIN_COS() for PCD
1704 .................... // Overloaded function ASIN_COS() for data type - Float48
1705 .................... #if defined(__PCD__)
1706 .................... float48 ASIN_COS(float48 x, unsigned int8 n)
1707 .................... {
1708 .................... float48 y, res, r, y2;
1709 .................... int1 s;
1710 .................... #ifdef _ERRNO
1711 .................... if(x <-1 || x > 1)
1712 .................... {
1713 .................... errno=EDOM;
1714 .................... }
1715 .................... #endif
1716 .................... s = 0;
1717 .................... y = x;
1718 ....................
1719 .................... if (x < 0)
1720 .................... {
1721 .................... s = 1;
1722 .................... y = -y;
1723 .................... }
1724 ....................
1725 .................... if (y > 0.5)
1726 .................... {
1727 .................... y = sqrt((1.0 - y)/2.0);
1728 .................... n += 2;
1729 .................... }
1730 ....................
1731 .................... y2=y*y;
1732 ....................
1733 .................... res = pas[0]*y2 + pas[1];
1734 .................... res = res*y2 + pas[2];
1735 ....................
1736 .................... r = qas[0]*y2 + qas[1];
1737 .................... r = r*y2 + qas[2];
1738 ....................
1739 .................... res = y*res/r;
1740 ....................
1741 .................... if (n & 2) // |x| > 0.5
1742 .................... res = PI_DIV_BY_TWO - 2.0*res;
1743 .................... if (s)
1744 .................... res = -res;
1745 .................... if (n & 1) // take arccos
1746 .................... res = PI_DIV_BY_TWO - res;
1747 ....................
1748 .................... return(res);
1749 .................... }
1750 ....................
1751 .................... // Overloaded function ASIN_COS() for data type - Float64
1752 .................... float64 ASIN_COS(float64 x, unsigned int8 n)
1753 .................... {
1754 .................... float64 y, res, r, y2;
1755 .................... int1 s;
1756 .................... #ifdef _ERRNO
1757 .................... if(x <-1 || x > 1)
1758 .................... {
1759 .................... errno=EDOM;
1760 .................... }
1761 .................... #endif
1762 .................... s = 0;
1763 .................... y = x;
1764 ....................
1765 .................... if (x < 0)
1766 .................... {
1767 .................... s = 1;
1768 .................... y = -y;
1769 .................... }
1770 ....................
1771 .................... if (y > 0.5)
1772 .................... {
1773 .................... y = sqrt((1.0 - y)/2.0);
1774 .................... n += 2;
1775 .................... }
1776 ....................
1777 .................... y2=y*y;
1778 ....................
1779 .................... res = pas[0]*y2 + pas[1];
1780 .................... res = res*y2 + pas[2];
1781 ....................
1782 .................... r = qas[0]*y2 + qas[1];
1783 .................... r = r*y2 + qas[2];
1784 ....................
1785 .................... res = y*res/r;
1786 ....................
1787 .................... if (n & 2) // |x| > 0.5
1788 .................... res = PI_DIV_BY_TWO - 2.0*res;
1789 .................... if (s)
1790 .................... res = -res;
1791 .................... if (n & 1) // take arccos
1792 .................... res = PI_DIV_BY_TWO - res;
1793 ....................
1794 .................... return(res);
1795 .................... }
1796 .................... #endif
1797 ....................
1798 .................... ////////////////////////////////////////////////////////////////////////////
1799 .................... // float asin(float x)
1800 .................... ////////////////////////////////////////////////////////////////////////////
1801 .................... // Description : returns the arcsine value of the value x.
1802 .................... // Date : N/A
1803 .................... //
1804 .................... float32 asin(float32 x)
1805 .................... {
1806 .................... float32 r;
1807 ....................
1808 .................... r = ASIN_COS(x, 0);
1809 .................... return(r);
1810 .................... }
1811 .................... //Overloaded functions for asin() for PCD
1812 .................... // Overloaded function asin() for data type - Float48
1813 .................... #if defined(__PCD__)
1814 .................... float48 asin(float48 x)
1815 .................... {
1816 .................... float48 r;
1817 ....................
1818 .................... r = ASIN_COS(x, 0);
1819 .................... return(r);
1820 .................... }
1821 ....................
1822 .................... // Overloaded function asin() for data type - Float64
1823 .................... float64 asin(float64 x)
1824 .................... {
1825 .................... float64 r;
1826 ....................
1827 .................... r = ASIN_COS(x, 0);
1828 .................... return(r);
1829 .................... }
1830 .................... #endif
1831 ....................
1832 .................... ////////////////////////////////////////////////////////////////////////////
1833 .................... // float acos(float x)
1834 .................... ////////////////////////////////////////////////////////////////////////////
1835 .................... // Description : returns the arccosine value of the value x.
1836 .................... // Date : N/A
1837 .................... //
1838 .................... float32 acos(float32 x)
1839 .................... {
1840 .................... float32 r;
1841 ....................
1842 .................... r = ASIN_COS(x, 1);
1843 .................... return(r);
1844 .................... }
1845 .................... //Overloaded functions for acos() for PCD
1846 .................... // Overloaded function acos() for data type - Float48
1847 .................... #if defined(__PCD__)
1848 .................... float48 acos(float48 x)
1849 .................... {
1850 .................... float48 r;
1851 ....................
1852 .................... r = ASIN_COS(x, 1);
1853 .................... return(r);
1854 .................... }
1855 ....................
1856 .................... // Overloaded function acos() for data type - Float64
1857 .................... float64 acos(float64 x)
1858 .................... {
1859 .................... float64 r;
1860 ....................
1861 .................... r = ASIN_COS(x, 1);
1862 .................... return(r);
1863 .................... }
1864 .................... #endif
1865 ....................
1866 .................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457};
1867 .................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457};
1868 ....................
1869 .................... ////////////////////////////////////////////////////////////////////////////
1870 .................... // float atan(float x)
1871 .................... ////////////////////////////////////////////////////////////////////////////
1872 .................... // Description : returns the arctangent value of the value x.
1873 .................... // Date : N/A
1874 .................... //
1875 .................... float32 atan(float32 x)
1876 .................... {
1877 .................... float32 y, res, r;
1878 .................... int1 s, flag;
1879 ....................
1880 .................... s = 0;
1881 *
1882 10B8: BCF 76.0
1883 .................... flag = 0;
1884 10B9: BCF 76.1
1885 .................... y = x;
1886 10BA: MOVF 71,W
1887 10BB: MOVWF 75
1888 10BC: MOVF 70,W
1889 10BD: MOVWF 74
1890 10BE: MOVF 6F,W
1891 10BF: MOVWF 73
1892 10C0: MOVF 6E,W
1893 10C1: MOVWF 72
1894 ....................
1895 .................... if (x < 0)
1896 10C2: MOVF 71,W
1897 10C3: BSF 03.5
1898 10C4: MOVWF 28
1899 10C5: MOVF 70,W
1900 10C6: MOVWF 27
1901 10C7: BCF 03.5
1902 10C8: MOVF 6F,W
1903 10C9: BSF 03.5
1904 10CA: MOVWF 26
1905 10CB: BCF 03.5
1906 10CC: MOVF 6E,W
1907 10CD: BSF 03.5
1908 10CE: MOVWF 25
1909 10CF: CLRF 2C
1910 10D0: CLRF 2B
1911 10D1: CLRF 2A
1912 10D2: CLRF 29
1913 10D3: BCF 0A.4
1914 10D4: BSF 0A.3
1915 10D5: BCF 03.5
1916 10D6: CALL 5F1
1917 10D7: BSF 0A.4
1918 10D8: BCF 0A.3
1919 10D9: BTFSS 03.0
1920 10DA: GOTO 0DF
1921 .................... {
1922 .................... s = 1;
1923 10DB: BSF 76.0
1924 .................... y = -y;
1925 10DC: MOVF 73,W
1926 10DD: XORLW 80
1927 10DE: MOVWF 73
1928 .................... }
1929 ....................
1930 .................... if (y > 1.0)
1931 10DF: BSF 03.5
1932 10E0: CLRF 28
1933 10E1: CLRF 27
1934 10E2: CLRF 26
1935 10E3: MOVLW 7F
1936 10E4: MOVWF 25
1937 10E5: MOVF 75,W
1938 10E6: MOVWF 2C
1939 10E7: MOVF 74,W
1940 10E8: MOVWF 2B
1941 10E9: MOVF 73,W
1942 10EA: MOVWF 2A
1943 10EB: MOVF 72,W
1944 10EC: MOVWF 29
1945 10ED: BCF 0A.4
1946 10EE: BSF 0A.3
1947 10EF: BCF 03.5
1948 10F0: CALL 5F1
1949 10F1: BSF 0A.4
1950 10F2: BCF 0A.3
1951 10F3: BTFSS 03.0
1952 10F4: GOTO 116
1953 10F5: CLRF 27
1954 10F6: BTFSC 0B.7
1955 10F7: BSF 27.7
1956 10F8: BCF 0B.7
1957 .................... {
1958 .................... y = 1.0/y;
1959 10F9: BSF 03.5
1960 10FA: CLRF 45
1961 10FB: CLRF 44
1962 10FC: CLRF 43
1963 10FD: MOVLW 7F
1964 10FE: MOVWF 42
1965 10FF: MOVF 75,W
1966 1100: MOVWF 49
1967 1101: MOVF 74,W
1968 1102: MOVWF 48
1969 1103: MOVF 73,W
1970 1104: MOVWF 47
1971 1105: MOVF 72,W
1972 1106: MOVWF 46
1973 1107: BCF 0A.4
1974 1108: BCF 03.5
1975 1109: CALL 057
1976 110A: BSF 0A.4
1977 110B: BTFSC 27.7
1978 110C: BSF 0B.7
1979 110D: MOVF 7A,W
1980 110E: MOVWF 75
1981 110F: MOVF 79,W
1982 1110: MOVWF 74
1983 1111: MOVF 78,W
1984 1112: MOVWF 73
1985 1113: MOVF 77,W
1986 1114: MOVWF 72
1987 .................... flag = 1;
1988 1115: BSF 76.1
1989 .................... }
1990 ....................
1991 .................... res = pat[0]*y*y + pat[1];
1992 1116: MOVLW 0A
1993 1117: BSF 03.5
1994 1118: MOVWF 2C
1995 1119: MOVLW 89
1996 111A: MOVWF 2B
1997 111B: MOVLW 34
1998 111C: MOVWF 2A
1999 111D: MOVLW 7C
2000 111E: MOVWF 29
2001 111F: MOVF 75,W
2002 1120: MOVWF 30
2003 1121: MOVF 74,W
2004 1122: MOVWF 2F
2005 1123: MOVF 73,W
2006 1124: MOVWF 2E
2007 1125: MOVF 72,W
2008 1126: MOVWF 2D
2009 1127: BCF 0A.4
2010 1128: BCF 03.5
2011 1129: CALL 76E
2012 112A: BSF 0A.4
2013 112B: MOVF 77,W
2014 112C: BSF 03.5
2015 112D: MOVWF 24
2016 112E: MOVF 78,W
2017 112F: MOVWF 25
2018 1130: MOVF 79,W
2019 1131: MOVWF 26
2020 1132: MOVF 7A,W
2021 1133: MOVWF 27
2022 1134: MOVWF 2C
2023 1135: MOVF 26,W
2024 1136: MOVWF 2B
2025 1137: MOVF 25,W
2026 1138: MOVWF 2A
2027 1139: MOVF 24,W
2028 113A: MOVWF 29
2029 113B: MOVF 75,W
2030 113C: MOVWF 30
2031 113D: MOVF 74,W
2032 113E: MOVWF 2F
2033 113F: MOVF 73,W
2034 1140: MOVWF 2E
2035 1141: MOVF 72,W
2036 1142: MOVWF 2D
2037 1143: BCF 0A.4
2038 1144: BCF 03.5
2039 1145: CALL 76E
2040 1146: BSF 0A.4
2041 1147: MOVF 77,W
2042 1148: BSF 03.5
2043 1149: MOVWF 24
2044 114A: MOVF 78,W
2045 114B: MOVWF 25
2046 114C: MOVF 79,W
2047 114D: MOVWF 26
2048 114E: MOVF 7A,W
2049 114F: MOVWF 27
2050 1150: BCF 03.1
2051 1151: MOVF 27,W
2052 1152: MOVWF 2C
2053 1153: MOVF 26,W
2054 1154: MOVWF 2B
2055 1155: MOVF 25,W
2056 1156: MOVWF 2A
2057 1157: MOVF 24,W
2058 1158: MOVWF 29
2059 1159: MOVLW 7C
2060 115A: MOVWF 30
2061 115B: MOVLW 79
2062 115C: MOVWF 2F
2063 115D: MOVLW 35
2064 115E: MOVWF 2E
2065 115F: MOVLW 81
2066 1160: MOVWF 2D
2067 1161: BCF 0A.4
2068 1162: BSF 0A.3
2069 1163: BCF 03.5
2070 1164: CALL 000
2071 1165: BSF 0A.4
2072 1166: BCF 0A.3
2073 1167: MOVF 7A,W
2074 1168: MOVWF 7E
2075 1169: MOVF 79,W
2076 116A: MOVWF 7D
2077 116B: MOVF 78,W
2078 116C: MOVWF 7C
2079 116D: MOVF 77,W
2080 116E: MOVWF 7B
2081 .................... res = res*y*y + pat[2];
2082 116F: MOVF 7E,W
2083 1170: BSF 03.5
2084 1171: MOVWF 2C
2085 1172: MOVF 7D,W
2086 1173: MOVWF 2B
2087 1174: MOVF 7C,W
2088 1175: MOVWF 2A
2089 1176: MOVF 7B,W
2090 1177: MOVWF 29
2091 1178: MOVF 75,W
2092 1179: MOVWF 30
2093 117A: MOVF 74,W
2094 117B: MOVWF 2F
2095 117C: MOVF 73,W
2096 117D: MOVWF 2E
2097 117E: MOVF 72,W
2098 117F: MOVWF 2D
2099 1180: BCF 0A.4
2100 1181: BCF 03.5
2101 1182: CALL 76E
2102 1183: BSF 0A.4
2103 1184: MOVF 77,W
2104 1185: BSF 03.5
2105 1186: MOVWF 24
2106 1187: MOVF 78,W
2107 1188: MOVWF 25
2108 1189: MOVF 79,W
2109 118A: MOVWF 26
2110 118B: MOVF 7A,W
2111 118C: MOVWF 27
2112 118D: MOVWF 2C
2113 118E: MOVF 26,W
2114 118F: MOVWF 2B
2115 1190: MOVF 25,W
2116 1191: MOVWF 2A
2117 1192: MOVF 24,W
2118 1193: MOVWF 29
2119 1194: MOVF 75,W
2120 1195: MOVWF 30
2121 1196: MOVF 74,W
2122 1197: MOVWF 2F
2123 1198: MOVF 73,W
2124 1199: MOVWF 2E
2125 119A: MOVF 72,W
2126 119B: MOVWF 2D
2127 119C: BCF 0A.4
2128 119D: BCF 03.5
2129 119E: CALL 76E
2130 119F: BSF 0A.4
2131 11A0: MOVF 77,W
2132 11A1: BSF 03.5
2133 11A2: MOVWF 24
2134 11A3: MOVF 78,W
2135 11A4: MOVWF 25
2136 11A5: MOVF 79,W
2137 11A6: MOVWF 26
2138 11A7: MOVF 7A,W
2139 11A8: MOVWF 27
2140 11A9: BCF 03.1
2141 11AA: MOVF 27,W
2142 11AB: MOVWF 2C
2143 11AC: MOVF 26,W
2144 11AD: MOVWF 2B
2145 11AE: MOVF 25,W
2146 11AF: MOVWF 2A
2147 11B0: MOVF 24,W
2148 11B1: MOVWF 29
2149 11B2: MOVLW 3F
2150 11B3: MOVWF 30
2151 11B4: MOVLW 02
2152 11B5: MOVWF 2F
2153 11B6: MOVLW 33
2154 11B7: MOVWF 2E
2155 11B8: MOVLW 83
2156 11B9: MOVWF 2D
2157 11BA: BCF 0A.4
2158 11BB: BSF 0A.3
2159 11BC: BCF 03.5
2160 11BD: CALL 000
2161 11BE: BSF 0A.4
2162 11BF: BCF 0A.3
2163 11C0: MOVF 7A,W
2164 11C1: MOVWF 7E
2165 11C2: MOVF 79,W
2166 11C3: MOVWF 7D
2167 11C4: MOVF 78,W
2168 11C5: MOVWF 7C
2169 11C6: MOVF 77,W
2170 11C7: MOVWF 7B
2171 .................... res = res*y*y + pat[3];
2172 11C8: MOVF 7E,W
2173 11C9: BSF 03.5
2174 11CA: MOVWF 2C
2175 11CB: MOVF 7D,W
2176 11CC: MOVWF 2B
2177 11CD: MOVF 7C,W
2178 11CE: MOVWF 2A
2179 11CF: MOVF 7B,W
2180 11D0: MOVWF 29
2181 11D1: MOVF 75,W
2182 11D2: MOVWF 30
2183 11D3: MOVF 74,W
2184 11D4: MOVWF 2F
2185 11D5: MOVF 73,W
2186 11D6: MOVWF 2E
2187 11D7: MOVF 72,W
2188 11D8: MOVWF 2D
2189 11D9: BCF 0A.4
2190 11DA: BCF 03.5
2191 11DB: CALL 76E
2192 11DC: BSF 0A.4
2193 11DD: MOVF 77,W
2194 11DE: BSF 03.5
2195 11DF: MOVWF 24
2196 11E0: MOVF 78,W
2197 11E1: MOVWF 25
2198 11E2: MOVF 79,W
2199 11E3: MOVWF 26
2200 11E4: MOVF 7A,W
2201 11E5: MOVWF 27
2202 11E6: MOVWF 2C
2203 11E7: MOVF 26,W
2204 11E8: MOVWF 2B
2205 11E9: MOVF 25,W
2206 11EA: MOVWF 2A
2207 11EB: MOVF 24,W
2208 11EC: MOVWF 29
2209 11ED: MOVF 75,W
2210 11EE: MOVWF 30
2211 11EF: MOVF 74,W
2212 11F0: MOVWF 2F
2213 11F1: MOVF 73,W
2214 11F2: MOVWF 2E
2215 11F3: MOVF 72,W
2216 11F4: MOVWF 2D
2217 11F5: BCF 0A.4
2218 11F6: BCF 03.5
2219 11F7: CALL 76E
2220 11F8: BSF 0A.4
2221 11F9: MOVF 77,W
2222 11FA: BSF 03.5
2223 11FB: MOVWF 24
2224 11FC: MOVF 78,W
2225 11FD: MOVWF 25
2226 11FE: MOVF 79,W
2227 11FF: MOVWF 26
2228 1200: MOVF 7A,W
2229 1201: MOVWF 27
2230 1202: BCF 03.1
2231 1203: MOVF 27,W
2232 1204: MOVWF 2C
2233 1205: MOVF 26,W
2234 1206: MOVWF 2B
2235 1207: MOVF 25,W
2236 1208: MOVWF 2A
2237 1209: MOVF 24,W
2238 120A: MOVWF 29
2239 120B: MOVLW 33
2240 120C: MOVWF 30
2241 120D: MOVLW 8C
2242 120E: MOVWF 2F
2243 120F: MOVLW 1E
2244 1210: MOVWF 2E
2245 1211: MOVLW 83
2246 1212: MOVWF 2D
2247 1213: BCF 0A.4
2248 1214: BSF 0A.3
2249 1215: BCF 03.5
2250 1216: CALL 000
2251 1217: BSF 0A.4
2252 1218: BCF 0A.3
2253 1219: MOVF 7A,W
2254 121A: MOVWF 7E
2255 121B: MOVF 79,W
2256 121C: MOVWF 7D
2257 121D: MOVF 78,W
2258 121E: MOVWF 7C
2259 121F: MOVF 77,W
2260 1220: MOVWF 7B
2261 ....................
2262 .................... r = qat[0]*y*y + qat[1];
2263 1221: BSF 03.5
2264 1222: CLRF 2C
2265 1223: CLRF 2B
2266 1224: CLRF 2A
2267 1225: MOVLW 7F
2268 1226: MOVWF 29
2269 1227: MOVF 75,W
2270 1228: MOVWF 30
2271 1229: MOVF 74,W
2272 122A: MOVWF 2F
2273 122B: MOVF 73,W
2274 122C: MOVWF 2E
2275 122D: MOVF 72,W
2276 122E: MOVWF 2D
2277 122F: BCF 0A.4
2278 1230: BCF 03.5
2279 1231: CALL 76E
2280 1232: BSF 0A.4
2281 1233: MOVF 77,W
2282 1234: BSF 03.5
2283 1235: MOVWF 24
2284 1236: MOVF 78,W
2285 1237: MOVWF 25
2286 1238: MOVF 79,W
2287 1239: MOVWF 26
2288 123A: MOVF 7A,W
2289 123B: MOVWF 27
2290 123C: MOVWF 2C
2291 123D: MOVF 26,W
2292 123E: MOVWF 2B
2293 123F: MOVF 25,W
2294 1240: MOVWF 2A
2295 1241: MOVF 24,W
2296 1242: MOVWF 29
2297 1243: MOVF 75,W
2298 1244: MOVWF 30
2299 1245: MOVF 74,W
2300 1246: MOVWF 2F
2301 1247: MOVF 73,W
2302 1248: MOVWF 2E
2303 1249: MOVF 72,W
2304 124A: MOVWF 2D
2305 124B: BCF 0A.4
2306 124C: BCF 03.5
2307 124D: CALL 76E
2308 124E: BSF 0A.4
2309 124F: MOVF 77,W
2310 1250: BSF 03.5
2311 1251: MOVWF 24
2312 1252: MOVF 78,W
2313 1253: MOVWF 25
2314 1254: MOVF 79,W
2315 1255: MOVWF 26
2316 1256: MOVF 7A,W
2317 1257: MOVWF 27
2318 1258: BCF 03.1
2319 1259: MOVF 27,W
2320 125A: MOVWF 2C
2321 125B: MOVF 26,W
2322 125C: MOVWF 2B
2323 125D: MOVF 25,W
2324 125E: MOVWF 2A
2325 125F: MOVF 24,W
2326 1260: MOVWF 29
2327 1261: MOVLW 1B
2328 1262: MOVWF 30
2329 1263: MOVLW E4
2330 1264: MOVWF 2F
2331 1265: MOVLW 35
2332 1266: MOVWF 2E
2333 1267: MOVLW 82
2334 1268: MOVWF 2D
2335 1269: BCF 0A.4
2336 126A: BSF 0A.3
2337 126B: BCF 03.5
2338 126C: CALL 000
2339 126D: BSF 0A.4
2340 126E: BCF 0A.3
2341 126F: MOVF 7A,W
2342 1270: BSF 03.5
2343 1271: MOVWF 23
2344 1272: MOVF 79,W
2345 1273: MOVWF 22
2346 1274: MOVF 78,W
2347 1275: MOVWF 21
2348 1276: MOVF 77,W
2349 1277: MOVWF 20
2350 .................... r = r*y*y + qat[2];
2351 1278: MOVF 23,W
2352 1279: MOVWF 2C
2353 127A: MOVF 22,W
2354 127B: MOVWF 2B
2355 127C: MOVF 21,W
2356 127D: MOVWF 2A
2357 127E: MOVF 20,W
2358 127F: MOVWF 29
2359 1280: MOVF 75,W
2360 1281: MOVWF 30
2361 1282: MOVF 74,W
2362 1283: MOVWF 2F
2363 1284: MOVF 73,W
2364 1285: MOVWF 2E
2365 1286: MOVF 72,W
2366 1287: MOVWF 2D
2367 1288: BCF 0A.4
2368 1289: BCF 03.5
2369 128A: CALL 76E
2370 128B: BSF 0A.4
2371 128C: MOVF 77,W
2372 128D: BSF 03.5
2373 128E: MOVWF 24
2374 128F: MOVF 78,W
2375 1290: MOVWF 25
2376 1291: MOVF 79,W
2377 1292: MOVWF 26
2378 1293: MOVF 7A,W
2379 1294: MOVWF 27
2380 1295: MOVWF 2C
2381 1296: MOVF 26,W
2382 1297: MOVWF 2B
2383 1298: MOVF 25,W
2384 1299: MOVWF 2A
2385 129A: MOVF 24,W
2386 129B: MOVWF 29
2387 129C: MOVF 75,W
2388 129D: MOVWF 30
2389 129E: MOVF 74,W
2390 129F: MOVWF 2F
2391 12A0: MOVF 73,W
2392 12A1: MOVWF 2E
2393 12A2: MOVF 72,W
2394 12A3: MOVWF 2D
2395 12A4: BCF 0A.4
2396 12A5: BCF 03.5
2397 12A6: CALL 76E
2398 12A7: BSF 0A.4
2399 12A8: MOVF 77,W
2400 12A9: BSF 03.5
2401 12AA: MOVWF 24
2402 12AB: MOVF 78,W
2403 12AC: MOVWF 25
2404 12AD: MOVF 79,W
2405 12AE: MOVWF 26
2406 12AF: MOVF 7A,W
2407 12B0: MOVWF 27
2408 12B1: BCF 03.1
2409 12B2: MOVF 27,W
2410 12B3: MOVWF 2C
2411 12B4: MOVF 26,W
2412 12B5: MOVWF 2B
2413 12B6: MOVF 25,W
2414 12B7: MOVWF 2A
2415 12B8: MOVF 24,W
2416 12B9: MOVWF 29
2417 12BA: MOVLW A4
2418 12BB: MOVWF 30
2419 12BC: MOVLW DB
2420 12BD: MOVWF 2F
2421 12BE: MOVLW 67
2422 12BF: MOVWF 2E
2423 12C0: MOVLW 83
2424 12C1: MOVWF 2D
2425 12C2: BCF 0A.4
2426 12C3: BSF 0A.3
2427 12C4: BCF 03.5
2428 12C5: CALL 000
2429 12C6: BSF 0A.4
2430 12C7: BCF 0A.3
2431 12C8: MOVF 7A,W
2432 12C9: BSF 03.5
2433 12CA: MOVWF 23
2434 12CB: MOVF 79,W
2435 12CC: MOVWF 22
2436 12CD: MOVF 78,W
2437 12CE: MOVWF 21
2438 12CF: MOVF 77,W
2439 12D0: MOVWF 20
2440 .................... r = r*y*y + qat[3];
2441 12D1: MOVF 23,W
2442 12D2: MOVWF 2C
2443 12D3: MOVF 22,W
2444 12D4: MOVWF 2B
2445 12D5: MOVF 21,W
2446 12D6: MOVWF 2A
2447 12D7: MOVF 20,W
2448 12D8: MOVWF 29
2449 12D9: MOVF 75,W
2450 12DA: MOVWF 30
2451 12DB: MOVF 74,W
2452 12DC: MOVWF 2F
2453 12DD: MOVF 73,W
2454 12DE: MOVWF 2E
2455 12DF: MOVF 72,W
2456 12E0: MOVWF 2D
2457 12E1: BCF 0A.4
2458 12E2: BCF 03.5
2459 12E3: CALL 76E
2460 12E4: BSF 0A.4
2461 12E5: MOVF 77,W
2462 12E6: BSF 03.5
2463 12E7: MOVWF 24
2464 12E8: MOVF 78,W
2465 12E9: MOVWF 25
2466 12EA: MOVF 79,W
2467 12EB: MOVWF 26
2468 12EC: MOVF 7A,W
2469 12ED: MOVWF 27
2470 12EE: MOVWF 2C
2471 12EF: MOVF 26,W
2472 12F0: MOVWF 2B
2473 12F1: MOVF 25,W
2474 12F2: MOVWF 2A
2475 12F3: MOVF 24,W
2476 12F4: MOVWF 29
2477 12F5: MOVF 75,W
2478 12F6: MOVWF 30
2479 12F7: MOVF 74,W
2480 12F8: MOVWF 2F
2481 12F9: MOVF 73,W
2482 12FA: MOVWF 2E
2483 12FB: MOVF 72,W
2484 12FC: MOVWF 2D
2485 12FD: BCF 0A.4
2486 12FE: BCF 03.5
2487 12FF: CALL 76E
2488 1300: BSF 0A.4
2489 1301: MOVF 77,W
2490 1302: BSF 03.5
2491 1303: MOVWF 24
2492 1304: MOVF 78,W
2493 1305: MOVWF 25
2494 1306: MOVF 79,W
2495 1307: MOVWF 26
2496 1308: MOVF 7A,W
2497 1309: MOVWF 27
2498 130A: BCF 03.1
2499 130B: MOVF 27,W
2500 130C: MOVWF 2C
2501 130D: MOVF 26,W
2502 130E: MOVWF 2B
2503 130F: MOVF 25,W
2504 1310: MOVWF 2A
2505 1311: MOVF 24,W
2506 1312: MOVWF 29
2507 1313: MOVLW 33
2508 1314: MOVWF 30
2509 1315: MOVLW 8C
2510 1316: MOVWF 2F
2511 1317: MOVLW 1E
2512 1318: MOVWF 2E
2513 1319: MOVLW 83
2514 131A: MOVWF 2D
2515 131B: BCF 0A.4
2516 131C: BSF 0A.3
2517 131D: BCF 03.5
2518 131E: CALL 000
2519 131F: BSF 0A.4
2520 1320: BCF 0A.3
2521 1321: MOVF 7A,W
2522 1322: BSF 03.5
2523 1323: MOVWF 23
2524 1324: MOVF 79,W
2525 1325: MOVWF 22
2526 1326: MOVF 78,W
2527 1327: MOVWF 21
2528 1328: MOVF 77,W
2529 1329: MOVWF 20
2530 ....................
2531 .................... res = y*res/r;
2532 132A: MOVF 75,W
2533 132B: MOVWF 2C
2534 132C: MOVF 74,W
2535 132D: MOVWF 2B
2536 132E: MOVF 73,W
2537 132F: MOVWF 2A
2538 1330: MOVF 72,W
2539 1331: MOVWF 29
2540 1332: MOVF 7E,W
2541 1333: MOVWF 30
2542 1334: MOVF 7D,W
2543 1335: MOVWF 2F
2544 1336: MOVF 7C,W
2545 1337: MOVWF 2E
2546 1338: MOVF 7B,W
2547 1339: MOVWF 2D
2548 133A: BCF 0A.4
2549 133B: BCF 03.5
2550 133C: CALL 76E
2551 133D: BSF 0A.4
2552 133E: MOVF 77,W
2553 133F: BSF 03.5
2554 1340: MOVWF 24
2555 1341: MOVF 78,W
2556 1342: MOVWF 25
2557 1343: MOVF 79,W
2558 1344: MOVWF 26
2559 1345: MOVF 7A,W
2560 1346: MOVWF 27
2561 1347: BCF 03.5
2562 1348: CLRF 27
2563 1349: BTFSC 0B.7
2564 134A: BSF 27.7
2565 134B: BCF 0B.7
2566 134C: BSF 03.5
2567 134D: MOVF 27,W
2568 134E: MOVWF 45
2569 134F: MOVF 26,W
2570 1350: MOVWF 44
2571 1351: MOVF 25,W
2572 1352: MOVWF 43
2573 1353: MOVF 24,W
2574 1354: MOVWF 42
2575 1355: MOVF 23,W
2576 1356: MOVWF 49
2577 1357: MOVF 22,W
2578 1358: MOVWF 48
2579 1359: MOVF 21,W
2580 135A: MOVWF 47
2581 135B: MOVF 20,W
2582 135C: MOVWF 46
2583 135D: BCF 0A.4
2584 135E: BCF 03.5
2585 135F: CALL 057
2586 1360: BSF 0A.4
2587 1361: BTFSC 27.7
2588 1362: BSF 0B.7
2589 1363: MOVF 7A,W
2590 1364: MOVWF 7E
2591 1365: MOVF 79,W
2592 1366: MOVWF 7D
2593 1367: MOVF 78,W
2594 1368: MOVWF 7C
2595 1369: MOVF 77,W
2596 136A: MOVWF 7B
2597 ....................
2598 ....................
2599 .................... if (flag) // for |x| > 1
2600 136B: BTFSS 76.1
2601 136C: GOTO 38D
2602 .................... res = PI_DIV_BY_TWO - res;
2603 136D: BSF 03.1
2604 136E: MOVLW DB
2605 136F: BSF 03.5
2606 1370: MOVWF 2C
2607 1371: MOVLW 0F
2608 1372: MOVWF 2B
2609 1373: MOVLW 49
2610 1374: MOVWF 2A
2611 1375: MOVLW 7F
2612 1376: MOVWF 29
2613 1377: MOVF 7E,W
2614 1378: MOVWF 30
2615 1379: MOVF 7D,W
2616 137A: MOVWF 2F
2617 137B: MOVF 7C,W
2618 137C: MOVWF 2E
2619 137D: MOVF 7B,W
2620 137E: MOVWF 2D
2621 137F: BCF 0A.4
2622 1380: BSF 0A.3
2623 1381: BCF 03.5
2624 1382: CALL 000
2625 1383: BSF 0A.4
2626 1384: BCF 0A.3
2627 1385: MOVF 7A,W
2628 1386: MOVWF 7E
2629 1387: MOVF 79,W
2630 1388: MOVWF 7D
2631 1389: MOVF 78,W
2632 138A: MOVWF 7C
2633 138B: MOVF 77,W
2634 138C: MOVWF 7B
2635 .................... if (s)
2636 138D: BTFSS 76.0
2637 138E: GOTO 392
2638 .................... res = -res;
2639 138F: MOVF 7C,W
2640 1390: XORLW 80
2641 1391: MOVWF 7C
2642 ....................
2643 .................... return(res);
2644 1392: MOVF 7B,W
2645 1393: MOVWF 77
2646 1394: MOVF 7C,W
2647 1395: MOVWF 78
2648 1396: MOVF 7D,W
2649 1397: MOVWF 79
2650 1398: MOVF 7E,W
2651 1399: MOVWF 7A
2652 .................... }
2653 .................... //Overloaded functions for atan() for PCD
2654 .................... // Overloaded function atan() for data type - Float48
2655 .................... #if defined(__PCD__)
2656 .................... float48 atan(float48 x)
2657 .................... {
2658 .................... float48 y, res, r;
2659 .................... int1 s, flag;
2660 ....................
2661 .................... s = 0;
2662 .................... flag = 0;
2663 .................... y = x;
2664 ....................
2665 .................... if (x < 0)
2666 .................... {
2667 .................... s = 1;
2668 .................... y = -y;
2669 .................... }
2670 ....................
2671 .................... if (y > 1.0)
2672 .................... {
2673 .................... y = 1.0/y;
2674 .................... flag = 1;
2675 .................... }
2676 ....................
2677 .................... res = pat[0]*y*y + pat[1];
2678 .................... res = res*y*y + pat[2];
2679 .................... res = res*y*y + pat[3];
2680 ....................
2681 .................... r = qat[0]*y*y + qat[1];
2682 .................... r = r*y*y + qat[2];
2683 .................... r = r*y*y + qat[3];
2684 ....................
2685 .................... res = y*res/r;
2686 ....................
2687 ....................
2688 .................... if (flag) // for |x| > 1
2689 .................... res = PI_DIV_BY_TWO - res;
2690 .................... if (s)
2691 .................... res = -res;
2692 ....................
2693 .................... return(res);
2694 .................... }
2695 ....................
2696 .................... // Overloaded function atan() for data type - Float64
2697 .................... float64 atan(float64 x)
2698 .................... {
2699 .................... float64 y, res, r;
2700 .................... int1 s, flag;
2701 ....................
2702 .................... s = 0;
2703 .................... flag = 0;
2704 .................... y = x;
2705 ....................
2706 .................... if (x < 0)
2707 .................... {
2708 .................... s = 1;
2709 .................... y = -y;
2710 .................... }
2711 ....................
2712 .................... if (y > 1.0)
2713 .................... {
2714 .................... y = 1.0/y;
2715 .................... flag = 1;
2716 .................... }
2717 ....................
2718 .................... res = pat[0]*y*y + pat[1];
2719 .................... res = res*y*y + pat[2];
2720 .................... res = res*y*y + pat[3];
2721 ....................
2722 .................... r = qat[0]*y*y + qat[1];
2723 .................... r = r*y*y + qat[2];
2724 .................... r = r*y*y + qat[3];
2725 ....................
2726 .................... res = y*res/r;
2727 ....................
2728 ....................
2729 .................... if (flag) // for |x| > 1
2730 .................... res = PI_DIV_BY_TWO - res;
2731 .................... if (s)
2732 .................... res = -res;
2733 ....................
2734 .................... return(res);
2735 .................... }
2736 .................... #endif
2737 ....................
2738 .................... /////////////////////////////////////////////////////////////////////////////
2739 .................... // float atan2(float y, float x)
2740 .................... /////////////////////////////////////////////////////////////////////////////
2741 .................... // Description :computes the principal value of arc tangent of y/x, using the
2742 .................... // signs of both the arguments to determine the quadrant of the return value
2743 .................... // Returns : returns the arc tangent of y/x.
2744 .................... // Date : N/A
2745 .................... //
2746 ....................
2747 .................... float32 atan2(float32 y,float32 x)
2748 .................... {
2749 .................... float32 z;
2750 .................... int1 sign;
2751 .................... unsigned int8 quad;
2752 .................... sign=0;
2753 .................... quad=0; //quadrant
2754 .................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
2755 .................... if(y<0.0)
2756 .................... {
2757 .................... sign=1;
2758 .................... y=-y;
2759 .................... }
2760 .................... if(x<0.0)
2761 .................... {
2762 .................... x=-x;
2763 .................... }
2764 .................... if (x==0.0)
2765 .................... {
2766 .................... if(y==0.0)
2767 .................... {
2768 .................... #ifdef _ERRNO
2769 .................... {
2770 .................... errno=EDOM;
2771 .................... }
2772 .................... #endif
2773 .................... }
2774 .................... else
2775 .................... {
2776 .................... if(sign)
2777 .................... {
2778 .................... return (-(PI_DIV_BY_TWO));
2779 .................... }
2780 .................... else
2781 .................... {
2782 .................... return (PI_DIV_BY_TWO);
2783 .................... }
2784 .................... }
2785 .................... }
2786 .................... else
2787 .................... {
2788 .................... z=y/x;
2789 .................... switch(quad)
2790 .................... {
2791 .................... case 1:
2792 .................... {
2793 .................... return atan(z);
2794 .................... break;
2795 .................... }
2796 .................... case 2:
2797 .................... {
2798 .................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
2799 .................... return (PI-atan(z));
2800 .................... break;
2801 .................... }
2802 .................... case 3:
2803 .................... {
2804 .................... return (atan(z)-PI);
2805 .................... break;
2806 .................... }
2807 .................... case 4:
2808 .................... {
2809 .................... return (-atan(z));
2810 .................... break;
2811 .................... }
2812 .................... }
2813 .................... }
2814 .................... }
2815 ....................
2816 .................... //Overloaded functions for atan2() for PCD
2817 .................... // Overloaded function atan2() for data type - Float48
2818 .................... #if defined(__PCD__)
2819 .................... float48 atan2(float48 y,float48 x)
2820 .................... {
2821 .................... float48 z;
2822 .................... int1 sign;
2823 .................... unsigned int8 quad;
2824 .................... sign=0;
2825 .................... quad=0; //quadrant
2826 .................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
2827 .................... if(y<0.0)
2828 .................... {
2829 .................... sign=1;
2830 .................... y=-y;
2831 .................... }
2832 .................... if(x<0.0)
2833 .................... {
2834 .................... x=-x;
2835 .................... }
2836 .................... if (x==0.0)
2837 .................... {
2838 .................... if(y==0.0)
2839 .................... {
2840 .................... #ifdef _ERRNO
2841 .................... {
2842 .................... errno=EDOM;
2843 .................... }
2844 .................... #endif
2845 .................... }
2846 .................... else
2847 .................... {
2848 .................... if(sign)
2849 .................... {
2850 .................... return (-(PI_DIV_BY_TWO));
2851 .................... }
2852 .................... else
2853 .................... {
2854 .................... return (PI_DIV_BY_TWO);
2855 .................... }
2856 .................... }
2857 .................... }
2858 .................... else
2859 .................... {
2860 .................... z=y/x;
2861 .................... switch(quad)
2862 .................... {
2863 .................... case 1:
2864 .................... {
2865 .................... return atan(z);
2866 .................... break;
2867 .................... }
2868 .................... case 2:
2869 .................... {
2870 .................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
2871 .................... return (PI-atan(z));
2872 .................... break;
2873 .................... }
2874 .................... case 3:
2875 .................... {
2876 .................... return (atan(z)-PI);
2877 .................... break;
2878 .................... }
2879 .................... case 4:
2880 .................... {
2881 .................... return (-atan(z));
2882 .................... break;
2883 .................... }
2884 .................... }
2885 .................... }
2886 .................... }
2887 ....................
2888 .................... // Overloaded function atan2() for data type - Float64
2889 .................... float64 atan2(float64 y,float64 x)
2890 .................... {
2891 .................... float64 z;
2892 .................... int1 sign;
2893 .................... unsigned int8 quad;
2894 .................... sign=0;
2895 .................... quad=0; //quadrant
2896 .................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
2897 .................... if(y<0.0)
2898 .................... {
2899 .................... sign=1;
2900 .................... y=-y;
2901 .................... }
2902 .................... if(x<0.0)
2903 .................... {
2904 .................... x=-x;
2905 .................... }
2906 .................... if (x==0.0)
2907 .................... {
2908 .................... if(y==0.0)
2909 .................... {
2910 .................... #ifdef _ERRNO
2911 .................... {
2912 .................... errno=EDOM;
2913 .................... }
2914 .................... #endif
2915 .................... }
2916 .................... else
2917 .................... {
2918 .................... if(sign)
2919 .................... {
2920 .................... return (-(PI_DIV_BY_TWO));
2921 .................... }
2922 .................... else
2923 .................... {
2924 .................... return (PI_DIV_BY_TWO);
2925 .................... }
2926 .................... }
2927 .................... }
2928 .................... else
2929 .................... {
2930 .................... z=y/x;
2931 .................... switch(quad)
2932 .................... {
2933 .................... case 1:
2934 .................... {
2935 .................... return atan(z);
2936 .................... break;
2937 .................... }
2938 .................... case 2:
2939 .................... {
2940 .................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
2941 .................... return (PI-atan(z));
2942 .................... break;
2943 .................... }
2944 .................... case 3:
2945 .................... {
2946 .................... return (atan(z)-PI);
2947 .................... break;
2948 .................... }
2949 .................... case 4:
2950 .................... {
2951 .................... return (-atan(z));
2952 .................... break;
2953 .................... }
2954 .................... }
2955 .................... }
2956 .................... }
2957 .................... #endif
2958 ....................
2959 .................... //////////////////// Hyperbolic functions ////////////////////
2960 ....................
2961 .................... ////////////////////////////////////////////////////////////////////////////
2962 .................... // float cosh(float x)
2963 .................... ////////////////////////////////////////////////////////////////////////////
2964 .................... // Description : Computes the hyperbolic cosine value of x
2965 .................... // Returns : returns the hyperbolic cosine value of x
2966 .................... // Date : N/A
2967 .................... //
2968 ....................
2969 .................... float32 cosh(float32 x)
2970 .................... {
2971 .................... return ((exp(x)+exp(-x))/2);
2972 .................... }
2973 .................... //Overloaded functions for cosh() for PCD
2974 .................... // Overloaded function cosh() for data type - Float48
2975 .................... #if defined(__PCD__)
2976 .................... float48 cosh(float48 x)
2977 .................... {
2978 .................... return ((exp(x)+exp(-x))/2);
2979 .................... }
2980 ....................
2981 .................... // Overloaded function cosh() for data type - Float64
2982 .................... float64 cosh(float64 x)
2983 .................... {
2984 .................... return ((exp(x)+exp(-x))/2);
2985 .................... }
2986 .................... #endif
2987 ....................
2988 .................... ////////////////////////////////////////////////////////////////////////////
2989 .................... // float sinh(float x)
2990 .................... ////////////////////////////////////////////////////////////////////////////
2991 .................... // Description : Computes the hyperbolic sine value of x
2992 .................... // Returns : returns the hyperbolic sine value of x
2993 .................... // Date : N/A
2994 .................... //
2995 ....................
2996 .................... float32 sinh(float32 x)
2997 .................... {
2998 ....................
2999 .................... return ((exp(x) - exp(-x))/2);
3000 .................... }
3001 .................... //Overloaded functions for sinh() for PCD
3002 .................... // Overloaded function sinh() for data type - Float48
3003 .................... #if defined(__PCD__)
3004 .................... float48 sinh(float48 x)
3005 .................... {
3006 ....................
3007 .................... return ((exp(x) - exp(-x))/2);
3008 .................... }
3009 ....................
3010 .................... // Overloaded function sinh() for data type - Float48
3011 .................... float64 sinh(float64 x)
3012 .................... {
3013 ....................
3014 .................... return ((exp(x) - exp(-x))/2);
3015 .................... }
3016 .................... #endif
3017 ....................
3018 .................... ////////////////////////////////////////////////////////////////////////////
3019 .................... // float tanh(float x)
3020 .................... ////////////////////////////////////////////////////////////////////////////
3021 .................... // Description : Computes the hyperbolic tangent value of x
3022 .................... // Returns : returns the hyperbolic tangent value of x
3023 .................... // Date : N/A
3024 .................... //
3025 ....................
3026 .................... float32 tanh(float32 x)
3027 .................... {
3028 .................... return(sinh(x)/cosh(x));
3029 .................... }
3030 .................... //Overloaded functions for tanh() for PCD
3031 .................... // Overloaded function tanh() for data type - Float48
3032 .................... #if defined(__PCD__)
3033 .................... float48 tanh(float48 x)
3034 .................... {
3035 .................... return(sinh(x)/cosh(x));
3036 .................... }
3037 ....................
3038 .................... // Overloaded function tanh() for data type - Float64
3039 .................... float64 tanh(float64 x)
3040 .................... {
3041 .................... return(sinh(x)/cosh(x));
3042 .................... }
3043 .................... #endif
3044 ....................
3045 .................... ////////////////////////////////////////////////////////////////////////////
3046 .................... // float frexp(float x, signed int *exp)
3047 .................... ////////////////////////////////////////////////////////////////////////////
3048 .................... // Description : breaks a floating point number into a normalized fraction and an integral
3049 .................... // power of 2. It stores the integer in the signed int object pointed to by exp.
3050 .................... // Returns : returns the value x, such that x is a double with magnitude in the interval
3051 .................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero,
3052 .................... // both parts of the result are zero.
3053 .................... // Date : N/A
3054 .................... //
3055 ....................
3056 .................... #define LOG2 .30102999566398119521
3057 .................... float32 frexp(float32 x, signed int8 *exp)
3058 .................... {
3059 .................... float32 res;
3060 .................... int1 sign = 0;
3061 .................... if(x == 0.0)
3062 .................... {
3063 .................... *exp=0;
3064 .................... return (0.0);
3065 .................... }
3066 .................... if(x < 0.0)
3067 .................... {
3068 .................... x=-x;
3069 .................... sign=1;
3070 .................... }
3071 .................... if (x > 1.0)
3072 .................... {
3073 .................... *exp=(ceil(log10(x)/LOG2));
3074 .................... res=x/(pow(2, *exp));
3075 .................... if (res == 1)
3076 .................... {
3077 .................... *exp=*exp+1;
3078 .................... res=.5;
3079 .................... }
3080 .................... }
3081 .................... else
3082 .................... {
3083 .................... if(x < 0.5)
3084 .................... {
3085 .................... *exp=-1;
3086 .................... res=x*2;
3087 .................... }
3088 .................... else
3089 .................... {
3090 .................... *exp=0;
3091 .................... res=x;
3092 .................... }
3093 .................... }
3094 .................... if(sign)
3095 .................... {
3096 .................... res=-res;
3097 .................... }
3098 .................... return res;
3099 .................... }
3100 ....................
3101 .................... //Overloaded functions for frexp() for PCD
3102 .................... // Overloaded function frexp() for data type - Float48
3103 .................... #if defined(__PCD__)
3104 .................... float48 frexp(float48 x, signed int8 *exp)
3105 .................... {
3106 .................... float48 res;
3107 .................... int1 sign = 0;
3108 .................... if(x == 0.0)
3109 .................... {
3110 .................... *exp=0;
3111 .................... return (0.0);
3112 .................... }
3113 .................... if(x < 0.0)
3114 .................... {
3115 .................... x=-x;
3116 .................... sign=1;
3117 .................... }
3118 .................... if (x > 1.0)
3119 .................... {
3120 .................... *exp=(ceil(log10(x)/LOG2));
3121 .................... res=x/(pow(2, *exp));
3122 .................... if (res == 1)
3123 .................... {
3124 .................... *exp=*exp+1;
3125 .................... res=.5;
3126 .................... }
3127 .................... }
3128 .................... else
3129 .................... {
3130 .................... if(x < 0.5)
3131 .................... {
3132 .................... *exp=-1;
3133 .................... res=x*2;
3134 .................... }
3135 .................... else
3136 .................... {
3137 .................... *exp=0;
3138 .................... res=x;
3139 .................... }
3140 .................... }
3141 .................... if(sign)
3142 .................... {
3143 .................... res=-res;
3144 .................... }
3145 .................... return res;
3146 .................... }
3147 ....................
3148 .................... // Overloaded function frexp() for data type - Float64
3149 .................... float64 frexp(float64 x, signed int8 *exp)
3150 .................... {
3151 .................... float64 res;
3152 .................... int1 sign = 0;
3153 .................... if(x == 0.0)
3154 .................... {
3155 .................... *exp=0;
3156 .................... return (0.0);
3157 .................... }
3158 .................... if(x < 0.0)
3159 .................... {
3160 .................... x=-x;
3161 .................... sign=1;
3162 .................... }
3163 .................... if (x > 1.0)
3164 .................... {
3165 .................... *exp=(ceil(log10(x)/LOG2));
3166 .................... res=x/(pow(2, *exp));
3167 .................... if (res == 1)
3168 .................... {
3169 .................... *exp=*exp+1;
3170 .................... res=.5;
3171 .................... }
3172 .................... }
3173 .................... else
3174 .................... {
3175 .................... if(x < 0.5)
3176 .................... {
3177 .................... *exp=-1;
3178 .................... res=x*2;
3179 .................... }
3180 .................... else
3181 .................... {
3182 .................... *exp=0;
3183 .................... res=x;
3184 .................... }
3185 .................... }
3186 .................... if(sign)
3187 .................... {
3188 .................... res=-res;
3189 .................... }
3190 .................... return res;
3191 .................... }
3192 .................... #endif
3193 ....................
3194 .................... //////////////////////////////////////////////////////////////////////////////
3195 .................... // float ldexp(float x, signed int *exp)
3196 .................... //////////////////////////////////////////////////////////////////////////////
3197 .................... // Description : multiplies a floating point number by an integral power of 2.
3198 .................... // Returns : returns the value of x times 2 raised to the power exp.
3199 .................... // Date : N/A
3200 .................... //
3201 ....................
3202 .................... float32 ldexp(float32 value, signed int8 exp)
3203 .................... {
3204 .................... return (value * pow(2,exp));
3205 .................... }
3206 .................... //Overloaded functions for ldexp() for PCD
3207 .................... // Overloaded function ldexp() for data type - Float48
3208 ....................
3209 .................... #if defined(__PCD__)
3210 .................... float48 ldexp(float48 value, signed int8 exp)
3211 .................... {
3212 .................... return (value * pow(2,exp));
3213 .................... }
3214 .................... // Overloaded function ldexp() for data type - Float64
3215 .................... float64 ldexp(float64 value, signed int8 exp)
3216 .................... {
3217 .................... return (value * pow(2,exp));
3218 .................... }
3219 .................... #endif
3220 ....................
3221 .................... #endif
3222 ....................
3223 .................... #include <string.h>
3224 .................... ////////////////////////////////////////////////////////////////////////////
3225 .................... //// (C) Copyright 1996,2008 Custom Computer Services ////
3226 .................... //// This source code may only be used by licensed users of the CCS C ////
3227 .................... //// compiler. This source code may only be distributed to other ////
3228 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
3229 .................... //// or distribution is permitted without written permission. ////
3230 .................... //// Derivative programs created using this software in object code ////
3231 .................... //// form are not restricted in any way. ////
3232 .................... ////////////////////////////////////////////////////////////////////////////
3233 ....................
3234 .................... #ifndef _STRING
3235 .................... #define _STRING
3236 .................... #include <stddef.h>
3237 .................... ///////////////////////////////////////////////////////////////////////////
3238 .................... //// (C) Copyright 1996,2003 Custom Computer Services ////
3239 .................... //// This source code may only be used by licensed users of the CCS C ////
3240 .................... //// compiler. This source code may only be distributed to other ////
3241 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
3242 .................... //// or distribution is permitted without written permission. ////
3243 .................... //// Derivative programs created using this software in object code ////
3244 .................... //// form are not restricted in any way. ////
3245 .................... ///////////////////////////////////////////////////////////////////////////
3246 ....................
3247 .................... #ifndef _STDDEF
3248 ....................
3249 .................... #define _STDDEF
3250 ....................
3251 .................... #if sizeof(unsigned int8 *)==1
3252 .................... #define ptrdiff_t unsigned int8
3253 .................... #else
3254 .................... #define ptrdiff_t unsigned int16
3255 .................... #endif
3256 ....................
3257 .................... #define size_t unsigned int8
3258 .................... #define wchar_t char
3259 .................... #define NULL 0
3260 ....................
3261 .................... #define offsetof(s,f) (offsetofbit(s,f)/8)
3262 ....................
3263 .................... #endif
3264 ....................
3265 .................... #include <ctype.h>
3266 .................... ////////////////////////////////////////////////////////////////////////////
3267 .................... //// (C) Copyright 1996,2003 Custom Computer Services ////
3268 .................... //// This source code may only be used by licensed users of the CCS C ////
3269 .................... //// compiler. This source code may only be distributed to other ////
3270 .................... //// licensed users of the CCS C compiler. No other use, reproduction ////
3271 .................... //// or distribution is permitted without written permission. ////
3272 .................... //// Derivative programs created using this software in object code ////
3273 .................... //// form are not restricted in any way. ////
3274 .................... ////////////////////////////////////////////////////////////////////////////
3275 ....................
3276 .................... #ifndef _CTYPE
3277 .................... #define _CTYPE
3278 ....................
3279 .................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
3280 .................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
3281 .................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
3282 .................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
3283 .................... #define isdigit(x) isamong(x,"0123456789")
3284 .................... #define isspace(x) ((x)==' ')
3285 .................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
3286 .................... #define iscntrl(x) ((x)<' ')
3287 .................... #define isprint(x) ((x)>=' ')
3288 .................... #define isgraph(x) ((x)>' ')
3289 .................... #define ispunct(x) (((x)>' ')&&!isalnum(x))
3290 ....................
3291 .................... #endif
3292 ....................
3293 ....................
3294 ....................
3295 ....................
3296 ....................
3297 .................... //////////////////////////////////////////////
3298 .................... //// Uncomment the following define to ////
3299 .................... //// allow some functions to use a ////
3300 .................... //// quicker algorithm, but use more ROM ////
3301 .................... //// ////
3302 .................... //// #define FASTER_BUT_MORE_ROM ////
3303 .................... //////////////////////////////////////////////
3304 ....................
3305 ....................
3306 ....................
3307 .................... /*Copying functions*/
3308 .................... /* standard template:
3309 .................... void *memmove(void *s1, void *s2, size_t n).
3310 .................... Copies max of n characters safely (not following ending '\0')
3311 .................... from s2 in s1; if s2 has less than n characters, appends 0 */
3312 ....................
3313 .................... char *memmove(void *s1,char *s2,size_t n)
3314 .................... {
3315 .................... char *sc1;
3316 .................... char *sc2;
3317 .................... sc1=s1;
3318 .................... sc2=s2;
3319 .................... if(sc2<sc1 && sc1 <sc2 +n)
3320 .................... for(sc1+=n,sc2+=n;0<n;--n)
3321 .................... *--sc1=*--sc2;
3322 .................... else
3323 .................... for(;0<n;--n)
3324 .................... *sc1++=*sc2++;
3325 .................... return s1;
3326 .................... }
3327 ....................
3328 .................... /* Standard template: char *strcpy(char *s1, const char *s2)
3329 .................... copies the string s2 including the null character to s1.
3330 .................... This is a compiler built in to handle the different address
3331 .................... spaces */
3332 ....................
3333 .................... #define strcopy strcpy
3334 ....................
3335 .................... /* standard template:
3336 .................... char *strncpy(char *s1, const char *s2, size_t n).
3337 .................... Copies max of n characters (not following ending '\0')
3338 .................... from s2 in s1; if s2 has less than n characters, appends 0 */
3339 ....................
3340 .................... char *strncpy(char *s1, char *s2, size_t n)
3341 .................... {
3342 .................... char *s;
3343 ....................
3344 .................... for (s = s1; n > 0 && *s2 != '\0'; n--)
3345 .................... *s++ = *s2++;
3346 .................... for (; n > 0; n--)
3347 .................... *s++ = '\0';
3348 ....................
3349 .................... return(s1);
3350 .................... }
3351 .................... /***********************************************************/
3352 ....................
3353 .................... /*concatenation functions*/
3354 .................... /* standard template: char *strcat(char *s1, const char *s2)
3355 .................... appends s2 to s1*/
3356 ....................
3357 .................... char *strcat(char *s1, char *s2)
3358 .................... {
3359 .................... char *s;
3360 ....................
3361 .................... for (s = s1; *s != '\0'; ++s);
3362 .................... while(*s2 != '\0')
3363 .................... {
3364 .................... *s = *s2;
3365 .................... ++s;
3366 .................... ++s2;
3367 .................... }
3368 ....................
3369 .................... *s = '\0';
3370 .................... return(s1);
3371 .................... }
3372 .................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
3373 .................... appends not more than n characters from s2 to s1*/
3374 ....................
3375 .................... char *strncat(char *s1, char *s2, size_t n)
3376 .................... {
3377 .................... char *s;
3378 ....................
3379 .................... for (s = s1; *s != '\0'; ++s);
3380 .................... while(*s2 != '\0' && 0<n)
3381 .................... {
3382 .................... *s = *s2;
3383 .................... ++s;
3384 .................... ++s2;
3385 .................... --n;
3386 .................... }
3387 ....................
3388 .................... *s = '\0';
3389 .................... return(s1);
3390 .................... }
3391 ....................
3392 .................... /***********************************************************/
3393 ....................
3394 ....................
3395 .................... /*comparison functions*/
3396 .................... /* standard template: signed int memcmp(void *s1, void *s2).
3397 .................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
3398 ....................
3399 .................... signed int8 memcmp(void * s1,char *s2,size_t n)
3400 .................... {
3401 .................... char *su1, *su2;
3402 .................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
3403 .................... {
3404 .................... if(*su1!=*su2)
3405 .................... return ((*su1<*su2)?-1:+1);
3406 .................... }
3407 .................... return 0;
3408 .................... }
3409 ....................
3410 .................... /* standard template: int strcmp(const char *s1, const char *s2).
3411 .................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
3412 ....................
3413 .................... signed int8 strcmp(char *s1, char *s2)
3414 .................... {
3415 .................... for (; *s1 == *s2; s1++, s2++)
3416 .................... if (*s1 == '\0')
3417 .................... return(0);
3418 .................... return((*s1 < *s2) ? -1: 1);
3419 .................... }
3420 .................... /* standard template: int strcoll(const char *s1, const char *s2).
3421 .................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
3422 ....................
3423 .................... signed int8 strcoll(char *s1, char *s2)
3424 .................... {
3425 .................... for (; *s1 == *s2; s1++, s2++)
3426 .................... if (*s1 == '\0')
3427 .................... return(0);
3428 .................... return((*s1 < *s2) ? -1: 1);
3429 .................... }
3430 ....................
3431 .................... /* standard template:
3432 .................... int strncmp(const char *s1, const char *s2, size_t n).
3433 .................... Compares max of n characters (not following 0) from s1 to s2;
3434 .................... returns same as strcmp */
3435 ....................
3436 .................... signed int8 strncmp(char *s1, char *s2, size_t n)
3437 .................... {
3438 .................... for (; n > 0; s1++, s2++, n--)
3439 .................... if (*s1 != *s2)
3440 .................... return((*s1 <*s2) ? -1: 1);
3441 .................... else if (*s1 == '\0')
3442 .................... return(0);
3443 .................... return(0);
3444 .................... }
3445 .................... /* standard template:
3446 .................... int strxfrm(const char *s1, const char *s2, size_t n).
3447 .................... transforms maximum of n characters from s2 and places them into s1*/
3448 .................... size_t strxfrm(char *s1, char *s2, size_t n)
3449 .................... {
3450 .................... char *s;
3451 .................... unsigned int8 n1;
3452 .................... n1=n;
3453 .................... for (s = s1; n > 0 && *s2 != '\0'; n--)
3454 .................... *s++ = *s2++;
3455 .................... for (; n > 0; n--)
3456 .................... *s++ = '\0';
3457 ....................
3458 .................... return(n1);
3459 .................... }
3460 ....................
3461 ....................
3462 ....................
3463 ....................
3464 ....................
3465 .................... /***********************************************************/
3466 .................... /*Search functions*/
3467 .................... /* standard template: void *memchr(const char *s, int c).
3468 .................... Finds first occurrence of c in n characters of s */
3469 ....................
3470 .................... char *memchr(void *s,unsigned int8 c,size_t n)
3471 .................... {
3472 .................... char uc;
3473 .................... char *su;
3474 .................... uc=c;
3475 .................... for(su=s;0<n;++su,--n)
3476 .................... if(*su==uc)
3477 .................... return su;
3478 .................... return NULL;
3479 .................... }
3480 ....................
3481 .................... /* standard template: char *strchr(const char *s, int c).
3482 .................... Finds first occurrence of c in s */
3483 ....................
3484 .................... char *strchr(char *s, unsigned int8 c)
3485 .................... {
3486 .................... for (; *s != c; s++)
3487 .................... if (*s == '\0')
3488 .................... return(0);
3489 .................... return(s);
3490 .................... }
3491 .................... /* standard template:
3492 .................... size_t strcspn(const char *s1, const char *s2).
3493 .................... Computes length of max initial segment of s1 that
3494 .................... consists entirely of characters NOT from s2*/
3495 ....................
3496 .................... unsigned int8 strcspn(char *s1, char *s2)
3497 .................... {
3498 .................... char *sc1, *sc2;
3499 ....................
3500 .................... for (sc1 = s1; *sc1 != 0; sc1++)
3501 .................... for (sc2 = s2; *sc2 != 0; sc2++)
3502 .................... if (*sc1 == *sc2)
3503 .................... return(sc1 - s1);
3504 .................... return(sc1 - s1);
3505 .................... }
3506 .................... /* standard template:
3507 .................... char *strpbrk(const char *s1, const char *s2).
3508 .................... Locates first occurence of any character from s2 in s1;
3509 .................... returns s1 if s2 is empty string */
3510 ....................
3511 .................... char *strpbrk(char *s1, char *s2)
3512 .................... {
3513 .................... char *sc1, *sc2;
3514 ....................
3515 .................... for (sc1 = s1; *sc1 != 0; sc1++)
3516 .................... for (sc2 = s2; *sc2 != 0; sc2++)
3517 .................... if (*sc1 == *sc2)
3518 .................... return(sc1);
3519 .................... return(0);
3520 .................... }
3521 ....................
3522 ....................
3523 .................... /* standard template: char *strrchr(const char *s, int c).
3524 .................... Finds last occurrence of c in s */
3525 ....................
3526 .................... char *strrchr(char *s, unsigned int8 c)
3527 .................... {
3528 .................... char *p;
3529 ....................
3530 .................... for (p = 0; ; s++)
3531 .................... {
3532 .................... if (*s == c)
3533 .................... p = s;
3534 .................... if (*s == '\0')
3535 .................... return(p);
3536 .................... }
3537 .................... }
3538 .................... /* computes length of max initial segment of s1 consisting
3539 .................... entirely of characters from s2 */
3540 ....................
3541 .................... unsigned int8 strspn(char *s1, char *s2)
3542 .................... {
3543 .................... char *sc1, *sc2;
3544 ....................
3545 .................... for (sc1 = s1; *sc1 != 0; sc1++)
3546 .................... for (sc2 = s2; ; sc2++)
3547 .................... if (*sc2 == '\0')
3548 .................... return(sc1 - s1);
3549 .................... else if (*sc1 == *sc2)
3550 .................... break;
3551 .................... return(sc1 - s1);
3552 .................... }
3553 .................... /* standard template:
3554 .................... char *strstr(const char *s1, const char *s2);
3555 .................... Locates first occurence of character sequence s2 in s1;
3556 .................... returns 0 if s2 is empty string
3557 ....................
3558 .................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the
3559 .................... file to use the faster algorithm */
3560 .................... char *strstr(char *s1, char *s2)
3561 .................... {
3562 .................... char *s, *t;
3563 ....................
3564 .................... #ifdef FASTER_BUT_MORE_ROM
3565 .................... if (*s2 == '\0')
3566 .................... return(s1);
3567 .................... #endif
3568 ....................
3569 .................... while (*s1)
3570 .................... {
3571 .................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t);
3572 ....................
3573 .................... if (*t == '\0')
3574 .................... return s1;
3575 .................... ++s1;
3576 .................... #ifdef FASTER_BUT_MORE_ROM
3577 .................... while(*s1 != '\0' && *s1 != *s2)
3578 .................... ++s1;
3579 .................... #endif
3580 .................... }
3581 .................... return 0;
3582 .................... }
3583 ....................
3584 .................... /* standard template: char *strtok(char *s1, const char *s2).
3585 ....................
3586 .................... Finds next token in s1 delimited by a character from separator
3587 .................... string s2 (which can be different from call to call). First call
3588 .................... starts at beginning of s1 searching for first character NOT
3589 .................... contained in s2; returns 0 if none is found.
3590 .................... If one is found, it is the start of first token (return value).
3591 .................... Function then searches from there for a character contained in s2.
3592 .................... If none is found, current token extends to end of s1, and subsequent
3593 .................... searches for a token will return 0. If one is found, it is
3594 .................... overwritten by '\0', which terminates current token. Function saves
3595 .................... pointer to following character from which next search will start.
3596 .................... Each subsequent call, with 0 as first argument, starts searching
3597 .................... from saved pointer */
3598 ....................
3599 .................... char *strtok(char *s1, char *s2)
3600 .................... {
3601 .................... char *beg, *end;
3602 .................... static char *save;
3603 *
3604 1825: CLRF 29
3605 1826: CLRF 2A
3606 ....................
3607 .................... beg = (s1)? s1: save;
3608 .................... beg += strspn(beg, s2);
3609 .................... if (*beg == '\0')
3610 .................... {
3611 .................... *save = ' ';
3612 .................... return(0);
3613 .................... }
3614 .................... end = strpbrk(beg, s2);
3615 .................... if (*end != '\0')
3616 .................... {
3617 .................... *end = '\0';
3618 .................... end++;
3619 .................... }
3620 .................... save = end;
3621 .................... return(beg);
3622 .................... }
3623 ....................
3624 .................... /*****************************************************************/
3625 .................... /*Miscellaneous functions*/
3626 .................... /* standard template
3627 .................... maps error number in errnum to an error message string
3628 .................... Returns: Pointer to string
3629 .................... */
3630 .................... #ifdef _ERRNO
3631 .................... char * strerror(unsigned int8 errnum)
3632 .................... {
3633 .................... char s[15];
3634 .................... switch( errnum)
3635 .................... {
3636 .................... case 0:
3637 .................... strcpy(s,"no errors");
3638 .................... return s;
3639 .................... case EDOM :
3640 .................... strcpy(s,"domain error");
3641 .................... return s;
3642 .................... case ERANGE:
3643 .................... strcpy(s,"range error");
3644 .................... return s;
3645 .................... }
3646 .................... }
3647 .................... #ENDIF
3648 .................... /* standard template: size_t strlen(const char *s).
3649 .................... Computes length of s1 (preceding terminating 0) */
3650 ....................
3651 .................... unsigned int8 strlen(char *s)
3652 .................... {
3653 .................... char *sc;
3654 ....................
3655 .................... for (sc = s; *sc != 0; sc++);
3656 .................... return(sc - s);
3657 .................... }
3658 ....................
3659 .................... /* standard template: size_t stricmp(const char *s1, const char *s2).
3660 .................... Compares s1 to s2 ignoring case (upper vs. lower) */
3661 ....................
3662 .................... signed int8 stricmp(char *s1, char *s2)
3663 .................... {
3664 .................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));
3665 .................... s1++, s2++)
3666 .................... if (*s1 == '\0')
3667 .................... return(0);
3668 .................... return((*s1 < *s2) ? -1: 1);
3669 .................... }
3670 ....................
3671 ....................
3672 .................... /* standard template: char *strlwr(char *s).
3673 .................... Replaces uppercase letters by lowercase;
3674 .................... returns pointer to new string s */
3675 ....................
3676 .................... char *strlwr(char *s)
3677 .................... {
3678 .................... char *p;
3679 ....................
3680 .................... for (p = s; *p != '\0'; p++)
3681 .................... if (*p >= 'A' && *p <='Z')
3682 .................... *p += 'a' - 'A';
3683 .................... return(s);
3684 .................... }
3685 ....................
3686 ....................
3687 .................... /************************************************************/
3688 ....................
3689 ....................
3690 .................... #endif
3691 ....................
3692 ....................
3693 .................... #include "SHT25.h"
3694 ....................
3695 .................... #define SHT25_HEATER_ON 0x04
3696 .................... #define SHT25_HEATER_OFF 0x00
3697 .................... #define SHT25_OTP_reload_off 0x02
3698 .................... #define SHT25_RH12_T14 0x00
3699 .................... #define SHT25_RH8_T12 0x01
3700 .................... #define SHT25_RH10_T13 0x80
3701 .................... #define SHT25_RH11_T11 0x81
3702 ....................
3703 .................... #define SHT25_ADDR 0x80
3704 ....................
3705 .................... #include "SHT25.c"
3706 .................... void SHT25_soft_reset()
3707 .................... {
3708 .................... i2c_start(); // Start condition
3709 *
3710 0278: BSF 28.4
3711 0279: MOVF 28,W
3712 027A: BSF 03.5
3713 027B: MOVWF 07
3714 027C: NOP
3715 027D: BCF 03.5
3716 027E: BSF 28.3
3717 027F: MOVF 28,W
3718 0280: BSF 03.5
3719 0281: MOVWF 07
3720 0282: NOP
3721 0283: BCF 03.5
3722 0284: BCF 07.4
3723 0285: BCF 28.4
3724 0286: MOVF 28,W
3725 0287: BSF 03.5
3726 0288: MOVWF 07
3727 0289: NOP
3728 028A: BCF 03.5
3729 028B: BCF 07.3
3730 028C: BCF 28.3
3731 028D: MOVF 28,W
3732 028E: BSF 03.5
3733 028F: MOVWF 07
3734 .................... i2c_write(0x80); // Device address
3735 0290: MOVLW 80
3736 0291: MOVWF 73
3737 0292: BCF 03.5
3738 0293: CALL 22E
3739 .................... i2c_write(0xFE); // Device command
3740 0294: MOVLW FE
3741 0295: MOVWF 73
3742 0296: CALL 22E
3743 .................... i2c_stop(); // Stop condition
3744 0297: BCF 28.4
3745 0298: MOVF 28,W
3746 0299: BSF 03.5
3747 029A: MOVWF 07
3748 029B: NOP
3749 029C: BCF 03.5
3750 029D: BSF 28.3
3751 029E: MOVF 28,W
3752 029F: BSF 03.5
3753 02A0: MOVWF 07
3754 02A1: BCF 03.5
3755 02A2: BTFSS 07.3
3756 02A3: GOTO 2A2
3757 02A4: NOP
3758 02A5: GOTO 2A6
3759 02A6: NOP
3760 02A7: BSF 28.4
3761 02A8: MOVF 28,W
3762 02A9: BSF 03.5
3763 02AA: MOVWF 07
3764 02AB: NOP
3765 .................... }
3766 02AC: BCF 03.5
3767 02AD: BSF 0A.3
3768 02AE: BSF 0A.4
3769 02AF: GOTO 092 (RETURN)
3770 ....................
3771 .................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value
3772 .................... {
3773 .................... unsigned int8 reg;
3774 ....................
3775 .................... i2c_start(); // Start condition
3776 *
3777 0309: BSF 28.4
3778 030A: MOVF 28,W
3779 030B: BSF 03.5
3780 030C: MOVWF 07
3781 030D: NOP
3782 030E: BCF 03.5
3783 030F: BSF 28.3
3784 0310: MOVF 28,W
3785 0311: BSF 03.5
3786 0312: MOVWF 07
3787 0313: NOP
3788 0314: BCF 03.5
3789 0315: BCF 07.4
3790 0316: BCF 28.4
3791 0317: MOVF 28,W
3792 0318: BSF 03.5
3793 0319: MOVWF 07
3794 031A: NOP
3795 031B: BCF 03.5
3796 031C: BCF 07.3
3797 031D: BCF 28.3
3798 031E: MOVF 28,W
3799 031F: BSF 03.5
3800 0320: MOVWF 07
3801 .................... i2c_write(SHT25_ADDR); // Device address
3802 0321: MOVLW 80
3803 0322: MOVWF 73
3804 0323: BCF 03.5
3805 0324: CALL 22E
3806 .................... i2c_write(0xE7); // Device command
3807 0325: MOVLW E7
3808 0326: MOVWF 73
3809 0327: CALL 22E
3810 ....................
3811 .................... i2c_start(); // Start condition
3812 0328: BSF 28.4
3813 0329: MOVF 28,W
3814 032A: BSF 03.5
3815 032B: MOVWF 07
3816 032C: NOP
3817 032D: BCF 03.5
3818 032E: BSF 28.3
3819 032F: MOVF 28,W
3820 0330: BSF 03.5
3821 0331: MOVWF 07
3822 0332: NOP
3823 0333: BCF 03.5
3824 0334: BTFSS 07.3
3825 0335: GOTO 334
3826 0336: BCF 07.4
3827 0337: BCF 28.4
3828 0338: MOVF 28,W
3829 0339: BSF 03.5
3830 033A: MOVWF 07
3831 033B: NOP
3832 033C: BCF 03.5
3833 033D: BCF 07.3
3834 033E: BCF 28.3
3835 033F: MOVF 28,W
3836 0340: BSF 03.5
3837 0341: MOVWF 07
3838 .................... i2c_write(SHT25_ADDR+1); // Device address
3839 0342: MOVLW 81
3840 0343: MOVWF 73
3841 0344: BCF 03.5
3842 0345: CALL 22E
3843 .................... reg=i2c_read(0); // Read status actual status register
3844 0346: CLRF 77
3845 0347: CALL 2B0
3846 0348: MOVF 78,W
3847 0349: MOVWF 61
3848 ....................
3849 .................... reg = (reg & 0x3A) | setup_reg;
3850 034A: MOVF 61,W
3851 034B: ANDLW 3A
3852 034C: IORWF 60,W
3853 034D: MOVWF 61
3854 ....................
3855 .................... i2c_start(); // Start condition
3856 034E: BSF 28.4
3857 034F: MOVF 28,W
3858 0350: BSF 03.5
3859 0351: MOVWF 07
3860 0352: NOP
3861 0353: BCF 03.5
3862 0354: BSF 28.3
3863 0355: MOVF 28,W
3864 0356: BSF 03.5
3865 0357: MOVWF 07
3866 0358: NOP
3867 0359: BCF 03.5
3868 035A: BTFSS 07.3
3869 035B: GOTO 35A
3870 035C: BCF 07.4
3871 035D: BCF 28.4
3872 035E: MOVF 28,W
3873 035F: BSF 03.5
3874 0360: MOVWF 07
3875 0361: NOP
3876 0362: BCF 03.5
3877 0363: BCF 07.3
3878 0364: BCF 28.3
3879 0365: MOVF 28,W
3880 0366: BSF 03.5
3881 0367: MOVWF 07
3882 .................... i2c_write(SHT25_ADDR); // Device address
3883 0368: MOVLW 80
3884 0369: MOVWF 73
3885 036A: BCF 03.5
3886 036B: CALL 22E
3887 .................... i2c_write(0xE6); // Write to status register
3888 036C: MOVLW E6
3889 036D: MOVWF 73
3890 036E: CALL 22E
3891 .................... i2c_write(reg); // Device command
3892 036F: MOVF 61,W
3893 0370: MOVWF 73
3894 0371: CALL 22E
3895 .................... i2c_stop(); // Stop condition
3896 0372: BCF 28.4
3897 0373: MOVF 28,W
3898 0374: BSF 03.5
3899 0375: MOVWF 07
3900 0376: NOP
3901 0377: BCF 03.5
3902 0378: BSF 28.3
3903 0379: MOVF 28,W
3904 037A: BSF 03.5
3905 037B: MOVWF 07
3906 037C: BCF 03.5
3907 037D: BTFSS 07.3
3908 037E: GOTO 37D
3909 037F: NOP
3910 0380: GOTO 381
3911 0381: NOP
3912 0382: BSF 28.4
3913 0383: MOVF 28,W
3914 0384: BSF 03.5
3915 0385: MOVWF 07
3916 0386: NOP
3917 ....................
3918 .................... delay_ms(10);
3919 0387: MOVLW 0A
3920 0388: BCF 03.5
3921 0389: MOVWF 65
3922 038A: CALL 2F5
3923 ....................
3924 .................... i2c_start(); // Start condition
3925 038B: BSF 28.4
3926 038C: MOVF 28,W
3927 038D: BSF 03.5
3928 038E: MOVWF 07
3929 038F: NOP
3930 0390: BCF 03.5
3931 0391: BSF 28.3
3932 0392: MOVF 28,W
3933 0393: BSF 03.5
3934 0394: MOVWF 07
3935 0395: NOP
3936 0396: BCF 03.5
3937 0397: BCF 07.4
3938 0398: BCF 28.4
3939 0399: MOVF 28,W
3940 039A: BSF 03.5
3941 039B: MOVWF 07
3942 039C: NOP
3943 039D: BCF 03.5
3944 039E: BCF 07.3
3945 039F: BCF 28.3
3946 03A0: MOVF 28,W
3947 03A1: BSF 03.5
3948 03A2: MOVWF 07
3949 .................... i2c_write(SHT25_ADDR); // Device address
3950 03A3: MOVLW 80
3951 03A4: MOVWF 73
3952 03A5: BCF 03.5
3953 03A6: CALL 22E
3954 .................... i2c_write(0xE7); // Device command
3955 03A7: MOVLW E7
3956 03A8: MOVWF 73
3957 03A9: CALL 22E
3958 ....................
3959 .................... i2c_start(); // Start condition
3960 03AA: BSF 28.4
3961 03AB: MOVF 28,W
3962 03AC: BSF 03.5
3963 03AD: MOVWF 07
3964 03AE: NOP
3965 03AF: BCF 03.5
3966 03B0: BSF 28.3
3967 03B1: MOVF 28,W
3968 03B2: BSF 03.5
3969 03B3: MOVWF 07
3970 03B4: NOP
3971 03B5: BCF 03.5
3972 03B6: BTFSS 07.3
3973 03B7: GOTO 3B6
3974 03B8: BCF 07.4
3975 03B9: BCF 28.4
3976 03BA: MOVF 28,W
3977 03BB: BSF 03.5
3978 03BC: MOVWF 07
3979 03BD: NOP
3980 03BE: BCF 03.5
3981 03BF: BCF 07.3
3982 03C0: BCF 28.3
3983 03C1: MOVF 28,W
3984 03C2: BSF 03.5
3985 03C3: MOVWF 07
3986 .................... i2c_write(SHT25_ADDR+1); // Device address
3987 03C4: MOVLW 81
3988 03C5: MOVWF 73
3989 03C6: BCF 03.5
3990 03C7: CALL 22E
3991 .................... reg=i2c_read(0); // Read status actual status register
3992 03C8: CLRF 77
3993 03C9: CALL 2B0
3994 03CA: MOVF 78,W
3995 03CB: MOVWF 61
3996 ....................
3997 .................... return (reg);
3998 03CC: MOVF 61,W
3999 03CD: MOVWF 78
4000 .................... }
4001 03CE: BSF 0A.3
4002 03CF: BSF 0A.4
4003 03D0: GOTO 09A (RETURN)
4004 ....................
4005 ....................
4006 .................... float SHT25_get_temp()
4007 .................... {
4008 .................... unsigned int8 MSB, LSB, Check;
4009 .................... unsigned int16 data;
4010 ....................
4011 .................... i2c_start();
4012 *
4013 0B85: BSF 28.4
4014 0B86: MOVF 28,W
4015 0B87: BSF 03.5
4016 0B88: MOVWF 07
4017 0B89: NOP
4018 0B8A: BCF 03.5
4019 0B8B: BSF 28.3
4020 0B8C: MOVF 28,W
4021 0B8D: BSF 03.5
4022 0B8E: MOVWF 07
4023 0B8F: NOP
4024 0B90: BCF 03.5
4025 0B91: BTFSS 07.3
4026 0B92: GOTO 391
4027 0B93: BCF 07.4
4028 0B94: BCF 28.4
4029 0B95: MOVF 28,W
4030 0B96: BSF 03.5
4031 0B97: MOVWF 07
4032 0B98: NOP
4033 0B99: BCF 03.5
4034 0B9A: BCF 07.3
4035 0B9B: BCF 28.3
4036 0B9C: MOVF 28,W
4037 0B9D: BSF 03.5
4038 0B9E: MOVWF 07
4039 .................... I2C_Write(SHT25_ADDR);
4040 0B9F: MOVLW 80
4041 0BA0: MOVWF 73
4042 0BA1: BCF 0A.3
4043 0BA2: BCF 03.5
4044 0BA3: CALL 22E
4045 0BA4: BSF 0A.3
4046 .................... I2C_write(0xE3);
4047 0BA5: MOVLW E3
4048 0BA6: MOVWF 73
4049 0BA7: BCF 0A.3
4050 0BA8: CALL 22E
4051 0BA9: BSF 0A.3
4052 .................... i2c_stop();
4053 0BAA: BCF 28.4
4054 0BAB: MOVF 28,W
4055 0BAC: BSF 03.5
4056 0BAD: MOVWF 07
4057 0BAE: NOP
4058 0BAF: BCF 03.5
4059 0BB0: BSF 28.3
4060 0BB1: MOVF 28,W
4061 0BB2: BSF 03.5
4062 0BB3: MOVWF 07
4063 0BB4: BCF 03.5
4064 0BB5: BTFSS 07.3
4065 0BB6: GOTO 3B5
4066 0BB7: NOP
4067 0BB8: GOTO 3B9
4068 0BB9: NOP
4069 0BBA: BSF 28.4
4070 0BBB: MOVF 28,W
4071 0BBC: BSF 03.5
4072 0BBD: MOVWF 07
4073 0BBE: NOP
4074 ....................
4075 .................... delay_ms(100);
4076 0BBF: MOVLW 64
4077 0BC0: BCF 03.5
4078 0BC1: MOVWF 65
4079 0BC2: BCF 0A.3
4080 0BC3: CALL 2F5
4081 0BC4: BSF 0A.3
4082 ....................
4083 .................... i2c_start();
4084 0BC5: BSF 28.4
4085 0BC6: MOVF 28,W
4086 0BC7: BSF 03.5
4087 0BC8: MOVWF 07
4088 0BC9: NOP
4089 0BCA: BCF 03.5
4090 0BCB: BSF 28.3
4091 0BCC: MOVF 28,W
4092 0BCD: BSF 03.5
4093 0BCE: MOVWF 07
4094 0BCF: NOP
4095 0BD0: BCF 03.5
4096 0BD1: BCF 07.4
4097 0BD2: BCF 28.4
4098 0BD3: MOVF 28,W
4099 0BD4: BSF 03.5
4100 0BD5: MOVWF 07
4101 0BD6: NOP
4102 0BD7: BCF 03.5
4103 0BD8: BCF 07.3
4104 0BD9: BCF 28.3
4105 0BDA: MOVF 28,W
4106 0BDB: BSF 03.5
4107 0BDC: MOVWF 07
4108 .................... I2C_Write(SHT25_ADDR+1);
4109 0BDD: MOVLW 81
4110 0BDE: MOVWF 73
4111 0BDF: BCF 0A.3
4112 0BE0: BCF 03.5
4113 0BE1: CALL 22E
4114 0BE2: BSF 0A.3
4115 .................... MSB=i2c_read(1);
4116 0BE3: MOVLW 01
4117 0BE4: MOVWF 77
4118 0BE5: BCF 0A.3
4119 0BE6: CALL 2B0
4120 0BE7: BSF 0A.3
4121 0BE8: MOVF 78,W
4122 0BE9: MOVWF 60
4123 .................... LSB=i2c_read(1);
4124 0BEA: MOVLW 01
4125 0BEB: MOVWF 77
4126 0BEC: BCF 0A.3
4127 0BED: CALL 2B0
4128 0BEE: BSF 0A.3
4129 0BEF: MOVF 78,W
4130 0BF0: MOVWF 61
4131 .................... Check=i2c_read(0);
4132 0BF1: CLRF 77
4133 0BF2: BCF 0A.3
4134 0BF3: CALL 2B0
4135 0BF4: BSF 0A.3
4136 0BF5: MOVF 78,W
4137 0BF6: MOVWF 62
4138 .................... i2c_stop();
4139 0BF7: BCF 28.4
4140 0BF8: MOVF 28,W
4141 0BF9: BSF 03.5
4142 0BFA: MOVWF 07
4143 0BFB: NOP
4144 0BFC: BCF 03.5
4145 0BFD: BSF 28.3
4146 0BFE: MOVF 28,W
4147 0BFF: BSF 03.5
4148 0C00: MOVWF 07
4149 0C01: BCF 03.5
4150 0C02: BTFSS 07.3
4151 0C03: GOTO 402
4152 0C04: NOP
4153 0C05: GOTO 406
4154 0C06: NOP
4155 0C07: BSF 28.4
4156 0C08: MOVF 28,W
4157 0C09: BSF 03.5
4158 0C0A: MOVWF 07
4159 0C0B: NOP
4160 ....................
4161 .................... LSB = LSB >> 2; // trow out status bits
4162 0C0C: BCF 03.5
4163 0C0D: RRF 61,F
4164 0C0E: RRF 61,F
4165 0C0F: MOVLW 3F
4166 0C10: ANDWF 61,F
4167 ....................
4168 .................... data = (((unsigned int16) MSB << 8) + (LSB << 4));
4169 0C11: CLRF 66
4170 0C12: MOVF 60,W
4171 0C13: MOVWF 65
4172 0C14: MOVWF 66
4173 0C15: CLRF 65
4174 0C16: SWAPF 61,W
4175 0C17: MOVWF 77
4176 0C18: MOVLW F0
4177 0C19: ANDWF 77,F
4178 0C1A: MOVF 77,W
4179 0C1B: ADDWF 65,W
4180 0C1C: MOVWF 63
4181 0C1D: MOVF 66,W
4182 0C1E: MOVWF 64
4183 0C1F: BTFSC 03.0
4184 0C20: INCF 64,F
4185 0C21: CLRF 27
4186 0C22: BTFSC 0B.7
4187 0C23: BSF 27.7
4188 0C24: BCF 0B.7
4189 .................... return(-46.85 + 175.72*((float)data/0xFFFF));
4190 0C25: MOVF 64,W
4191 0C26: BSF 03.5
4192 0C27: MOVWF 43
4193 0C28: BCF 03.5
4194 0C29: MOVF 63,W
4195 0C2A: BSF 03.5
4196 0C2B: MOVWF 42
4197 0C2C: BCF 0A.3
4198 0C2D: BCF 03.5
4199 0C2E: CALL 038
4200 0C2F: BSF 0A.3
4201 0C30: BTFSC 27.7
4202 0C31: BSF 0B.7
4203 0C32: MOVF 77,W
4204 0C33: MOVWF 65
4205 0C34: MOVF 78,W
4206 0C35: MOVWF 66
4207 0C36: MOVF 79,W
4208 0C37: MOVWF 67
4209 0C38: MOVF 7A,W
4210 0C39: MOVWF 68
4211 0C3A: CLRF 27
4212 0C3B: BTFSC 0B.7
4213 0C3C: BSF 27.7
4214 0C3D: BCF 0B.7
4215 0C3E: MOVF 68,W
4216 0C3F: BSF 03.5
4217 0C40: MOVWF 45
4218 0C41: BCF 03.5
4219 0C42: MOVF 67,W
4220 0C43: BSF 03.5
4221 0C44: MOVWF 44
4222 0C45: BCF 03.5
4223 0C46: MOVF 66,W
4224 0C47: BSF 03.5
4225 0C48: MOVWF 43
4226 0C49: BCF 03.5
4227 0C4A: MOVF 65,W
4228 0C4B: BSF 03.5
4229 0C4C: MOVWF 42
4230 0C4D: CLRF 49
4231 0C4E: MOVLW FF
4232 0C4F: MOVWF 48
4233 0C50: MOVLW 7F
4234 0C51: MOVWF 47
4235 0C52: MOVLW 8E
4236 0C53: MOVWF 46
4237 0C54: BCF 0A.3
4238 0C55: BCF 03.5
4239 0C56: CALL 057
4240 0C57: BSF 0A.3
4241 0C58: BTFSC 27.7
4242 0C59: BSF 0B.7
4243 0C5A: MOVLW 52
4244 0C5B: BSF 03.5
4245 0C5C: MOVWF 2C
4246 0C5D: MOVLW B8
4247 0C5E: MOVWF 2B
4248 0C5F: MOVLW 2F
4249 0C60: MOVWF 2A
4250 0C61: MOVLW 86
4251 0C62: MOVWF 29
4252 0C63: MOVF 7A,W
4253 0C64: MOVWF 30
4254 0C65: MOVF 79,W
4255 0C66: MOVWF 2F
4256 0C67: MOVF 78,W
4257 0C68: MOVWF 2E
4258 0C69: MOVF 77,W
4259 0C6A: MOVWF 2D
4260 0C6B: BCF 0A.3
4261 0C6C: BCF 03.5
4262 0C6D: CALL 76E
4263 0C6E: BSF 0A.3
4264 0C6F: BCF 03.1
4265 0C70: MOVLW 66
4266 0C71: BSF 03.5
4267 0C72: MOVWF 2C
4268 0C73: MOVWF 2B
4269 0C74: MOVLW BB
4270 0C75: MOVWF 2A
4271 0C76: MOVLW 84
4272 0C77: MOVWF 29
4273 0C78: MOVF 7A,W
4274 0C79: MOVWF 30
4275 0C7A: MOVF 79,W
4276 0C7B: MOVWF 2F
4277 0C7C: MOVF 78,W
4278 0C7D: MOVWF 2E
4279 0C7E: MOVF 77,W
4280 0C7F: MOVWF 2D
4281 0C80: BCF 03.5
4282 0C81: CALL 000
4283 .................... }
4284 0C82: BSF 0A.3
4285 0C83: BSF 0A.4
4286 0C84: GOTO 0FB (RETURN)
4287 ....................
4288 .................... float SHT25_get_hum()
4289 .................... {
4290 .................... unsigned int8 MSB, LSB, Check;
4291 .................... unsigned int16 data;
4292 ....................
4293 .................... i2c_start(); //RH
4294 0C85: BSF 28.4
4295 0C86: MOVF 28,W
4296 0C87: BSF 03.5
4297 0C88: MOVWF 07
4298 0C89: NOP
4299 0C8A: BCF 03.5
4300 0C8B: BSF 28.3
4301 0C8C: MOVF 28,W
4302 0C8D: BSF 03.5
4303 0C8E: MOVWF 07
4304 0C8F: NOP
4305 0C90: BCF 03.5
4306 0C91: BCF 07.4
4307 0C92: BCF 28.4
4308 0C93: MOVF 28,W
4309 0C94: BSF 03.5
4310 0C95: MOVWF 07
4311 0C96: NOP
4312 0C97: BCF 03.5
4313 0C98: BCF 07.3
4314 0C99: BCF 28.3
4315 0C9A: MOVF 28,W
4316 0C9B: BSF 03.5
4317 0C9C: MOVWF 07
4318 .................... I2C_Write(SHT25_ADDR);
4319 0C9D: MOVLW 80
4320 0C9E: MOVWF 73
4321 0C9F: BCF 0A.3
4322 0CA0: BCF 03.5
4323 0CA1: CALL 22E
4324 0CA2: BSF 0A.3
4325 .................... I2C_write(0xE5);
4326 0CA3: MOVLW E5
4327 0CA4: MOVWF 73
4328 0CA5: BCF 0A.3
4329 0CA6: CALL 22E
4330 0CA7: BSF 0A.3
4331 ....................
4332 .................... delay_ms(100);
4333 0CA8: MOVLW 64
4334 0CA9: MOVWF 65
4335 0CAA: BCF 0A.3
4336 0CAB: CALL 2F5
4337 0CAC: BSF 0A.3
4338 ....................
4339 .................... i2c_start();
4340 0CAD: BSF 28.4
4341 0CAE: MOVF 28,W
4342 0CAF: BSF 03.5
4343 0CB0: MOVWF 07
4344 0CB1: NOP
4345 0CB2: BCF 03.5
4346 0CB3: BSF 28.3
4347 0CB4: MOVF 28,W
4348 0CB5: BSF 03.5
4349 0CB6: MOVWF 07
4350 0CB7: NOP
4351 0CB8: BCF 03.5
4352 0CB9: BTFSS 07.3
4353 0CBA: GOTO 4B9
4354 0CBB: BCF 07.4
4355 0CBC: BCF 28.4
4356 0CBD: MOVF 28,W
4357 0CBE: BSF 03.5
4358 0CBF: MOVWF 07
4359 0CC0: NOP
4360 0CC1: BCF 03.5
4361 0CC2: BCF 07.3
4362 0CC3: BCF 28.3
4363 0CC4: MOVF 28,W
4364 0CC5: BSF 03.5
4365 0CC6: MOVWF 07
4366 .................... I2C_Write(SHT25_ADDR+1);
4367 0CC7: MOVLW 81
4368 0CC8: MOVWF 73
4369 0CC9: BCF 0A.3
4370 0CCA: BCF 03.5
4371 0CCB: CALL 22E
4372 0CCC: BSF 0A.3
4373 .................... MSB=i2c_read(1);
4374 0CCD: MOVLW 01
4375 0CCE: MOVWF 77
4376 0CCF: BCF 0A.3
4377 0CD0: CALL 2B0
4378 0CD1: BSF 0A.3
4379 0CD2: MOVF 78,W
4380 0CD3: MOVWF 60
4381 .................... LSB=i2c_read(1);
4382 0CD4: MOVLW 01
4383 0CD5: MOVWF 77
4384 0CD6: BCF 0A.3
4385 0CD7: CALL 2B0
4386 0CD8: BSF 0A.3
4387 0CD9: MOVF 78,W
4388 0CDA: MOVWF 61
4389 .................... Check=i2c_read(0);
4390 0CDB: CLRF 77
4391 0CDC: BCF 0A.3
4392 0CDD: CALL 2B0
4393 0CDE: BSF 0A.3
4394 0CDF: MOVF 78,W
4395 0CE0: MOVWF 62
4396 .................... i2c_stop();
4397 0CE1: BCF 28.4
4398 0CE2: MOVF 28,W
4399 0CE3: BSF 03.5
4400 0CE4: MOVWF 07
4401 0CE5: NOP
4402 0CE6: BCF 03.5
4403 0CE7: BSF 28.3
4404 0CE8: MOVF 28,W
4405 0CE9: BSF 03.5
4406 0CEA: MOVWF 07
4407 0CEB: BCF 03.5
4408 0CEC: BTFSS 07.3
4409 0CED: GOTO 4EC
4410 0CEE: NOP
4411 0CEF: GOTO 4F0
4412 0CF0: NOP
4413 0CF1: BSF 28.4
4414 0CF2: MOVF 28,W
4415 0CF3: BSF 03.5
4416 0CF4: MOVWF 07
4417 0CF5: NOP
4418 ....................
4419 .................... LSB = LSB >> 2; // trow out status bits
4420 0CF6: BCF 03.5
4421 0CF7: RRF 61,F
4422 0CF8: RRF 61,F
4423 0CF9: MOVLW 3F
4424 0CFA: ANDWF 61,F
4425 ....................
4426 .................... data = (((unsigned int16) MSB << 8) + (LSB << 4) );
4427 0CFB: CLRF 66
4428 0CFC: MOVF 60,W
4429 0CFD: MOVWF 65
4430 0CFE: MOVWF 66
4431 0CFF: CLRF 65
4432 0D00: SWAPF 61,W
4433 0D01: MOVWF 77
4434 0D02: MOVLW F0
4435 0D03: ANDWF 77,F
4436 0D04: MOVF 77,W
4437 0D05: ADDWF 65,W
4438 0D06: MOVWF 63
4439 0D07: MOVF 66,W
4440 0D08: MOVWF 64
4441 0D09: BTFSC 03.0
4442 0D0A: INCF 64,F
4443 0D0B: CLRF 27
4444 0D0C: BTFSC 0B.7
4445 0D0D: BSF 27.7
4446 0D0E: BCF 0B.7
4447 .................... return( -6.0 + 125.0*((float)data/0xFFFF));
4448 0D0F: MOVF 64,W
4449 0D10: BSF 03.5
4450 0D11: MOVWF 43
4451 0D12: BCF 03.5
4452 0D13: MOVF 63,W
4453 0D14: BSF 03.5
4454 0D15: MOVWF 42
4455 0D16: BCF 0A.3
4456 0D17: BCF 03.5
4457 0D18: CALL 038
4458 0D19: BSF 0A.3
4459 0D1A: BTFSC 27.7
4460 0D1B: BSF 0B.7
4461 0D1C: MOVF 77,W
4462 0D1D: MOVWF 65
4463 0D1E: MOVF 78,W
4464 0D1F: MOVWF 66
4465 0D20: MOVF 79,W
4466 0D21: MOVWF 67
4467 0D22: MOVF 7A,W
4468 0D23: MOVWF 68
4469 0D24: CLRF 27
4470 0D25: BTFSC 0B.7
4471 0D26: BSF 27.7
4472 0D27: BCF 0B.7
4473 0D28: MOVF 7A,W
4474 0D29: BSF 03.5
4475 0D2A: MOVWF 45
4476 0D2B: BCF 03.5
4477 0D2C: MOVF 79,W
4478 0D2D: BSF 03.5
4479 0D2E: MOVWF 44
4480 0D2F: BCF 03.5
4481 0D30: MOVF 78,W
4482 0D31: BSF 03.5
4483 0D32: MOVWF 43
4484 0D33: BCF 03.5
4485 0D34: MOVF 77,W
4486 0D35: BSF 03.5
4487 0D36: MOVWF 42
4488 0D37: CLRF 49
4489 0D38: MOVLW FF
4490 0D39: MOVWF 48
4491 0D3A: MOVLW 7F
4492 0D3B: MOVWF 47
4493 0D3C: MOVLW 8E
4494 0D3D: MOVWF 46
4495 0D3E: BCF 0A.3
4496 0D3F: BCF 03.5
4497 0D40: CALL 057
4498 0D41: BSF 0A.3
4499 0D42: BTFSC 27.7
4500 0D43: BSF 0B.7
4501 0D44: BSF 03.5
4502 0D45: CLRF 2C
4503 0D46: CLRF 2B
4504 0D47: MOVLW 7A
4505 0D48: MOVWF 2A
4506 0D49: MOVLW 85
4507 0D4A: MOVWF 29
4508 0D4B: MOVF 7A,W
4509 0D4C: MOVWF 30
4510 0D4D: MOVF 79,W
4511 0D4E: MOVWF 2F
4512 0D4F: MOVF 78,W
4513 0D50: MOVWF 2E
4514 0D51: MOVF 77,W
4515 0D52: MOVWF 2D
4516 0D53: BCF 0A.3
4517 0D54: BCF 03.5
4518 0D55: CALL 76E
4519 0D56: BSF 0A.3
4520 0D57: BCF 03.1
4521 0D58: BSF 03.5
4522 0D59: CLRF 2C
4523 0D5A: CLRF 2B
4524 0D5B: MOVLW C0
4525 0D5C: MOVWF 2A
4526 0D5D: MOVLW 81
4527 0D5E: MOVWF 29
4528 0D5F: MOVF 7A,W
4529 0D60: MOVWF 30
4530 0D61: MOVF 79,W
4531 0D62: MOVWF 2F
4532 0D63: MOVF 78,W
4533 0D64: MOVWF 2E
4534 0D65: MOVF 77,W
4535 0D66: MOVWF 2D
4536 0D67: BCF 03.5
4537 0D68: CALL 000
4538 .................... }
4539 0D69: BSF 0A.3
4540 0D6A: BSF 0A.4
4541 0D6B: GOTO 106 (RETURN)
4542 ....................
4543 ....................
4544 ....................
4545 ....................
4546 .................... #include "MPL3115.h"
4547 .................... #define MPL3115_ADDR_R 0xC1 //addresa pro cteni
4548 .................... #define MPL3115_ADDR_W 0xC0
4549 ....................
4550 .................... #include "MPL3115.c"
4551 .................... void mpl3115_setA (void) //nastavení pro výšku
4552 .................... {
4553 ....................
4554 ....................
4555 .................... i2c_start(); //STANDBY mode
4556 *
4557 0A20: BSF 28.4
4558 0A21: MOVF 28,W
4559 0A22: BSF 03.5
4560 0A23: MOVWF 07
4561 0A24: NOP
4562 0A25: BCF 03.5
4563 0A26: BSF 28.3
4564 0A27: MOVF 28,W
4565 0A28: BSF 03.5
4566 0A29: MOVWF 07
4567 0A2A: NOP
4568 0A2B: BCF 03.5
4569 0A2C: BCF 07.4
4570 0A2D: BCF 28.4
4571 0A2E: MOVF 28,W
4572 0A2F: BSF 03.5
4573 0A30: MOVWF 07
4574 0A31: NOP
4575 0A32: BCF 03.5
4576 0A33: BCF 07.3
4577 0A34: BCF 28.3
4578 0A35: MOVF 28,W
4579 0A36: BSF 03.5
4580 0A37: MOVWF 07
4581 .................... I2C_Write(MPL3115_ADDR_W);
4582 0A38: MOVLW C0
4583 0A39: MOVWF 73
4584 0A3A: BCF 0A.3
4585 0A3B: BCF 03.5
4586 0A3C: CALL 22E
4587 0A3D: BSF 0A.3
4588 .................... I2C_write(0x26);
4589 0A3E: MOVLW 26
4590 0A3F: MOVWF 73
4591 0A40: BCF 0A.3
4592 0A41: CALL 22E
4593 0A42: BSF 0A.3
4594 .................... I2C_write(0xB8);
4595 0A43: MOVLW B8
4596 0A44: MOVWF 73
4597 0A45: BCF 0A.3
4598 0A46: CALL 22E
4599 0A47: BSF 0A.3
4600 .................... i2c_stop();
4601 0A48: BCF 28.4
4602 0A49: MOVF 28,W
4603 0A4A: BSF 03.5
4604 0A4B: MOVWF 07
4605 0A4C: NOP
4606 0A4D: BCF 03.5
4607 0A4E: BSF 28.3
4608 0A4F: MOVF 28,W
4609 0A50: BSF 03.5
4610 0A51: MOVWF 07
4611 0A52: BCF 03.5
4612 0A53: BTFSS 07.3
4613 0A54: GOTO 253
4614 0A55: NOP
4615 0A56: GOTO 257
4616 0A57: NOP
4617 0A58: BSF 28.4
4618 0A59: MOVF 28,W
4619 0A5A: BSF 03.5
4620 0A5B: MOVWF 07
4621 0A5C: NOP
4622 ....................
4623 .................... i2c_start(); //PT_DATA_CFG set
4624 0A5D: BCF 03.5
4625 0A5E: BSF 28.4
4626 0A5F: MOVF 28,W
4627 0A60: BSF 03.5
4628 0A61: MOVWF 07
4629 0A62: NOP
4630 0A63: BCF 03.5
4631 0A64: BSF 28.3
4632 0A65: MOVF 28,W
4633 0A66: BSF 03.5
4634 0A67: MOVWF 07
4635 0A68: NOP
4636 0A69: BCF 03.5
4637 0A6A: BCF 07.4
4638 0A6B: BCF 28.4
4639 0A6C: MOVF 28,W
4640 0A6D: BSF 03.5
4641 0A6E: MOVWF 07
4642 0A6F: NOP
4643 0A70: BCF 03.5
4644 0A71: BCF 07.3
4645 0A72: BCF 28.3
4646 0A73: MOVF 28,W
4647 0A74: BSF 03.5
4648 0A75: MOVWF 07
4649 .................... I2C_Write(MPL3115_ADDR_W);
4650 0A76: MOVLW C0
4651 0A77: MOVWF 73
4652 0A78: BCF 0A.3
4653 0A79: BCF 03.5
4654 0A7A: CALL 22E
4655 0A7B: BSF 0A.3
4656 .................... I2C_write(0x13);
4657 0A7C: MOVLW 13
4658 0A7D: MOVWF 73
4659 0A7E: BCF 0A.3
4660 0A7F: CALL 22E
4661 0A80: BSF 0A.3
4662 .................... I2C_write(0x07); //hodnota
4663 0A81: MOVLW 07
4664 0A82: MOVWF 73
4665 0A83: BCF 0A.3
4666 0A84: CALL 22E
4667 0A85: BSF 0A.3
4668 .................... i2c_stop();
4669 0A86: BCF 28.4
4670 0A87: MOVF 28,W
4671 0A88: BSF 03.5
4672 0A89: MOVWF 07
4673 0A8A: NOP
4674 0A8B: BCF 03.5
4675 0A8C: BSF 28.3
4676 0A8D: MOVF 28,W
4677 0A8E: BSF 03.5
4678 0A8F: MOVWF 07
4679 0A90: BCF 03.5
4680 0A91: BTFSS 07.3
4681 0A92: GOTO 291
4682 0A93: NOP
4683 0A94: GOTO 295
4684 0A95: NOP
4685 0A96: BSF 28.4
4686 0A97: MOVF 28,W
4687 0A98: BSF 03.5
4688 0A99: MOVWF 07
4689 0A9A: NOP
4690 ....................
4691 .................... i2c_start(); //ACTIVE mode
4692 0A9B: BCF 03.5
4693 0A9C: BSF 28.4
4694 0A9D: MOVF 28,W
4695 0A9E: BSF 03.5
4696 0A9F: MOVWF 07
4697 0AA0: NOP
4698 0AA1: BCF 03.5
4699 0AA2: BSF 28.3
4700 0AA3: MOVF 28,W
4701 0AA4: BSF 03.5
4702 0AA5: MOVWF 07
4703 0AA6: NOP
4704 0AA7: BCF 03.5
4705 0AA8: BCF 07.4
4706 0AA9: BCF 28.4
4707 0AAA: MOVF 28,W
4708 0AAB: BSF 03.5
4709 0AAC: MOVWF 07
4710 0AAD: NOP
4711 0AAE: BCF 03.5
4712 0AAF: BCF 07.3
4713 0AB0: BCF 28.3
4714 0AB1: MOVF 28,W
4715 0AB2: BSF 03.5
4716 0AB3: MOVWF 07
4717 .................... I2C_Write(MPL3115_ADDR_W);
4718 0AB4: MOVLW C0
4719 0AB5: MOVWF 73
4720 0AB6: BCF 0A.3
4721 0AB7: BCF 03.5
4722 0AB8: CALL 22E
4723 0AB9: BSF 0A.3
4724 .................... I2C_write(0x26);
4725 0ABA: MOVLW 26
4726 0ABB: MOVWF 73
4727 0ABC: BCF 0A.3
4728 0ABD: CALL 22E
4729 0ABE: BSF 0A.3
4730 .................... I2C_write(0xB9);
4731 0ABF: MOVLW B9
4732 0AC0: MOVWF 73
4733 0AC1: BCF 0A.3
4734 0AC2: CALL 22E
4735 0AC3: BSF 0A.3
4736 .................... i2c_stop();
4737 0AC4: BCF 28.4
4738 0AC5: MOVF 28,W
4739 0AC6: BSF 03.5
4740 0AC7: MOVWF 07
4741 0AC8: NOP
4742 0AC9: BCF 03.5
4743 0ACA: BSF 28.3
4744 0ACB: MOVF 28,W
4745 0ACC: BSF 03.5
4746 0ACD: MOVWF 07
4747 0ACE: BCF 03.5
4748 0ACF: BTFSS 07.3
4749 0AD0: GOTO 2CF
4750 0AD1: NOP
4751 0AD2: GOTO 2D3
4752 0AD3: NOP
4753 0AD4: BSF 28.4
4754 0AD5: MOVF 28,W
4755 0AD6: BSF 03.5
4756 0AD7: MOVWF 07
4757 0AD8: NOP
4758 .................... }
4759 0AD9: BCF 03.5
4760 0ADA: BSF 0A.3
4761 0ADB: BSF 0A.4
4762 0ADC: GOTO 0E2 (RETURN)
4763 ....................
4764 .................... void mpl3115_setP (void) //nastavení pro tlak
4765 .................... {
4766 ....................
4767 ....................
4768 .................... i2c_start(); //STANDBY mode
4769 *
4770 05E6: BSF 28.4
4771 05E7: MOVF 28,W
4772 05E8: BSF 03.5
4773 05E9: MOVWF 07
4774 05EA: NOP
4775 05EB: BCF 03.5
4776 05EC: BSF 28.3
4777 05ED: MOVF 28,W
4778 05EE: BSF 03.5
4779 05EF: MOVWF 07
4780 05F0: NOP
4781 05F1: BCF 03.5
4782 05F2: BCF 07.4
4783 05F3: BCF 28.4
4784 05F4: MOVF 28,W
4785 05F5: BSF 03.5
4786 05F6: MOVWF 07
4787 05F7: NOP
4788 05F8: BCF 03.5
4789 05F9: BCF 07.3
4790 05FA: BCF 28.3
4791 05FB: MOVF 28,W
4792 05FC: BSF 03.5
4793 05FD: MOVWF 07
4794 .................... I2C_Write(MPL3115_ADDR_W);
4795 05FE: MOVLW C0
4796 05FF: MOVWF 73
4797 0600: BCF 03.5
4798 0601: CALL 22E
4799 .................... I2C_write(0x26);
4800 0602: MOVLW 26
4801 0603: MOVWF 73
4802 0604: CALL 22E
4803 .................... I2C_write(0xB8);
4804 0605: MOVLW B8
4805 0606: MOVWF 73
4806 0607: CALL 22E
4807 .................... i2c_stop();
4808 0608: BCF 28.4
4809 0609: MOVF 28,W
4810 060A: BSF 03.5
4811 060B: MOVWF 07
4812 060C: NOP
4813 060D: BCF 03.5
4814 060E: BSF 28.3
4815 060F: MOVF 28,W
4816 0610: BSF 03.5
4817 0611: MOVWF 07
4818 0612: BCF 03.5
4819 0613: BTFSS 07.3
4820 0614: GOTO 613
4821 0615: NOP
4822 0616: GOTO 617
4823 0617: NOP
4824 0618: BSF 28.4
4825 0619: MOVF 28,W
4826 061A: BSF 03.5
4827 061B: MOVWF 07
4828 061C: NOP
4829 ....................
4830 .................... i2c_start(); //PT_DATA_CFG set
4831 061D: BCF 03.5
4832 061E: BSF 28.4
4833 061F: MOVF 28,W
4834 0620: BSF 03.5
4835 0621: MOVWF 07
4836 0622: NOP
4837 0623: BCF 03.5
4838 0624: BSF 28.3
4839 0625: MOVF 28,W
4840 0626: BSF 03.5
4841 0627: MOVWF 07
4842 0628: NOP
4843 0629: BCF 03.5
4844 062A: BCF 07.4
4845 062B: BCF 28.4
4846 062C: MOVF 28,W
4847 062D: BSF 03.5
4848 062E: MOVWF 07
4849 062F: NOP
4850 0630: BCF 03.5
4851 0631: BCF 07.3
4852 0632: BCF 28.3
4853 0633: MOVF 28,W
4854 0634: BSF 03.5
4855 0635: MOVWF 07
4856 .................... I2C_Write(MPL3115_ADDR_W);
4857 0636: MOVLW C0
4858 0637: MOVWF 73
4859 0638: BCF 03.5
4860 0639: CALL 22E
4861 .................... I2C_write(0x13);
4862 063A: MOVLW 13
4863 063B: MOVWF 73
4864 063C: CALL 22E
4865 .................... I2C_write(0x07); //hodnota
4866 063D: MOVLW 07
4867 063E: MOVWF 73
4868 063F: CALL 22E
4869 .................... i2c_stop();
4870 0640: BCF 28.4
4871 0641: MOVF 28,W
4872 0642: BSF 03.5
4873 0643: MOVWF 07
4874 0644: NOP
4875 0645: BCF 03.5
4876 0646: BSF 28.3
4877 0647: MOVF 28,W
4878 0648: BSF 03.5
4879 0649: MOVWF 07
4880 064A: BCF 03.5
4881 064B: BTFSS 07.3
4882 064C: GOTO 64B
4883 064D: NOP
4884 064E: GOTO 64F
4885 064F: NOP
4886 0650: BSF 28.4
4887 0651: MOVF 28,W
4888 0652: BSF 03.5
4889 0653: MOVWF 07
4890 0654: NOP
4891 ....................
4892 .................... i2c_start(); //ACTIVE mode
4893 0655: BCF 03.5
4894 0656: BSF 28.4
4895 0657: MOVF 28,W
4896 0658: BSF 03.5
4897 0659: MOVWF 07
4898 065A: NOP
4899 065B: BCF 03.5
4900 065C: BSF 28.3
4901 065D: MOVF 28,W
4902 065E: BSF 03.5
4903 065F: MOVWF 07
4904 0660: NOP
4905 0661: BCF 03.5
4906 0662: BCF 07.4
4907 0663: BCF 28.4
4908 0664: MOVF 28,W
4909 0665: BSF 03.5
4910 0666: MOVWF 07
4911 0667: NOP
4912 0668: BCF 03.5
4913 0669: BCF 07.3
4914 066A: BCF 28.3
4915 066B: MOVF 28,W
4916 066C: BSF 03.5
4917 066D: MOVWF 07
4918 .................... I2C_Write(MPL3115_ADDR_W);
4919 066E: MOVLW C0
4920 066F: MOVWF 73
4921 0670: BCF 03.5
4922 0671: CALL 22E
4923 .................... I2C_write(0x26);
4924 0672: MOVLW 26
4925 0673: MOVWF 73
4926 0674: CALL 22E
4927 .................... I2C_write(0x39);
4928 0675: MOVLW 39
4929 0676: MOVWF 73
4930 0677: CALL 22E
4931 .................... i2c_stop();
4932 0678: BCF 28.4
4933 0679: MOVF 28,W
4934 067A: BSF 03.5
4935 067B: MOVWF 07
4936 067C: NOP
4937 067D: BCF 03.5
4938 067E: BSF 28.3
4939 067F: MOVF 28,W
4940 0680: BSF 03.5
4941 0681: MOVWF 07
4942 0682: BCF 03.5
4943 0683: BTFSS 07.3
4944 0684: GOTO 683
4945 0685: NOP
4946 0686: GOTO 687
4947 0687: NOP
4948 0688: BSF 28.4
4949 0689: MOVF 28,W
4950 068A: BSF 03.5
4951 068B: MOVWF 07
4952 068C: NOP
4953 .................... }
4954 068D: BCF 03.5
4955 068E: BSF 0A.3
4956 068F: BSF 0A.4
4957 0690: GOTO 0BB (RETURN)
4958 ....................
4959 ....................
4960 .................... byte mpl3115_read (byte reg)
4961 .................... {
4962 .................... byte i;
4963 ....................
4964 .................... i2c_start();
4965 0691: BSF 28.4
4966 0692: MOVF 28,W
4967 0693: BSF 03.5
4968 0694: MOVWF 07
4969 0695: NOP
4970 0696: BCF 03.5
4971 0697: BSF 28.3
4972 0698: MOVF 28,W
4973 0699: BSF 03.5
4974 069A: MOVWF 07
4975 069B: NOP
4976 069C: BCF 03.5
4977 069D: BCF 07.4
4978 069E: BCF 28.4
4979 069F: MOVF 28,W
4980 06A0: BSF 03.5
4981 06A1: MOVWF 07
4982 06A2: NOP
4983 06A3: BCF 03.5
4984 06A4: BCF 07.3
4985 06A5: BCF 28.3
4986 06A6: MOVF 28,W
4987 06A7: BSF 03.5
4988 06A8: MOVWF 07
4989 .................... I2C_Write(MPL3115_ADDR_W);
4990 06A9: MOVLW C0
4991 06AA: MOVWF 73
4992 06AB: BCF 03.5
4993 06AC: CALL 22E
4994 .................... I2C_write(reg);
4995 06AD: MOVF 70,W
4996 06AE: MOVWF 73
4997 06AF: CALL 22E
4998 .................... i2c_start();
4999 06B0: BSF 28.4
5000 06B1: MOVF 28,W
5001 06B2: BSF 03.5
5002 06B3: MOVWF 07
5003 06B4: NOP
5004 06B5: BCF 03.5
5005 06B6: BSF 28.3
5006 06B7: MOVF 28,W
5007 06B8: BSF 03.5
5008 06B9: MOVWF 07
5009 06BA: NOP
5010 06BB: BCF 03.5
5011 06BC: BTFSS 07.3
5012 06BD: GOTO 6BC
5013 06BE: BCF 07.4
5014 06BF: BCF 28.4
5015 06C0: MOVF 28,W
5016 06C1: BSF 03.5
5017 06C2: MOVWF 07
5018 06C3: NOP
5019 06C4: BCF 03.5
5020 06C5: BCF 07.3
5021 06C6: BCF 28.3
5022 06C7: MOVF 28,W
5023 06C8: BSF 03.5
5024 06C9: MOVWF 07
5025 .................... I2C_Write(MPL3115_ADDR_R);
5026 06CA: MOVLW C1
5027 06CB: MOVWF 73
5028 06CC: BCF 03.5
5029 06CD: CALL 22E
5030 .................... i=i2c_read(0);
5031 06CE: CLRF 77
5032 06CF: CALL 2B0
5033 06D0: MOVF 78,W
5034 06D1: MOVWF 71
5035 .................... i2c_stop();
5036 06D2: BCF 28.4
5037 06D3: MOVF 28,W
5038 06D4: BSF 03.5
5039 06D5: MOVWF 07
5040 06D6: NOP
5041 06D7: BCF 03.5
5042 06D8: BSF 28.3
5043 06D9: MOVF 28,W
5044 06DA: BSF 03.5
5045 06DB: MOVWF 07
5046 06DC: BCF 03.5
5047 06DD: BTFSS 07.3
5048 06DE: GOTO 6DD
5049 06DF: NOP
5050 06E0: GOTO 6E1
5051 06E1: NOP
5052 06E2: BSF 28.4
5053 06E3: MOVF 28,W
5054 06E4: BSF 03.5
5055 06E5: MOVWF 07
5056 06E6: NOP
5057 ....................
5058 .................... return i;
5059 06E7: MOVF 71,W
5060 06E8: MOVWF 78
5061 .................... }
5062 06E9: BCF 03.5
5063 06EA: RETURN
5064 ....................
5065 ....................
5066 .................... float mpl3115_T (void) //teplota ve stupnich
5067 .................... {
5068 .................... int m;
5069 .................... float l, t;
5070 ....................
5071 .................... m= mpl3115_read (0x04);
5072 06EB: MOVLW 04
5073 06EC: MOVWF 70
5074 06ED: CALL 691
5075 06EE: MOVF 78,W
5076 06EF: MOVWF 60
5077 .................... l= (float)(mpl3115_read(0x05)>>4)/16.0;
5078 06F0: MOVLW 05
5079 06F1: MOVWF 70
5080 06F2: CALL 691
5081 06F3: SWAPF 78,W
5082 06F4: MOVWF 77
5083 06F5: MOVLW 0F
5084 06F6: ANDWF 77,F
5085 06F7: MOVF 77,W
5086 06F8: CLRF 27
5087 06F9: BTFSC 0B.7
5088 06FA: BSF 27.7
5089 06FB: BCF 0B.7
5090 06FC: BSF 03.5
5091 06FD: CLRF 43
5092 06FE: MOVWF 42
5093 06FF: BCF 03.5
5094 0700: CALL 038
5095 0701: BTFSC 27.7
5096 0702: BSF 0B.7
5097 0703: MOVF 77,W
5098 0704: MOVWF 69
5099 0705: MOVF 78,W
5100 0706: MOVWF 6A
5101 0707: MOVF 79,W
5102 0708: MOVWF 6B
5103 0709: MOVF 7A,W
5104 070A: MOVWF 6C
5105 070B: CLRF 27
5106 070C: BTFSC 0B.7
5107 070D: BSF 27.7
5108 070E: BCF 0B.7
5109 070F: MOVF 6C,W
5110 0710: BSF 03.5
5111 0711: MOVWF 45
5112 0712: BCF 03.5
5113 0713: MOVF 6B,W
5114 0714: BSF 03.5
5115 0715: MOVWF 44
5116 0716: BCF 03.5
5117 0717: MOVF 6A,W
5118 0718: BSF 03.5
5119 0719: MOVWF 43
5120 071A: BCF 03.5
5121 071B: MOVF 69,W
5122 071C: BSF 03.5
5123 071D: MOVWF 42
5124 071E: CLRF 49
5125 071F: CLRF 48
5126 0720: CLRF 47
5127 0721: MOVLW 83
5128 0722: MOVWF 46
5129 0723: BCF 03.5
5130 0724: CALL 057
5131 0725: BTFSC 27.7
5132 0726: BSF 0B.7
5133 0727: MOVF 7A,W
5134 0728: MOVWF 64
5135 0729: MOVF 79,W
5136 072A: MOVWF 63
5137 072B: MOVF 78,W
5138 072C: MOVWF 62
5139 072D: MOVF 77,W
5140 072E: MOVWF 61
5141 072F: CLRF 27
5142 0730: BTFSC 0B.7
5143 0731: BSF 27.7
5144 0732: BCF 0B.7
5145 .................... t = (float)(M + L);
5146 0733: BSF 03.5
5147 0734: CLRF 43
5148 0735: BCF 03.5
5149 0736: MOVF 60,W
5150 0737: BSF 03.5
5151 0738: MOVWF 42
5152 0739: BCF 03.5
5153 073A: CALL 038
5154 073B: BTFSC 27.7
5155 073C: BSF 0B.7
5156 073D: BCF 03.1
5157 073E: MOVF 7A,W
5158 073F: BSF 03.5
5159 0740: MOVWF 2C
5160 0741: MOVF 79,W
5161 0742: MOVWF 2B
5162 0743: MOVF 78,W
5163 0744: MOVWF 2A
5164 0745: MOVF 77,W
5165 0746: MOVWF 29
5166 0747: BCF 03.5
5167 0748: MOVF 64,W
5168 0749: BSF 03.5
5169 074A: MOVWF 30
5170 074B: BCF 03.5
5171 074C: MOVF 63,W
5172 074D: BSF 03.5
5173 074E: MOVWF 2F
5174 074F: BCF 03.5
5175 0750: MOVF 62,W
5176 0751: BSF 03.5
5177 0752: MOVWF 2E
5178 0753: BCF 03.5
5179 0754: MOVF 61,W
5180 0755: BSF 03.5
5181 0756: MOVWF 2D
5182 0757: BSF 0A.3
5183 0758: BCF 03.5
5184 0759: CALL 000
5185 075A: BCF 0A.3
5186 075B: MOVF 7A,W
5187 075C: MOVWF 68
5188 075D: MOVF 79,W
5189 075E: MOVWF 67
5190 075F: MOVF 78,W
5191 0760: MOVWF 66
5192 0761: MOVF 77,W
5193 0762: MOVWF 65
5194 .................... return t;
5195 0763: MOVF 65,W
5196 0764: MOVWF 77
5197 0765: MOVF 66,W
5198 0766: MOVWF 78
5199 0767: MOVF 67,W
5200 0768: MOVWF 79
5201 0769: MOVF 68,W
5202 076A: MOVWF 7A
5203 .................... }
5204 076B: BSF 0A.3
5205 076C: BSF 0A.4
5206 076D: GOTO 0CB (RETURN)
5207 ....................
5208 .................... float mpl3115_A (void) //vyska v m
5209 .................... {
5210 ....................
5211 .................... int16 m;
5212 .................... unsigned int8 c;
5213 .................... float l, a;
5214 ....................
5215 .................... m= mpl3115_read (0x01);
5216 *
5217 0ADD: MOVLW 01
5218 0ADE: MOVWF 70
5219 0ADF: BCF 0A.3
5220 0AE0: CALL 691
5221 0AE1: BSF 0A.3
5222 0AE2: CLRF 61
5223 0AE3: MOVF 78,W
5224 0AE4: MOVWF 60
5225 .................... c= mpl3115_read (0x02);
5226 0AE5: MOVLW 02
5227 0AE6: MOVWF 70
5228 0AE7: BCF 0A.3
5229 0AE8: CALL 691
5230 0AE9: BSF 0A.3
5231 0AEA: MOVF 78,W
5232 0AEB: MOVWF 62
5233 .................... l= (float)(mpl3115_read(0x03)>>4)/16.0;
5234 0AEC: MOVLW 03
5235 0AED: MOVWF 70
5236 0AEE: BCF 0A.3
5237 0AEF: CALL 691
5238 0AF0: BSF 0A.3
5239 0AF1: SWAPF 78,W
5240 0AF2: MOVWF 77
5241 0AF3: MOVLW 0F
5242 0AF4: ANDWF 77,F
5243 0AF5: MOVF 77,W
5244 0AF6: CLRF 27
5245 0AF7: BTFSC 0B.7
5246 0AF8: BSF 27.7
5247 0AF9: BCF 0B.7
5248 0AFA: BSF 03.5
5249 0AFB: CLRF 43
5250 0AFC: MOVWF 42
5251 0AFD: BCF 0A.3
5252 0AFE: BCF 03.5
5253 0AFF: CALL 038
5254 0B00: BSF 0A.3
5255 0B01: BTFSC 27.7
5256 0B02: BSF 0B.7
5257 0B03: MOVF 77,W
5258 0B04: MOVWF 6B
5259 0B05: MOVF 78,W
5260 0B06: MOVWF 6C
5261 0B07: MOVF 79,W
5262 0B08: MOVWF 6D
5263 0B09: MOVF 7A,W
5264 0B0A: MOVWF 6E
5265 0B0B: CLRF 27
5266 0B0C: BTFSC 0B.7
5267 0B0D: BSF 27.7
5268 0B0E: BCF 0B.7
5269 0B0F: MOVF 7A,W
5270 0B10: BSF 03.5
5271 0B11: MOVWF 45
5272 0B12: BCF 03.5
5273 0B13: MOVF 79,W
5274 0B14: BSF 03.5
5275 0B15: MOVWF 44
5276 0B16: BCF 03.5
5277 0B17: MOVF 78,W
5278 0B18: BSF 03.5
5279 0B19: MOVWF 43
5280 0B1A: BCF 03.5
5281 0B1B: MOVF 77,W
5282 0B1C: BSF 03.5
5283 0B1D: MOVWF 42
5284 0B1E: CLRF 49
5285 0B1F: CLRF 48
5286 0B20: CLRF 47
5287 0B21: MOVLW 83
5288 0B22: MOVWF 46
5289 0B23: BCF 0A.3
5290 0B24: BCF 03.5
5291 0B25: CALL 057
5292 0B26: BSF 0A.3
5293 0B27: BTFSC 27.7
5294 0B28: BSF 0B.7
5295 0B29: MOVF 7A,W
5296 0B2A: MOVWF 66
5297 0B2B: MOVF 79,W
5298 0B2C: MOVWF 65
5299 0B2D: MOVF 78,W
5300 0B2E: MOVWF 64
5301 0B2F: MOVF 77,W
5302 0B30: MOVWF 63
5303 .................... a = (float)((m << 8)|c) + l;
5304 0B31: MOVF 60,W
5305 0B32: MOVWF 6D
5306 0B33: CLRF 6C
5307 0B34: MOVF 6C,W
5308 0B35: IORWF 62,W
5309 0B36: MOVWF 77
5310 0B37: MOVF 60,W
5311 0B38: MOVWF 7A
5312 0B39: MOVF 77,W
5313 0B3A: CLRF 27
5314 0B3B: BTFSC 0B.7
5315 0B3C: BSF 27.7
5316 0B3D: BCF 0B.7
5317 0B3E: BSF 03.5
5318 0B3F: MOVWF 42
5319 0B40: MOVF 7A,W
5320 0B41: MOVWF 43
5321 0B42: BCF 0A.3
5322 0B43: BCF 03.5
5323 0B44: CALL 038
5324 0B45: BSF 0A.3
5325 0B46: BTFSC 27.7
5326 0B47: BSF 0B.7
5327 0B48: MOVF 77,W
5328 0B49: MOVWF 6C
5329 0B4A: MOVF 78,W
5330 0B4B: MOVWF 6D
5331 0B4C: MOVF 79,W
5332 0B4D: MOVWF 6E
5333 0B4E: MOVF 7A,W
5334 0B4F: MOVWF 6F
5335 0B50: BCF 03.1
5336 0B51: MOVF 7A,W
5337 0B52: BSF 03.5
5338 0B53: MOVWF 2C
5339 0B54: BCF 03.5
5340 0B55: MOVF 79,W
5341 0B56: BSF 03.5
5342 0B57: MOVWF 2B
5343 0B58: BCF 03.5
5344 0B59: MOVF 78,W
5345 0B5A: BSF 03.5
5346 0B5B: MOVWF 2A
5347 0B5C: BCF 03.5
5348 0B5D: MOVF 77,W
5349 0B5E: BSF 03.5
5350 0B5F: MOVWF 29
5351 0B60: BCF 03.5
5352 0B61: MOVF 66,W
5353 0B62: BSF 03.5
5354 0B63: MOVWF 30
5355 0B64: BCF 03.5
5356 0B65: MOVF 65,W
5357 0B66: BSF 03.5
5358 0B67: MOVWF 2F
5359 0B68: BCF 03.5
5360 0B69: MOVF 64,W
5361 0B6A: BSF 03.5
5362 0B6B: MOVWF 2E
5363 0B6C: BCF 03.5
5364 0B6D: MOVF 63,W
5365 0B6E: BSF 03.5
5366 0B6F: MOVWF 2D
5367 0B70: BCF 03.5
5368 0B71: CALL 000
5369 0B72: MOVF 7A,W
5370 0B73: MOVWF 6A
5371 0B74: MOVF 79,W
5372 0B75: MOVWF 69
5373 0B76: MOVF 78,W
5374 0B77: MOVWF 68
5375 0B78: MOVF 77,W
5376 0B79: MOVWF 67
5377 .................... return a;
5378 0B7A: MOVF 67,W
5379 0B7B: MOVWF 77
5380 0B7C: MOVF 68,W
5381 0B7D: MOVWF 78
5382 0B7E: MOVF 69,W
5383 0B7F: MOVWF 79
5384 0B80: MOVF 6A,W
5385 0B81: MOVWF 7A
5386 .................... }
5387 0B82: BSF 0A.3
5388 0B83: BSF 0A.4
5389 0B84: GOTO 0F0 (RETURN)
5390 ....................
5391 ....................
5392 .................... float mpl3115_P (void) //tlak v Pa
5393 .................... {
5394 .................... unsigned int32 m;
5395 .................... unsigned int16 c;
5396 .................... unsigned int8 l,l2;
5397 .................... float p, l1;
5398 ....................
5399 .................... m= mpl3115_read (0x01);
5400 *
5401 0946: MOVLW 01
5402 0947: MOVWF 70
5403 0948: BCF 0A.3
5404 0949: CALL 691
5405 094A: BSF 0A.3
5406 094B: CLRF 63
5407 094C: CLRF 62
5408 094D: CLRF 61
5409 094E: MOVF 78,W
5410 094F: MOVWF 60
5411 .................... c= mpl3115_read (0x02);
5412 0950: MOVLW 02
5413 0951: MOVWF 70
5414 0952: BCF 0A.3
5415 0953: CALL 691
5416 0954: BSF 0A.3
5417 0955: CLRF 65
5418 0956: MOVF 78,W
5419 0957: MOVWF 64
5420 .................... l=mpl3115_read(0x03);
5421 0958: MOVLW 03
5422 0959: MOVWF 70
5423 095A: BCF 0A.3
5424 095B: CALL 691
5425 095C: BSF 0A.3
5426 095D: MOVF 78,W
5427 095E: MOVWF 66
5428 .................... l2=l<<2;
5429 095F: RLF 66,W
5430 0960: MOVWF 67
5431 0961: RLF 67,F
5432 0962: MOVLW FC
5433 0963: ANDWF 67,F
5434 .................... l1= (float)(l>>6)/4.0;
5435 0964: SWAPF 66,W
5436 0965: MOVWF 77
5437 0966: RRF 77,F
5438 0967: RRF 77,F
5439 0968: MOVLW 03
5440 0969: ANDWF 77,F
5441 096A: MOVF 77,W
5442 096B: CLRF 27
5443 096C: BTFSC 0B.7
5444 096D: BSF 27.7
5445 096E: BCF 0B.7
5446 096F: BSF 03.5
5447 0970: CLRF 43
5448 0971: MOVWF 42
5449 0972: BCF 0A.3
5450 0973: BCF 03.5
5451 0974: CALL 038
5452 0975: BSF 0A.3
5453 0976: BTFSC 27.7
5454 0977: BSF 0B.7
5455 0978: MOVF 77,W
5456 0979: MOVWF 71
5457 097A: MOVF 78,W
5458 097B: MOVWF 72
5459 097C: MOVF 79,W
5460 097D: MOVWF 73
5461 097E: MOVF 7A,W
5462 097F: MOVWF 74
5463 0980: CLRF 27
5464 0981: BTFSC 0B.7
5465 0982: BSF 27.7
5466 0983: BCF 0B.7
5467 0984: MOVF 74,W
5468 0985: BSF 03.5
5469 0986: MOVWF 45
5470 0987: MOVF 73,W
5471 0988: MOVWF 44
5472 0989: MOVF 72,W
5473 098A: MOVWF 43
5474 098B: MOVF 71,W
5475 098C: MOVWF 42
5476 098D: CLRF 49
5477 098E: CLRF 48
5478 098F: CLRF 47
5479 0990: MOVLW 81
5480 0991: MOVWF 46
5481 0992: BCF 0A.3
5482 0993: BCF 03.5
5483 0994: CALL 057
5484 0995: BSF 0A.3
5485 0996: BTFSC 27.7
5486 0997: BSF 0B.7
5487 0998: MOVF 7A,W
5488 0999: MOVWF 6F
5489 099A: MOVF 79,W
5490 099B: MOVWF 6E
5491 099C: MOVF 78,W
5492 099D: MOVWF 6D
5493 099E: MOVF 77,W
5494 099F: MOVWF 6C
5495 .................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1;
5496 09A0: CLRF 71
5497 09A1: RLF 60,W
5498 09A2: MOVWF 72
5499 09A3: RLF 61,W
5500 09A4: MOVWF 73
5501 09A5: RLF 62,W
5502 09A6: MOVWF 74
5503 09A7: RLF 72,F
5504 09A8: RLF 73,F
5505 09A9: RLF 74,F
5506 09AA: MOVLW FC
5507 09AB: ANDWF 72,F
5508 09AC: RLF 64,W
5509 09AD: MOVWF 79
5510 09AE: RLF 65,W
5511 09AF: MOVWF 7A
5512 09B0: RLF 79,F
5513 09B1: RLF 7A,F
5514 09B2: MOVLW FC
5515 09B3: ANDWF 79,F
5516 09B4: MOVF 79,W
5517 09B5: IORWF 71,F
5518 09B6: MOVF 7A,W
5519 09B7: IORWF 72,F
5520 09B8: SWAPF 66,W
5521 09B9: MOVWF 77
5522 09BA: RRF 77,F
5523 09BB: RRF 77,F
5524 09BC: MOVLW 03
5525 09BD: ANDWF 77,F
5526 09BE: MOVF 77,W
5527 09BF: IORWF 71,W
5528 09C0: MOVWF 77
5529 09C1: MOVF 72,W
5530 09C2: MOVWF 78
5531 09C3: MOVF 73,W
5532 09C4: MOVWF 79
5533 09C5: MOVF 74,W
5534 09C6: MOVWF 7A
5535 09C7: MOVF 7A,W
5536 09C8: MOVWF 7E
5537 09C9: MOVF 79,W
5538 09CA: MOVWF 7D
5539 09CB: MOVF 78,W
5540 09CC: MOVWF 7C
5541 09CD: MOVF 77,W
5542 09CE: MOVWF 7B
5543 *
5544 09E9: MOVF 77,W
5545 09EA: MOVWF 71
5546 09EB: MOVF 78,W
5547 09EC: MOVWF 72
5548 09ED: MOVF 79,W
5549 09EE: MOVWF 73
5550 09EF: MOVF 7A,W
5551 09F0: MOVWF 74
5552 09F1: BCF 03.1
5553 09F2: MOVF 74,W
5554 09F3: BSF 03.5
5555 09F4: MOVWF 2C
5556 09F5: MOVF 73,W
5557 09F6: MOVWF 2B
5558 09F7: MOVF 72,W
5559 09F8: MOVWF 2A
5560 09F9: MOVF 71,W
5561 09FA: MOVWF 29
5562 09FB: BCF 03.5
5563 09FC: MOVF 6F,W
5564 09FD: BSF 03.5
5565 09FE: MOVWF 30
5566 09FF: BCF 03.5
5567 0A00: MOVF 6E,W
5568 0A01: BSF 03.5
5569 0A02: MOVWF 2F
5570 0A03: BCF 03.5
5571 0A04: MOVF 6D,W
5572 0A05: BSF 03.5
5573 0A06: MOVWF 2E
5574 0A07: BCF 03.5
5575 0A08: MOVF 6C,W
5576 0A09: BSF 03.5
5577 0A0A: MOVWF 2D
5578 0A0B: BCF 03.5
5579 0A0C: CALL 000
5580 0A0D: MOVF 7A,W
5581 0A0E: MOVWF 6B
5582 0A0F: MOVF 79,W
5583 0A10: MOVWF 6A
5584 0A11: MOVF 78,W
5585 0A12: MOVWF 69
5586 0A13: MOVF 77,W
5587 0A14: MOVWF 68
5588 ....................
5589 .................... return p;
5590 0A15: MOVF 68,W
5591 0A16: MOVWF 77
5592 0A17: MOVF 69,W
5593 0A18: MOVWF 78
5594 0A19: MOVF 6A,W
5595 0A1A: MOVWF 79
5596 0A1B: MOVF 6B,W
5597 0A1C: MOVWF 7A
5598 .................... }
5599 0A1D: BSF 0A.3
5600 0A1E: BSF 0A.4
5601 0A1F: GOTO 0D7 (RETURN)
5602 ....................
5603 ....................
5604 ....................
5605 .................... #include "HMC5883L.h"
5606 .................... #define MAG_ADDR_R 0x3D //addresa pro cteni
5607 .................... #define MAG_ADDR_W 0x3C
5608 ....................
5609 ....................
5610 .................... //Konstanty nastavujici rozsah
5611 .................... //pro void set_mag_roz (unsigned int8 h)
5612 .................... #define MAG_ROZ088 0x00
5613 .................... #define MAG_ROZ130 0x20
5614 .................... #define MAG_ROZ190 0x40
5615 .................... #define MAG_ROZ250 0x60
5616 .................... #define MAG_ROZ400 0x80
5617 .................... #define MAG_ROZ470 0xA0
5618 .................... #define MAG_ROZ560 0xC0
5619 .................... #define MAG_ROZ810 0xE0
5620 ....................
5621 ....................
5622 .................... #include "HMC5883L.c"
5623 .................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ
5624 .................... {
5625 .................... i2c_start(); //nastavení Configuration Register A
5626 *
5627 0534: BSF 28.4
5628 0535: MOVF 28,W
5629 0536: BSF 03.5
5630 0537: MOVWF 07
5631 0538: NOP
5632 0539: BCF 03.5
5633 053A: BSF 28.3
5634 053B: MOVF 28,W
5635 053C: BSF 03.5
5636 053D: MOVWF 07
5637 053E: NOP
5638 053F: BCF 03.5
5639 0540: BCF 07.4
5640 0541: BCF 28.4
5641 0542: MOVF 28,W
5642 0543: BSF 03.5
5643 0544: MOVWF 07
5644 0545: NOP
5645 0546: BCF 03.5
5646 0547: BCF 07.3
5647 0548: BCF 28.3
5648 0549: MOVF 28,W
5649 054A: BSF 03.5
5650 054B: MOVWF 07
5651 .................... I2C_Write(MAG_ADDR_W);
5652 054C: MOVLW 3C
5653 054D: MOVWF 73
5654 054E: BCF 03.5
5655 054F: CALL 22E
5656 .................... I2C_Write(0x00);
5657 0550: CLRF 73
5658 0551: CALL 22E
5659 .................... I2C_Write(0x70);
5660 0552: MOVLW 70
5661 0553: MOVWF 73
5662 0554: CALL 22E
5663 .................... i2c_stop();
5664 0555: BCF 28.4
5665 0556: MOVF 28,W
5666 0557: BSF 03.5
5667 0558: MOVWF 07
5668 0559: NOP
5669 055A: BCF 03.5
5670 055B: BSF 28.3
5671 055C: MOVF 28,W
5672 055D: BSF 03.5
5673 055E: MOVWF 07
5674 055F: BCF 03.5
5675 0560: BTFSS 07.3
5676 0561: GOTO 560
5677 0562: NOP
5678 0563: GOTO 564
5679 0564: NOP
5680 0565: BSF 28.4
5681 0566: MOVF 28,W
5682 0567: BSF 03.5
5683 0568: MOVWF 07
5684 0569: NOP
5685 .................... Delay_ms(6);
5686 056A: MOVLW 06
5687 056B: BCF 03.5
5688 056C: MOVWF 65
5689 056D: CALL 2F5
5690 ....................
5691 .................... i2c_start(); //nastavení Configuration Register B
5692 056E: BSF 28.4
5693 056F: MOVF 28,W
5694 0570: BSF 03.5
5695 0571: MOVWF 07
5696 0572: NOP
5697 0573: BCF 03.5
5698 0574: BSF 28.3
5699 0575: MOVF 28,W
5700 0576: BSF 03.5
5701 0577: MOVWF 07
5702 0578: NOP
5703 0579: BCF 03.5
5704 057A: BCF 07.4
5705 057B: BCF 28.4
5706 057C: MOVF 28,W
5707 057D: BSF 03.5
5708 057E: MOVWF 07
5709 057F: NOP
5710 0580: BCF 03.5
5711 0581: BCF 07.3
5712 0582: BCF 28.3
5713 0583: MOVF 28,W
5714 0584: BSF 03.5
5715 0585: MOVWF 07
5716 .................... I2C_Write(MAG_ADDR_W);
5717 0586: MOVLW 3C
5718 0587: MOVWF 73
5719 0588: BCF 03.5
5720 0589: CALL 22E
5721 .................... I2C_Write(0x01);
5722 058A: MOVLW 01
5723 058B: MOVWF 73
5724 058C: CALL 22E
5725 .................... I2C_Write(MAG_ROZ810);
5726 058D: MOVLW E0
5727 058E: MOVWF 73
5728 058F: CALL 22E
5729 .................... i2c_stop();
5730 0590: BCF 28.4
5731 0591: MOVF 28,W
5732 0592: BSF 03.5
5733 0593: MOVWF 07
5734 0594: NOP
5735 0595: BCF 03.5
5736 0596: BSF 28.3
5737 0597: MOVF 28,W
5738 0598: BSF 03.5
5739 0599: MOVWF 07
5740 059A: BCF 03.5
5741 059B: BTFSS 07.3
5742 059C: GOTO 59B
5743 059D: NOP
5744 059E: GOTO 59F
5745 059F: NOP
5746 05A0: BSF 28.4
5747 05A1: MOVF 28,W
5748 05A2: BSF 03.5
5749 05A3: MOVWF 07
5750 05A4: NOP
5751 ....................
5752 .................... Delay_ms(6);
5753 05A5: MOVLW 06
5754 05A6: BCF 03.5
5755 05A7: MOVWF 65
5756 05A8: CALL 2F5
5757 ....................
5758 .................... i2c_start(); //nastveni Mode Register
5759 05A9: BSF 28.4
5760 05AA: MOVF 28,W
5761 05AB: BSF 03.5
5762 05AC: MOVWF 07
5763 05AD: NOP
5764 05AE: BCF 03.5
5765 05AF: BSF 28.3
5766 05B0: MOVF 28,W
5767 05B1: BSF 03.5
5768 05B2: MOVWF 07
5769 05B3: NOP
5770 05B4: BCF 03.5
5771 05B5: BCF 07.4
5772 05B6: BCF 28.4
5773 05B7: MOVF 28,W
5774 05B8: BSF 03.5
5775 05B9: MOVWF 07
5776 05BA: NOP
5777 05BB: BCF 03.5
5778 05BC: BCF 07.3
5779 05BD: BCF 28.3
5780 05BE: MOVF 28,W
5781 05BF: BSF 03.5
5782 05C0: MOVWF 07
5783 .................... I2C_Write(MAG_ADDR_W);
5784 05C1: MOVLW 3C
5785 05C2: MOVWF 73
5786 05C3: BCF 03.5
5787 05C4: CALL 22E
5788 .................... I2C_Write(0x02);
5789 05C5: MOVLW 02
5790 05C6: MOVWF 73
5791 05C7: CALL 22E
5792 .................... I2C_Write(0x00);
5793 05C8: CLRF 73
5794 05C9: CALL 22E
5795 .................... i2c_stop();
5796 05CA: BCF 28.4
5797 05CB: MOVF 28,W
5798 05CC: BSF 03.5
5799 05CD: MOVWF 07
5800 05CE: NOP
5801 05CF: BCF 03.5
5802 05D0: BSF 28.3
5803 05D1: MOVF 28,W
5804 05D2: BSF 03.5
5805 05D3: MOVWF 07
5806 05D4: BCF 03.5
5807 05D5: BTFSS 07.3
5808 05D6: GOTO 5D5
5809 05D7: NOP
5810 05D8: GOTO 5D9
5811 05D9: NOP
5812 05DA: BSF 28.4
5813 05DB: MOVF 28,W
5814 05DC: BSF 03.5
5815 05DD: MOVWF 07
5816 05DE: NOP
5817 .................... Delay_ms(6);
5818 05DF: MOVLW 06
5819 05E0: BCF 03.5
5820 05E1: MOVWF 65
5821 05E2: CALL 2F5
5822 .................... }
5823 05E3: BSF 0A.3
5824 05E4: BSF 0A.4
5825 05E5: GOTO 0AB (RETURN)
5826 ....................
5827 .................... void set_mag_roz (unsigned int8 h) //nastavy rozsah
5828 .................... {
5829 ....................
5830 .................... //
5831 ....................
5832 ....................
5833 .................... i2c_start();
5834 .................... I2C_Write(MAG_ADDR_W);
5835 .................... I2C_Write(0x01);
5836 .................... I2C_Write(h);
5837 .................... i2c_stop();
5838 ....................
5839 .................... Delay_ms(6);
5840 ....................
5841 ....................
5842 .................... }
5843 ....................
5844 ....................
5845 .................... byte mag_read(byte reg) //pro cteni reg
5846 .................... {
5847 ....................
5848 .................... i2c_start();
5849 *
5850 0D6C: BSF 28.4
5851 0D6D: MOVF 28,W
5852 0D6E: BSF 03.5
5853 0D6F: MOVWF 07
5854 0D70: NOP
5855 0D71: BCF 03.5
5856 0D72: BSF 28.3
5857 0D73: MOVF 28,W
5858 0D74: BSF 03.5
5859 0D75: MOVWF 07
5860 0D76: NOP
5861 0D77: BCF 03.5
5862 0D78: BCF 07.4
5863 0D79: BCF 28.4
5864 0D7A: MOVF 28,W
5865 0D7B: BSF 03.5
5866 0D7C: MOVWF 07
5867 0D7D: NOP
5868 0D7E: BCF 03.5
5869 0D7F: BCF 07.3
5870 0D80: BCF 28.3
5871 0D81: MOVF 28,W
5872 0D82: BSF 03.5
5873 0D83: MOVWF 07
5874 .................... I2C_Write(MAG_ADDR_W);
5875 0D84: MOVLW 3C
5876 0D85: MOVWF 73
5877 0D86: BCF 0A.3
5878 0D87: BCF 03.5
5879 0D88: CALL 22E
5880 0D89: BSF 0A.3
5881 .................... I2C_write(reg);
5882 0D8A: MOVF 72,W
5883 0D8B: MOVWF 73
5884 0D8C: BCF 0A.3
5885 0D8D: CALL 22E
5886 0D8E: BSF 0A.3
5887 .................... i2c_stop();
5888 0D8F: BCF 28.4
5889 0D90: MOVF 28,W
5890 0D91: BSF 03.5
5891 0D92: MOVWF 07
5892 0D93: NOP
5893 0D94: BCF 03.5
5894 0D95: BSF 28.3
5895 0D96: MOVF 28,W
5896 0D97: BSF 03.5
5897 0D98: MOVWF 07
5898 0D99: BCF 03.5
5899 0D9A: BTFSS 07.3
5900 0D9B: GOTO 59A
5901 0D9C: NOP
5902 0D9D: GOTO 59E
5903 0D9E: NOP
5904 0D9F: BSF 28.4
5905 0DA0: MOVF 28,W
5906 0DA1: BSF 03.5
5907 0DA2: MOVWF 07
5908 0DA3: NOP
5909 .................... i2c_start();
5910 0DA4: BCF 03.5
5911 0DA5: BSF 28.4
5912 0DA6: MOVF 28,W
5913 0DA7: BSF 03.5
5914 0DA8: MOVWF 07
5915 0DA9: NOP
5916 0DAA: BCF 03.5
5917 0DAB: BSF 28.3
5918 0DAC: MOVF 28,W
5919 0DAD: BSF 03.5
5920 0DAE: MOVWF 07
5921 0DAF: NOP
5922 0DB0: BCF 03.5
5923 0DB1: BCF 07.4
5924 0DB2: BCF 28.4
5925 0DB3: MOVF 28,W
5926 0DB4: BSF 03.5
5927 0DB5: MOVWF 07
5928 0DB6: NOP
5929 0DB7: BCF 03.5
5930 0DB8: BCF 07.3
5931 0DB9: BCF 28.3
5932 0DBA: MOVF 28,W
5933 0DBB: BSF 03.5
5934 0DBC: MOVWF 07
5935 .................... I2C_Write(MAG_ADDR_R);
5936 0DBD: MOVLW 3D
5937 0DBE: MOVWF 73
5938 0DBF: BCF 0A.3
5939 0DC0: BCF 03.5
5940 0DC1: CALL 22E
5941 0DC2: BSF 0A.3
5942 .................... reg=i2c_read(0);
5943 0DC3: CLRF 77
5944 0DC4: BCF 0A.3
5945 0DC5: CALL 2B0
5946 0DC6: BSF 0A.3
5947 0DC7: MOVF 78,W
5948 0DC8: MOVWF 72
5949 .................... return reg;
5950 0DC9: MOVF 72,W
5951 0DCA: MOVWF 78
5952 .................... }
5953 0DCB: RETURN
5954 ....................
5955 ....................
5956 .................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo
5957 .................... {
5958 .................... signed int16 x;
5959 .................... x = (((unsigned int16) h << 8) + l );
5960 *
5961 07E5: CLRF 7C
5962 07E6: MOVF 72,W
5963 07E7: MOVWF 7B
5964 07E8: MOVWF 7C
5965 07E9: CLRF 7B
5966 07EA: MOVF 73,W
5967 07EB: ADDWF 7B,W
5968 07EC: MOVWF 74
5969 07ED: MOVF 7C,W
5970 07EE: MOVWF 75
5971 07EF: BTFSC 03.0
5972 07F0: INCF 75,F
5973 .................... return x;
5974 07F1: MOVF 74,W
5975 07F2: MOVWF 78
5976 07F3: MOVF 75,W
5977 07F4: MOVWF 79
5978 .................... }
5979 07F5: RETURN
5980 ....................
5981 ....................
5982 .................... signed int16 mag_readX(void) //nacteni osy x
5983 .................... {
5984 .................... unsigned int8 h,l;
5985 .................... signed int16 x;
5986 .................... h=mag_read(0x03);
5987 *
5988 1000: MOVLW 03
5989 1001: MOVWF 72
5990 1002: BCF 0A.4
5991 1003: BSF 0A.3
5992 1004: CALL 56C
5993 1005: BSF 0A.4
5994 1006: BCF 0A.3
5995 1007: MOVF 78,W
5996 1008: MOVWF 6E
5997 .................... l=mag_read(0x04);
5998 1009: MOVLW 04
5999 100A: MOVWF 72
6000 100B: BCF 0A.4
6001 100C: BSF 0A.3
6002 100D: CALL 56C
6003 100E: BSF 0A.4
6004 100F: BCF 0A.3
6005 1010: MOVF 78,W
6006 1011: MOVWF 6F
6007 .................... x=mag_vypocet(h,l);
6008 1012: MOVF 6E,W
6009 1013: MOVWF 72
6010 1014: MOVF 6F,W
6011 1015: MOVWF 73
6012 1016: BCF 0A.4
6013 1017: CALL 7E5
6014 1018: BSF 0A.4
6015 1019: MOVF 79,W
6016 101A: MOVWF 71
6017 101B: MOVF 78,W
6018 101C: MOVWF 70
6019 .................... return x;
6020 101D: MOVF 70,W
6021 101E: MOVWF 78
6022 101F: MOVF 71,W
6023 1020: MOVWF 79
6024 ....................
6025 .................... }
6026 ....................
6027 ....................
6028 .................... signed int16 mag_readY(void) //nacteni osy x
6029 .................... {
6030 .................... unsigned int8 h,l;
6031 .................... signed int16 x;
6032 .................... h=mag_read(0x07);
6033 *
6034 1025: MOVLW 07
6035 1026: MOVWF 72
6036 1027: BCF 0A.4
6037 1028: BSF 0A.3
6038 1029: CALL 56C
6039 102A: BSF 0A.4
6040 102B: BCF 0A.3
6041 102C: MOVF 78,W
6042 102D: MOVWF 6E
6043 .................... l=mag_read(0x08);
6044 102E: MOVLW 08
6045 102F: MOVWF 72
6046 1030: BCF 0A.4
6047 1031: BSF 0A.3
6048 1032: CALL 56C
6049 1033: BSF 0A.4
6050 1034: BCF 0A.3
6051 1035: MOVF 78,W
6052 1036: MOVWF 6F
6053 .................... x=mag_vypocet(h,l);
6054 1037: MOVF 6E,W
6055 1038: MOVWF 72
6056 1039: MOVF 6F,W
6057 103A: MOVWF 73
6058 103B: BCF 0A.4
6059 103C: CALL 7E5
6060 103D: BSF 0A.4
6061 103E: MOVF 79,W
6062 103F: MOVWF 71
6063 1040: MOVF 78,W
6064 1041: MOVWF 70
6065 .................... return x;
6066 1042: MOVF 70,W
6067 1043: MOVWF 78
6068 1044: MOVF 71,W
6069 1045: MOVWF 79
6070 ....................
6071 .................... }
6072 ....................
6073 ....................
6074 .................... signed int16 mag_readZ(void) //nacteni osy x
6075 .................... {
6076 .................... unsigned int8 h,l;
6077 .................... signed int16 x;
6078 .................... h=mag_read(0x05);
6079 *
6080 104A: MOVLW 05
6081 104B: MOVWF 72
6082 104C: BCF 0A.4
6083 104D: BSF 0A.3
6084 104E: CALL 56C
6085 104F: BSF 0A.4
6086 1050: BCF 0A.3
6087 1051: MOVF 78,W
6088 1052: MOVWF 6E
6089 .................... l=mag_read(0x06);
6090 1053: MOVLW 06
6091 1054: MOVWF 72
6092 1055: BCF 0A.4
6093 1056: BSF 0A.3
6094 1057: CALL 56C
6095 1058: BSF 0A.4
6096 1059: BCF 0A.3
6097 105A: MOVF 78,W
6098 105B: MOVWF 6F
6099 .................... x=mag_vypocet(h,l);
6100 105C: MOVF 6E,W
6101 105D: MOVWF 72
6102 105E: MOVF 6F,W
6103 105F: MOVWF 73
6104 1060: BCF 0A.4
6105 1061: CALL 7E5
6106 1062: BSF 0A.4
6107 1063: MOVF 79,W
6108 1064: MOVWF 71
6109 1065: MOVF 78,W
6110 1066: MOVWF 70
6111 .................... return x;
6112 1067: MOVF 70,W
6113 1068: MOVWF 78
6114 1069: MOVF 71,W
6115 106A: MOVWF 79
6116 ....................
6117 .................... }
6118 ....................
6119 ....................
6120 ....................
6121 ....................
6122 ....................
6123 ....................
6124 .................... #define SEND_DELAY 50 // Cas mezi dvema znaky na RS232
6125 ....................
6126 .................... char VER[4]=VERSION;
6127 *
6128 1827: MOVLW 30
6129 1828: MOVWF 2B
6130 1829: MOVLW 2E
6131 182A: MOVWF 2C
6132 182B: MOVLW 31
6133 182C: MOVWF 2D
6134 182D: CLRF 2E
6135 ....................
6136 .................... unsigned int16 timer0_overflow_count;
6137 .................... float anemo=0;
6138 ....................
6139 ....................
6140 ....................
6141 .................... #int_TIMER1
6142 .................... void TIMER1_isr(void)
6143 .................... {
6144 .................... // 32.768 kHz krystal pro timer1 oscilátor
6145 .................... anemo = ((timer0_overflow_count * 0xFF) + get_timer0())/(32768.0/0xFFFF); // pocet pulzu za 1s
6146 *
6147 0123: MOVF 30,W
6148 0124: BSF 03.5
6149 0125: MOVWF 41
6150 0126: BCF 03.5
6151 0127: MOVF 2F,W
6152 0128: BSF 03.5
6153 0129: MOVWF 40
6154 012A: CLRF 43
6155 012B: MOVLW FF
6156 012C: MOVWF 42
6157 *
6158 0141: MOVF 79,W
6159 0142: MOVWF 41
6160 0143: MOVF 78,W
6161 0144: MOVWF 40
6162 0145: BCF 03.5
6163 0146: MOVF 01,W
6164 0147: BSF 03.5
6165 0148: ADDWF 40,F
6166 0149: BTFSC 03.0
6167 014A: INCF 41,F
6168 014B: MOVF 41,W
6169 014C: MOVWF 43
6170 014D: MOVF 40,W
6171 014E: MOVWF 42
6172 014F: BCF 03.5
6173 0150: CALL 038
6174 0151: MOVF 7A,W
6175 0152: BSF 03.5
6176 0153: MOVWF 45
6177 0154: MOVF 79,W
6178 0155: MOVWF 44
6179 0156: MOVF 78,W
6180 0157: MOVWF 43
6181 0158: MOVF 77,W
6182 0159: MOVWF 42
6183 015A: MOVLW 80
6184 015B: MOVWF 49
6185 015C: CLRF 48
6186 015D: CLRF 47
6187 015E: MOVLW 7E
6188 015F: MOVWF 46
6189 0160: BCF 03.5
6190 0161: CALL 057
6191 0162: MOVF 7A,W
6192 0163: MOVWF 34
6193 0164: MOVF 79,W
6194 0165: MOVWF 33
6195 0166: MOVF 78,W
6196 0167: MOVWF 32
6197 0168: MOVF 77,W
6198 0169: MOVWF 31
6199 .................... anemo = anemo / 2; //pocet otacek za sekundu
6200 016A: MOVF 34,W
6201 016B: BSF 03.5
6202 016C: MOVWF 45
6203 016D: BCF 03.5
6204 016E: MOVF 33,W
6205 016F: BSF 03.5
6206 0170: MOVWF 44
6207 0171: BCF 03.5
6208 0172: MOVF 32,W
6209 0173: BSF 03.5
6210 0174: MOVWF 43
6211 0175: BCF 03.5
6212 0176: MOVF 31,W
6213 0177: BSF 03.5
6214 0178: MOVWF 42
6215 0179: CLRF 49
6216 017A: CLRF 48
6217 017B: CLRF 47
6218 017C: MOVLW 80
6219 017D: MOVWF 46
6220 017E: BCF 03.5
6221 017F: CALL 057
6222 0180: MOVF 7A,W
6223 0181: MOVWF 34
6224 0182: MOVF 79,W
6225 0183: MOVWF 33
6226 0184: MOVF 78,W
6227 0185: MOVWF 32
6228 0186: MOVF 77,W
6229 0187: MOVWF 31
6230 ....................
6231 .................... timer0_overflow_count=0; //nulovani
6232 0188: CLRF 30
6233 0189: CLRF 2F
6234 .................... set_timer0(0);
6235 018A: CLRF 01
6236 .................... set_timer1(0);
6237 018B: CLRF 0F
6238 018C: CLRF 0E
6239 ....................
6240 .................... }
6241 ....................
6242 018D: BCF 0C.0
6243 018E: BCF 0A.3
6244 018F: BCF 0A.4
6245 0190: GOTO 021
6246 .................... #int_TIMER0 //pro preteceni èítaèe pùlzù od anemometru (RA4)
6247 .................... void TIMER0_isr(void)
6248 .................... {
6249 .................... timer0_overflow_count++;
6250 0191: INCF 2F,F
6251 0192: BTFSC 03.2
6252 0193: INCF 30,F
6253 .................... }
6254 ....................
6255 ....................
6256 0194: BCF 0B.2
6257 0195: BCF 0A.3
6258 0196: BCF 0A.4
6259 0197: GOTO 021
6260 .................... float azimut (void) //vypocet azimutu smeru vetru
6261 .................... {
6262 .................... signed int16 X,Y,Z;
6263 .................... X= mag_readX();
6264 *
6265 1021: MOVF 79,W
6266 1022: MOVWF 61
6267 1023: MOVF 78,W
6268 1024: MOVWF 60
6269 .................... Y= mag_readY();
6270 *
6271 1046: MOVF 79,W
6272 1047: MOVWF 63
6273 1048: MOVF 78,W
6274 1049: MOVWF 62
6275 .................... Z= mag_readZ();
6276 *
6277 106B: MOVF 79,W
6278 106C: MOVWF 65
6279 106D: MOVF 78,W
6280 106E: MOVWF 64
6281 ....................
6282 .................... float a, b;
6283 .................... a=(float)Y/X;
6284 106F: MOVF 63,W
6285 1070: MOVWF 73
6286 1071: MOVF 62,W
6287 1072: MOVWF 72
6288 1073: BCF 0A.4
6289 1074: BSF 0A.3
6290 1075: CALL 5CC
6291 1076: BSF 0A.4
6292 1077: BCF 0A.3
6293 1078: MOVF 77,W
6294 1079: MOVWF 6E
6295 107A: MOVF 78,W
6296 107B: MOVWF 6F
6297 107C: MOVF 79,W
6298 107D: MOVWF 70
6299 107E: MOVF 7A,W
6300 107F: MOVWF 71
6301 1080: MOVF 61,W
6302 1081: MOVWF 73
6303 1082: MOVF 60,W
6304 1083: MOVWF 72
6305 1084: BCF 0A.4
6306 1085: BSF 0A.3
6307 1086: CALL 5CC
6308 1087: BSF 0A.4
6309 1088: BCF 0A.3
6310 1089: CLRF 27
6311 108A: BTFSC 0B.7
6312 108B: BSF 27.7
6313 108C: BCF 0B.7
6314 108D: MOVF 71,W
6315 108E: BSF 03.5
6316 108F: MOVWF 45
6317 1090: MOVF 70,W
6318 1091: MOVWF 44
6319 1092: BCF 03.5
6320 1093: MOVF 6F,W
6321 1094: BSF 03.5
6322 1095: MOVWF 43
6323 1096: BCF 03.5
6324 1097: MOVF 6E,W
6325 1098: BSF 03.5
6326 1099: MOVWF 42
6327 109A: MOVF 7A,W
6328 109B: MOVWF 49
6329 109C: MOVF 79,W
6330 109D: MOVWF 48
6331 109E: MOVF 78,W
6332 109F: MOVWF 47
6333 10A0: MOVF 77,W
6334 10A1: MOVWF 46
6335 10A2: BCF 0A.4
6336 10A3: BCF 03.5
6337 10A4: CALL 057
6338 10A5: BSF 0A.4
6339 10A6: BTFSC 27.7
6340 10A7: BSF 0B.7
6341 10A8: MOVF 7A,W
6342 10A9: MOVWF 69
6343 10AA: MOVF 79,W
6344 10AB: MOVWF 68
6345 10AC: MOVF 78,W
6346 10AD: MOVWF 67
6347 10AE: MOVF 77,W
6348 10AF: MOVWF 66
6349 .................... b=atan(a);
6350 10B0: MOVF 69,W
6351 10B1: MOVWF 71
6352 10B2: MOVF 68,W
6353 10B3: MOVWF 70
6354 10B4: MOVF 67,W
6355 10B5: MOVWF 6F
6356 10B6: MOVF 66,W
6357 10B7: MOVWF 6E
6358 *
6359 139A: MOVF 7A,W
6360 139B: MOVWF 6D
6361 139C: MOVF 79,W
6362 139D: MOVWF 6C
6363 139E: MOVF 78,W
6364 139F: MOVWF 6B
6365 13A0: MOVF 77,W
6366 13A1: MOVWF 6A
6367 13A2: CLRF 27
6368 13A3: BTFSC 0B.7
6369 13A4: BSF 27.7
6370 13A5: BCF 0B.7
6371 .................... b = (b/3.14)*180;
6372 13A6: MOVF 6D,W
6373 13A7: BSF 03.5
6374 13A8: MOVWF 45
6375 13A9: BCF 03.5
6376 13AA: MOVF 6C,W
6377 13AB: BSF 03.5
6378 13AC: MOVWF 44
6379 13AD: BCF 03.5
6380 13AE: MOVF 6B,W
6381 13AF: BSF 03.5
6382 13B0: MOVWF 43
6383 13B1: BCF 03.5
6384 13B2: MOVF 6A,W
6385 13B3: BSF 03.5
6386 13B4: MOVWF 42
6387 13B5: MOVLW C3
6388 13B6: MOVWF 49
6389 13B7: MOVLW F5
6390 13B8: MOVWF 48
6391 13B9: MOVLW 48
6392 13BA: MOVWF 47
6393 13BB: MOVLW 80
6394 13BC: MOVWF 46
6395 13BD: BCF 0A.4
6396 13BE: BCF 03.5
6397 13BF: CALL 057
6398 13C0: BSF 0A.4
6399 13C1: BTFSC 27.7
6400 13C2: BSF 0B.7
6401 13C3: MOVF 77,W
6402 13C4: MOVWF 6E
6403 13C5: MOVF 78,W
6404 13C6: MOVWF 6F
6405 13C7: MOVF 79,W
6406 13C8: MOVWF 70
6407 13C9: MOVF 7A,W
6408 13CA: MOVWF 71
6409 13CB: BSF 03.5
6410 13CC: MOVWF 2C
6411 13CD: MOVF 70,W
6412 13CE: MOVWF 2B
6413 13CF: BCF 03.5
6414 13D0: MOVF 6F,W
6415 13D1: BSF 03.5
6416 13D2: MOVWF 2A
6417 13D3: BCF 03.5
6418 13D4: MOVF 6E,W
6419 13D5: BSF 03.5
6420 13D6: MOVWF 29
6421 13D7: CLRF 30
6422 13D8: CLRF 2F
6423 13D9: MOVLW 34
6424 13DA: MOVWF 2E
6425 13DB: MOVLW 86
6426 13DC: MOVWF 2D
6427 13DD: BCF 0A.4
6428 13DE: BCF 03.5
6429 13DF: CALL 76E
6430 13E0: BSF 0A.4
6431 13E1: MOVF 7A,W
6432 13E2: MOVWF 6D
6433 13E3: MOVF 79,W
6434 13E4: MOVWF 6C
6435 13E5: MOVF 78,W
6436 13E6: MOVWF 6B
6437 13E7: MOVF 77,W
6438 13E8: MOVWF 6A
6439 .................... b=abs(b);
6440 13E9: MOVF 6A,W
6441 13EA: MOVWF 77
6442 13EB: MOVF 6B,W
6443 13EC: MOVWF 78
6444 13ED: MOVF 6C,W
6445 13EE: MOVWF 79
6446 13EF: MOVF 6D,W
6447 13F0: MOVWF 7A
6448 13F1: BCF 78.7
6449 13F2: MOVF 6D,W
6450 13F3: MOVWF 6D
6451 13F4: MOVF 6C,W
6452 13F5: MOVWF 6C
6453 13F6: MOVF 78,W
6454 13F7: MOVWF 6B
6455 13F8: MOVF 6A,W
6456 13F9: MOVWF 6A
6457 ....................
6458 .................... if(X==0) //osetreni proti deleni 0
6459 13FA: MOVF 60,F
6460 13FB: BTFSS 03.2
6461 13FC: GOTO 417
6462 13FD: MOVF 61,F
6463 13FE: BTFSS 03.2
6464 13FF: GOTO 417
6465 .................... {
6466 .................... if(Y>0)
6467 1400: BTFSC 63.7
6468 1401: GOTO 410
6469 1402: MOVF 63,F
6470 1403: BTFSS 03.2
6471 1404: GOTO 409
6472 1405: MOVF 62,W
6473 1406: SUBLW 00
6474 1407: BTFSC 03.0
6475 1408: GOTO 410
6476 .................... {
6477 .................... b=90;
6478 1409: CLRF 6D
6479 140A: CLRF 6C
6480 140B: MOVLW 34
6481 140C: MOVWF 6B
6482 140D: MOVLW 85
6483 140E: MOVWF 6A
6484 .................... }
6485 .................... else
6486 140F: GOTO 416
6487 .................... {
6488 .................... b=270;
6489 1410: CLRF 6D
6490 1411: CLRF 6C
6491 1412: MOVLW 07
6492 1413: MOVWF 6B
6493 1414: MOVLW 87
6494 1415: MOVWF 6A
6495 .................... }
6496 .................... }
6497 .................... else
6498 1416: GOTO 499
6499 .................... {
6500 .................... if(X>0)
6501 1417: BTFSC 61.7
6502 1418: GOTO 470
6503 1419: MOVF 61,F
6504 141A: BTFSS 03.2
6505 141B: GOTO 420
6506 141C: MOVF 60,W
6507 141D: SUBLW 00
6508 141E: BTFSC 03.0
6509 141F: GOTO 470
6510 .................... {
6511 .................... if(Y>=0)
6512 1420: BTFSC 63.7
6513 1421: GOTO 449
6514 .................... {
6515 .................... b=180+b;
6516 1422: BCF 03.1
6517 1423: BSF 03.5
6518 1424: CLRF 2C
6519 1425: CLRF 2B
6520 1426: MOVLW 34
6521 1427: MOVWF 2A
6522 1428: MOVLW 86
6523 1429: MOVWF 29
6524 142A: BCF 03.5
6525 142B: MOVF 6D,W
6526 142C: BSF 03.5
6527 142D: MOVWF 30
6528 142E: BCF 03.5
6529 142F: MOVF 6C,W
6530 1430: BSF 03.5
6531 1431: MOVWF 2F
6532 1432: BCF 03.5
6533 1433: MOVF 6B,W
6534 1434: BSF 03.5
6535 1435: MOVWF 2E
6536 1436: BCF 03.5
6537 1437: MOVF 6A,W
6538 1438: BSF 03.5
6539 1439: MOVWF 2D
6540 143A: BCF 0A.4
6541 143B: BSF 0A.3
6542 143C: BCF 03.5
6543 143D: CALL 000
6544 143E: BSF 0A.4
6545 143F: BCF 0A.3
6546 1440: MOVF 7A,W
6547 1441: MOVWF 6D
6548 1442: MOVF 79,W
6549 1443: MOVWF 6C
6550 1444: MOVF 78,W
6551 1445: MOVWF 6B
6552 1446: MOVF 77,W
6553 1447: MOVWF 6A
6554 ....................
6555 .................... }
6556 .................... else
6557 1448: GOTO 46F
6558 .................... {
6559 .................... b=180-b;
6560 1449: BSF 03.1
6561 144A: BSF 03.5
6562 144B: CLRF 2C
6563 144C: CLRF 2B
6564 144D: MOVLW 34
6565 144E: MOVWF 2A
6566 144F: MOVLW 86
6567 1450: MOVWF 29
6568 1451: BCF 03.5
6569 1452: MOVF 6D,W
6570 1453: BSF 03.5
6571 1454: MOVWF 30
6572 1455: BCF 03.5
6573 1456: MOVF 6C,W
6574 1457: BSF 03.5
6575 1458: MOVWF 2F
6576 1459: BCF 03.5
6577 145A: MOVF 6B,W
6578 145B: BSF 03.5
6579 145C: MOVWF 2E
6580 145D: BCF 03.5
6581 145E: MOVF 6A,W
6582 145F: BSF 03.5
6583 1460: MOVWF 2D
6584 1461: BCF 0A.4
6585 1462: BSF 0A.3
6586 1463: BCF 03.5
6587 1464: CALL 000
6588 1465: BSF 0A.4
6589 1466: BCF 0A.3
6590 1467: MOVF 7A,W
6591 1468: MOVWF 6D
6592 1469: MOVF 79,W
6593 146A: MOVWF 6C
6594 146B: MOVF 78,W
6595 146C: MOVWF 6B
6596 146D: MOVF 77,W
6597 146E: MOVWF 6A
6598 ....................
6599 .................... }
6600 .................... }
6601 .................... else
6602 146F: GOTO 499
6603 .................... {
6604 .................... if(Y>=0)
6605 1470: BTFSC 63.7
6606 1471: GOTO 499
6607 .................... {
6608 .................... b=360-b;
6609 1472: BSF 03.1
6610 1473: BSF 03.5
6611 1474: CLRF 2C
6612 1475: CLRF 2B
6613 1476: MOVLW 34
6614 1477: MOVWF 2A
6615 1478: MOVLW 87
6616 1479: MOVWF 29
6617 147A: BCF 03.5
6618 147B: MOVF 6D,W
6619 147C: BSF 03.5
6620 147D: MOVWF 30
6621 147E: BCF 03.5
6622 147F: MOVF 6C,W
6623 1480: BSF 03.5
6624 1481: MOVWF 2F
6625 1482: BCF 03.5
6626 1483: MOVF 6B,W
6627 1484: BSF 03.5
6628 1485: MOVWF 2E
6629 1486: BCF 03.5
6630 1487: MOVF 6A,W
6631 1488: BSF 03.5
6632 1489: MOVWF 2D
6633 148A: BCF 0A.4
6634 148B: BSF 0A.3
6635 148C: BCF 03.5
6636 148D: CALL 000
6637 148E: BSF 0A.4
6638 148F: BCF 0A.3
6639 1490: MOVF 7A,W
6640 1491: MOVWF 6D
6641 1492: MOVF 79,W
6642 1493: MOVWF 6C
6643 1494: MOVF 78,W
6644 1495: MOVWF 6B
6645 1496: MOVF 77,W
6646 1497: MOVWF 6A
6647 ....................
6648 .................... }
6649 .................... else
6650 1498: GOTO 499
6651 .................... {
6652 .................... b=b;
6653 ....................
6654 .................... }
6655 .................... }
6656 ....................
6657 .................... }
6658 ....................
6659 .................... return b;
6660 1499: MOVF 6A,W
6661 149A: MOVWF 77
6662 149B: MOVF 6B,W
6663 149C: MOVWF 78
6664 149D: MOVF 6C,W
6665 149E: MOVWF 79
6666 149F: MOVF 6D,W
6667 14A0: MOVWF 7A
6668 ....................
6669 .................... }
6670 14A1: BSF 0A.3
6671 14A2: BSF 0A.4
6672 14A3: GOTO 111 (RETURN)
6673 ....................
6674 ....................
6675 ....................
6676 ....................
6677 ....................
6678 ....................
6679 .................... void uvitani(void) // uvodni zprava
6680 .................... {
6681 .................... printf("\r\n\r\n# Meteorologicka stanice %s (C) 2013 www.mlab.cz \r\n",VERSION);
6682 *
6683 04AB: MOVLW 98
6684 04AC: BSF 03.6
6685 04AD: MOVWF 0D
6686 04AE: MOVLW 01
6687 04AF: MOVWF 0F
6688 04B0: BCF 03.0
6689 04B1: MOVLW 1D
6690 04B2: BCF 03.6
6691 04B3: MOVWF 60
6692 04B4: CALL 3F5
6693 04B5: MOVLW B4
6694 04B6: BSF 03.6
6695 04B7: MOVWF 0D
6696 04B8: MOVLW 01
6697 04B9: MOVWF 0F
6698 04BA: BCF 03.6
6699 04BB: CALL 444
6700 04BC: MOVLW A7
6701 04BD: BSF 03.6
6702 04BE: MOVWF 0D
6703 04BF: MOVLW 01
6704 04C0: MOVWF 0F
6705 04C1: BSF 03.0
6706 04C2: MOVLW 18
6707 04C3: BCF 03.6
6708 04C4: MOVWF 60
6709 04C5: CALL 3F5
6710 .................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message
6711 04C6: MOVLW B6
6712 04C7: BSF 03.6
6713 04C8: MOVWF 0D
6714 04C9: MOVLW 01
6715 04CA: MOVWF 0F
6716 04CB: BCF 03.0
6717 04CC: MOVLW 0B
6718 04CD: BCF 03.6
6719 04CE: MOVWF 60
6720 04CF: CALL 3F5
6721 04D0: MOVLW C9
6722 04D1: BSF 03.6
6723 04D2: MOVWF 0D
6724 04D3: MOVLW 01
6725 04D4: MOVWF 0F
6726 04D5: BCF 03.6
6727 04D6: CALL 444
6728 04D7: MOVLW BC
6729 04D8: BSF 03.6
6730 04D9: MOVWF 0D
6731 04DA: MOVLW 01
6732 04DB: MOVWF 0F
6733 04DC: BSF 03.0
6734 04DD: MOVLW 12
6735 04DE: BCF 03.6
6736 04DF: MOVWF 60
6737 04E0: CALL 3F5
6738 04E1: MOVLW CF
6739 04E2: BSF 03.6
6740 04E3: MOVWF 0D
6741 04E4: MOVLW 01
6742 04E5: MOVWF 0F
6743 04E6: BCF 03.6
6744 04E7: CALL 444
6745 04E8: MOVLW 20
6746 04E9: MOVWF 64
6747 04EA: CALL 3D1
6748 04EB: MOVLW 0D
6749 04EC: MOVWF 64
6750 04ED: CALL 3D1
6751 04EE: MOVLW 0A
6752 04EF: MOVWF 64
6753 04F0: CALL 3D1
6754 .................... printf("# ver poradi ");
6755 04F1: MOVLW D4
6756 04F2: BSF 03.6
6757 04F3: MOVWF 0D
6758 04F4: MOVLW 01
6759 04F5: MOVWF 0F
6760 04F6: BCF 03.6
6761 04F7: CALL 444
6762 .................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] ");
6763 04F8: MOVLW DB
6764 04F9: BSF 03.6
6765 04FA: MOVWF 0D
6766 04FB: MOVLW 01
6767 04FC: MOVWF 0F
6768 .................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n");
6769 *
6770 051D: MOVLW 05
6771 051E: MOVWF 0D
6772 051F: MOVLW 02
6773 0520: MOVWF 0F
6774 0521: MOVLW 10
6775 0522: BCF 03.6
6776 0523: MOVWF 60
6777 0524: CALL 48A
6778 0525: MOVLW 25
6779 0526: MOVWF 64
6780 0527: CALL 3D1
6781 0528: MOVLW 17
6782 0529: BSF 03.6
6783 052A: MOVWF 0D
6784 052B: MOVLW 02
6785 052C: MOVWF 0F
6786 052D: MOVLW 16
6787 052E: BCF 03.6
6788 052F: MOVWF 60
6789 0530: CALL 48A
6790 .................... }
6791 0531: BSF 0A.3
6792 0532: BSF 0A.4
6793 0533: GOTO 0A6 (RETURN)
6794 ....................
6795 .................... void main()
6796 .................... {
6797 *
6798 1800: CLRF 04
6799 1801: BCF 03.7
6800 1802: MOVLW 1F
6801 1803: ANDWF 03,F
6802 1804: MOVLW 71
6803 1805: BSF 03.5
6804 1806: MOVWF 0F
6805 1807: MOVF 0F,W
6806 1808: BCF 03.5
6807 1809: BCF 28.7
6808 180A: MOVF 28,W
6809 180B: BSF 03.5
6810 180C: MOVWF 07
6811 180D: BCF 03.5
6812 180E: BSF 07.7
6813 180F: CLRF 34
6814 1810: CLRF 33
6815 1811: CLRF 32
6816 1812: CLRF 31
6817 1813: BSF 03.5
6818 1814: BSF 03.6
6819 1815: MOVF 09,W
6820 1816: ANDLW C0
6821 1817: MOVWF 09
6822 1818: BCF 03.6
6823 1819: BCF 1F.4
6824 181A: BCF 1F.5
6825 181B: MOVLW 00
6826 181C: BSF 03.6
6827 181D: MOVWF 08
6828 181E: BCF 03.5
6829 181F: CLRF 07
6830 1820: CLRF 08
6831 1821: CLRF 09
6832 .................... setup_wdt(WDT_2304MS); //nastavení resetu pokud nedojde v cas k jeho vynulovani
6833 *
6834 1830: MOVLW 09
6835 1831: BSF 03.6
6836 1832: MOVWF 05
6837 1833: MOVLW 0F
6838 1834: MOVWF 77
6839 1835: BCF 03.6
6840 1836: CLRF 01
6841 1837: MOVLW 81
6842 1838: MOVWF 04
6843 1839: BCF 03.7
6844 183A: MOVF 00,W
6845 183B: ANDLW F0
6846 183C: IORLW 07
6847 183D: MOVWF 00
6848 183E: CLRWDT
6849 183F: MOVF 00,W
6850 1840: ANDLW F7
6851 1841: BTFSC 77.3
6852 1842: ANDLW F0
6853 1843: IORWF 77,W
6854 1844: MOVWF 00
6855 .................... restart_wdt(); //---WDT
6856 1845: CLRWDT
6857 .................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
6858 1846: BSF 03.5
6859 1847: BSF 03.6
6860 1848: MOVF 09,W
6861 1849: ANDLW C0
6862 184A: MOVWF 09
6863 184B: BCF 03.6
6864 184C: BCF 1F.4
6865 184D: BCF 1F.5
6866 184E: MOVLW 00
6867 184F: BSF 03.6
6868 1850: MOVWF 08
6869 .................... setup_adc(ADC_CLOCK_DIV_2);
6870 1851: BCF 03.5
6871 1852: BCF 03.6
6872 1853: BCF 1F.6
6873 1854: BCF 1F.7
6874 1855: BSF 03.5
6875 1856: BCF 1F.7
6876 1857: BCF 03.5
6877 1858: BSF 1F.0
6878 .................... setup_spi(SPI_SS_DISABLED);
6879 1859: BCF 14.5
6880 185A: BCF 28.5
6881 185B: MOVF 28,W
6882 185C: BSF 03.5
6883 185D: MOVWF 07
6884 185E: BCF 03.5
6885 185F: BSF 28.4
6886 1860: MOVF 28,W
6887 1861: BSF 03.5
6888 1862: MOVWF 07
6889 1863: BCF 03.5
6890 1864: BCF 28.3
6891 1865: MOVF 28,W
6892 1866: BSF 03.5
6893 1867: MOVWF 07
6894 1868: MOVLW 01
6895 1869: BCF 03.5
6896 186A: MOVWF 14
6897 186B: MOVLW 00
6898 186C: BSF 03.5
6899 186D: MOVWF 14
6900 .................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
6901 186E: MOVF 01,W
6902 186F: ANDLW C7
6903 1870: IORLW 28
6904 1871: MOVWF 01
6905 .................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT);
6906 1872: MOVLW 0F
6907 1873: BCF 03.5
6908 1874: MOVWF 10
6909 .................... setup_timer_2(T2_DISABLED,0,1);
6910 1875: MOVLW 00
6911 1876: MOVWF 78
6912 1877: MOVWF 12
6913 1878: MOVLW 00
6914 1879: BSF 03.5
6915 187A: MOVWF 12
6916 .................... setup_ccp1(CCP_OFF);
6917 187B: BCF 03.5
6918 187C: BSF 28.2
6919 187D: MOVF 28,W
6920 187E: BSF 03.5
6921 187F: MOVWF 07
6922 1880: BCF 03.5
6923 1881: CLRF 17
6924 1882: BSF 03.5
6925 1883: CLRF 1B
6926 1884: CLRF 1C
6927 1885: MOVLW 01
6928 1886: MOVWF 1D
6929 .................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
6930 1887: BCF 03.5
6931 1888: BSF 03.6
6932 1889: CLRF 07
6933 188A: CLRF 08
6934 188B: CLRF 09
6935 ....................
6936 ....................
6937 .................... float altimet_t; //teplota z MPL3115
6938 .................... float altimet_p; //tlak z MPL3115
6939 .................... float altimet_a; //vyska z MPL3115
6940 .................... float sht25_t; //teplota z SHT25
6941 .................... float sht25_h; //relativni vlhkost z SHT25
6942 .................... float smer_v; //smer vetru
6943 ....................
6944 .................... unsigned int16 poradi=0; //cislo vzorku
6945 .................... unsigned int8 sht_config;
6946 188C: BCF 03.6
6947 188D: CLRF 50
6948 188E: CLRF 4F
6949 ....................
6950 .................... //nastaveni SHT25
6951 .................... SHT25_soft_reset();
6952 188F: BCF 0A.4
6953 1890: BCF 0A.3
6954 1891: GOTO 278
6955 1892: BSF 0A.4
6956 1893: BSF 0A.3
6957 .................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; //vypnuti topeni v SHT25
6958 1894: CLRF 51
6959 .................... SHT25_setup(sht_config);
6960 1895: MOVF 51,W
6961 1896: MOVWF 60
6962 1897: BCF 0A.4
6963 1898: BCF 0A.3
6964 1899: GOTO 309
6965 189A: BSF 0A.4
6966 189B: BSF 0A.3
6967 ....................
6968 .................... //nastavení pøerušení pro anemometr
6969 .................... enable_interrupts(INT_TIMER1);
6970 189C: BSF 03.5
6971 189D: BSF 0C.0
6972 .................... enable_interrupts(INT_TIMER0);
6973 189E: BCF 03.5
6974 189F: BSF 0B.5
6975 .................... enable_interrupts(GLOBAL);
6976 18A0: MOVLW C0
6977 18A1: IORWF 0B,F
6978 .................... restart_wdt(); //---WDT
6979 18A2: CLRWDT
6980 ....................
6981 .................... uvitani();
6982 18A3: BCF 0A.4
6983 18A4: BCF 0A.3
6984 18A5: GOTO 4AB
6985 18A6: BSF 0A.4
6986 18A7: BSF 0A.3
6987 .................... set_mag(); //nastaveni magnetometru pro smer vetru
6988 18A8: BCF 0A.4
6989 18A9: BCF 0A.3
6990 18AA: GOTO 534
6991 18AB: BSF 0A.4
6992 18AC: BSF 0A.3
6993 ....................
6994 .................... // vynulovani promenych pro anemometr
6995 .................... set_timer0(0);
6996 18AD: CLRF 01
6997 .................... set_timer1(0);
6998 18AE: CLRF 0F
6999 18AF: CLRF 0E
7000 .................... timer0_overflow_count=0;
7001 18B0: CLRF 30
7002 18B1: CLRF 2F
7003 .................... anemo=0;
7004 18B2: CLRF 34
7005 18B3: CLRF 33
7006 18B4: CLRF 32
7007 18B5: CLRF 31
7008 ....................
7009 .................... restart_wdt(); //---WDT
7010 18B6: CLRWDT
7011 ....................
7012 .................... while(TRUE)
7013 .................... {
7014 .................... char output[12]; // vystupni zasobnik
7015 .................... int8 j; // ukazatel na retezec
7016 .................... int8 check=0; // Checksum is calculated between '$' and '*'
7017 18B7: CLRF 5F
7018 ....................
7019 ....................
7020 .................... mpl3115_setP(); //nastaveni pro tlak a teplotu
7021 18B8: BCF 0A.4
7022 18B9: BCF 0A.3
7023 18BA: GOTO 5E6
7024 18BB: BSF 0A.4
7025 18BC: BSF 0A.3
7026 .................... delay_ms (500);
7027 18BD: MOVLW 02
7028 18BE: MOVWF 60
7029 18BF: MOVLW FA
7030 18C0: MOVWF 65
7031 18C1: BCF 0A.4
7032 18C2: BCF 0A.3
7033 18C3: CALL 2F5
7034 18C4: BSF 0A.4
7035 18C5: BSF 0A.3
7036 18C6: DECFSZ 60,F
7037 18C7: GOTO 0BF
7038 .................... altimet_t=mpl3115_T();
7039 18C8: BCF 0A.4
7040 18C9: BCF 0A.3
7041 18CA: GOTO 6EB
7042 18CB: BSF 0A.4
7043 18CC: BSF 0A.3
7044 18CD: MOVF 7A,W
7045 18CE: MOVWF 3A
7046 18CF: MOVF 79,W
7047 18D0: MOVWF 39
7048 18D1: MOVF 78,W
7049 18D2: MOVWF 38
7050 18D3: MOVF 77,W
7051 18D4: MOVWF 37
7052 .................... altimet_p=mpl3115_P();
7053 18D5: BCF 0A.4
7054 18D6: GOTO 146
7055 18D7: BSF 0A.4
7056 18D8: MOVF 7A,W
7057 18D9: MOVWF 3E
7058 18DA: MOVF 79,W
7059 18DB: MOVWF 3D
7060 18DC: MOVF 78,W
7061 18DD: MOVWF 3C
7062 18DE: MOVF 77,W
7063 18DF: MOVWF 3B
7064 ....................
7065 .................... mpl3115_setA(); //nastaveni pro vysku a teplotu
7066 18E0: BCF 0A.4
7067 18E1: GOTO 220
7068 18E2: BSF 0A.4
7069 .................... delay_ms (500);
7070 18E3: MOVLW 02
7071 18E4: MOVWF 60
7072 18E5: MOVLW FA
7073 18E6: MOVWF 65
7074 18E7: BCF 0A.4
7075 18E8: BCF 0A.3
7076 18E9: CALL 2F5
7077 18EA: BSF 0A.4
7078 18EB: BSF 0A.3
7079 18EC: DECFSZ 60,F
7080 18ED: GOTO 0E5
7081 .................... altimet_a=mpl3115_A();
7082 18EE: BCF 0A.4
7083 18EF: GOTO 2DD
7084 18F0: BSF 0A.4
7085 18F1: MOVF 7A,W
7086 18F2: MOVWF 42
7087 18F3: MOVF 79,W
7088 18F4: MOVWF 41
7089 18F5: MOVF 78,W
7090 18F6: MOVWF 40
7091 18F7: MOVF 77,W
7092 18F8: MOVWF 3F
7093 ....................
7094 .................... sht25_t=SHT25_get_temp(); //mereni hodnot z SHT25
7095 18F9: BCF 0A.4
7096 18FA: GOTO 385
7097 18FB: BSF 0A.4
7098 18FC: MOVF 7A,W
7099 18FD: MOVWF 46
7100 18FE: MOVF 79,W
7101 18FF: MOVWF 45
7102 1900: MOVF 78,W
7103 1901: MOVWF 44
7104 1902: MOVF 77,W
7105 1903: MOVWF 43
7106 .................... sht25_h=SHT25_get_hum();
7107 1904: BCF 0A.4
7108 1905: GOTO 485
7109 1906: BSF 0A.4
7110 1907: MOVF 7A,W
7111 1908: MOVWF 4A
7112 1909: MOVF 79,W
7113 190A: MOVWF 49
7114 190B: MOVF 78,W
7115 190C: MOVWF 48
7116 190D: MOVF 77,W
7117 190E: MOVWF 47
7118 ....................
7119 .................... smer_v=azimut(); //vrati azimut aktualniho smeru vetru
7120 190F: BCF 0A.3
7121 1910: GOTO 000
7122 1911: BSF 0A.3
7123 1912: MOVF 7A,W
7124 1913: MOVWF 4E
7125 1914: MOVF 79,W
7126 1915: MOVWF 4D
7127 1916: MOVF 78,W
7128 1917: MOVWF 4C
7129 1918: MOVF 77,W
7130 1919: MOVWF 4B
7131 ....................
7132 ....................
7133 .................... delay_us(SEND_DELAY);
7134 191A: MOVLW 21
7135 191B: MOVWF 77
7136 191C: DECFSZ 77,F
7137 191D: GOTO 11C
7138 .................... putc('$');
7139 191E: MOVLW 24
7140 191F: MOVWF 64
7141 1920: BCF 0A.4
7142 1921: BCF 0A.3
7143 1922: CALL 3D1
7144 1923: BSF 0A.4
7145 1924: BSF 0A.3
7146 .................... delay_us(SEND_DELAY);
7147 1925: MOVLW 21
7148 1926: MOVWF 77
7149 1927: DECFSZ 77,F
7150 1928: GOTO 127
7151 .................... sprintf(output,"MST%s \0",VER);
7152 1929: CLRF 36
7153 192A: MOVLW 52
7154 192B: MOVWF 35
7155 192C: MOVLW 4D
7156 192D: MOVWF 6D
7157 192E: BCF 0A.4
7158 192F: CALL 632
7159 1930: BSF 0A.4
7160 1931: MOVLW 53
7161 1932: MOVWF 6D
7162 1933: BCF 0A.4
7163 1934: CALL 632
7164 1935: BSF 0A.4
7165 1936: MOVLW 54
7166 1937: MOVWF 6D
7167 1938: BCF 0A.4
7168 1939: CALL 632
7169 193A: BSF 0A.4
7170 193B: MOVLW 2B
7171 193C: MOVWF 04
7172 193D: BCF 03.7
7173 193E: BCF 0A.4
7174 193F: GOTO 63F
7175 1940: BSF 0A.4
7176 1941: MOVLW 20
7177 1942: MOVWF 6D
7178 1943: BCF 0A.4
7179 1944: CALL 632
7180 1945: BSF 0A.4
7181 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7182 1946: CLRF 5E
7183 1947: MOVLW 52
7184 1948: ADDWF 5E,W
7185 1949: MOVWF 04
7186 194A: BCF 03.7
7187 194B: MOVF 00,F
7188 194C: BTFSC 03.2
7189 194D: GOTO 167
7190 194E: MOVLW 21
7191 194F: MOVWF 77
7192 1950: DECFSZ 77,F
7193 1951: GOTO 150
7194 1952: MOVLW 52
7195 1953: ADDWF 5E,W
7196 1954: MOVWF 04
7197 1955: BCF 03.7
7198 1956: MOVF 00,W
7199 1957: MOVWF 60
7200 1958: MOVF 60,W
7201 1959: MOVWF 64
7202 195A: BCF 0A.4
7203 195B: BCF 0A.3
7204 195C: CALL 3D1
7205 195D: BSF 0A.4
7206 195E: BSF 0A.3
7207 195F: MOVF 5E,W
7208 1960: INCF 5E,F
7209 1961: ADDLW 52
7210 1962: MOVWF 04
7211 1963: BCF 03.7
7212 1964: MOVF 00,W
7213 1965: XORWF 5F,F
7214 1966: GOTO 147
7215 .................... sprintf(output,"%4.0Lu \0", poradi);
7216 1967: CLRF 36
7217 1968: MOVLW 52
7218 1969: MOVWF 35
7219 196A: MOVLW 01
7220 196B: MOVWF 04
7221 196C: MOVF 50,W
7222 196D: MOVWF 61
7223 196E: MOVF 4F,W
7224 196F: MOVWF 60
7225 1970: BCF 0A.4
7226 1971: GOTO 657
7227 1972: BSF 0A.4
7228 1973: MOVLW 20
7229 1974: MOVWF 6D
7230 1975: BCF 0A.4
7231 1976: CALL 632
7232 1977: BSF 0A.4
7233 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7234 1978: CLRF 5E
7235 1979: MOVLW 52
7236 197A: ADDWF 5E,W
7237 197B: MOVWF 04
7238 197C: BCF 03.7
7239 197D: MOVF 00,F
7240 197E: BTFSC 03.2
7241 197F: GOTO 199
7242 1980: MOVLW 21
7243 1981: MOVWF 77
7244 1982: DECFSZ 77,F
7245 1983: GOTO 182
7246 1984: MOVLW 52
7247 1985: ADDWF 5E,W
7248 1986: MOVWF 04
7249 1987: BCF 03.7
7250 1988: MOVF 00,W
7251 1989: MOVWF 60
7252 198A: MOVF 60,W
7253 198B: MOVWF 64
7254 198C: BCF 0A.4
7255 198D: BCF 0A.3
7256 198E: CALL 3D1
7257 198F: BSF 0A.4
7258 1990: BSF 0A.3
7259 1991: MOVF 5E,W
7260 1992: INCF 5E,F
7261 1993: ADDLW 52
7262 1994: MOVWF 04
7263 1995: BCF 03.7
7264 1996: MOVF 00,W
7265 1997: XORWF 5F,F
7266 1998: GOTO 179
7267 .................... sprintf(output,"%6.2f \0", altimet_t );
7268 1999: CLRF 36
7269 199A: MOVLW 52
7270 199B: MOVWF 35
7271 199C: MOVLW 05
7272 199D: MOVWF 04
7273 199E: MOVF 3A,W
7274 199F: MOVWF 63
7275 19A0: MOVF 39,W
7276 19A1: MOVWF 62
7277 19A2: MOVF 38,W
7278 19A3: MOVWF 61
7279 19A4: MOVF 37,W
7280 19A5: MOVWF 60
7281 19A6: MOVLW 02
7282 19A7: MOVWF 64
7283 19A8: BCF 0A.4
7284 19A9: CALL 702
7285 19AA: BSF 0A.4
7286 19AB: MOVLW 20
7287 19AC: MOVWF 6D
7288 19AD: BCF 0A.4
7289 19AE: CALL 632
7290 19AF: BSF 0A.4
7291 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7292 19B0: CLRF 5E
7293 19B1: MOVLW 52
7294 19B2: ADDWF 5E,W
7295 19B3: MOVWF 04
7296 19B4: BCF 03.7
7297 19B5: MOVF 00,F
7298 19B6: BTFSC 03.2
7299 19B7: GOTO 1D1
7300 19B8: MOVLW 21
7301 19B9: MOVWF 77
7302 19BA: DECFSZ 77,F
7303 19BB: GOTO 1BA
7304 19BC: MOVLW 52
7305 19BD: ADDWF 5E,W
7306 19BE: MOVWF 04
7307 19BF: BCF 03.7
7308 19C0: MOVF 00,W
7309 19C1: MOVWF 60
7310 19C2: MOVF 60,W
7311 19C3: MOVWF 64
7312 19C4: BCF 0A.4
7313 19C5: BCF 0A.3
7314 19C6: CALL 3D1
7315 19C7: BSF 0A.4
7316 19C8: BSF 0A.3
7317 19C9: MOVF 5E,W
7318 19CA: INCF 5E,F
7319 19CB: ADDLW 52
7320 19CC: MOVWF 04
7321 19CD: BCF 03.7
7322 19CE: MOVF 00,W
7323 19CF: XORWF 5F,F
7324 19D0: GOTO 1B1
7325 .................... sprintf(output,"%7.2f \0", altimet_a);
7326 19D1: CLRF 36
7327 19D2: MOVLW 52
7328 19D3: MOVWF 35
7329 19D4: MOVLW 06
7330 19D5: MOVWF 04
7331 19D6: MOVF 42,W
7332 19D7: MOVWF 63
7333 19D8: MOVF 41,W
7334 19D9: MOVWF 62
7335 19DA: MOVF 40,W
7336 19DB: MOVWF 61
7337 19DC: MOVF 3F,W
7338 19DD: MOVWF 60
7339 19DE: MOVLW 02
7340 19DF: MOVWF 64
7341 19E0: BCF 0A.4
7342 19E1: CALL 702
7343 19E2: BSF 0A.4
7344 19E3: MOVLW 20
7345 19E4: MOVWF 6D
7346 19E5: BCF 0A.4
7347 19E6: CALL 632
7348 19E7: BSF 0A.4
7349 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7350 19E8: CLRF 5E
7351 19E9: MOVLW 52
7352 19EA: ADDWF 5E,W
7353 19EB: MOVWF 04
7354 19EC: BCF 03.7
7355 19ED: MOVF 00,F
7356 19EE: BTFSC 03.2
7357 19EF: GOTO 209
7358 19F0: MOVLW 21
7359 19F1: MOVWF 77
7360 19F2: DECFSZ 77,F
7361 19F3: GOTO 1F2
7362 19F4: MOVLW 52
7363 19F5: ADDWF 5E,W
7364 19F6: MOVWF 04
7365 19F7: BCF 03.7
7366 19F8: MOVF 00,W
7367 19F9: MOVWF 60
7368 19FA: MOVF 60,W
7369 19FB: MOVWF 64
7370 19FC: BCF 0A.4
7371 19FD: BCF 0A.3
7372 19FE: CALL 3D1
7373 19FF: BSF 0A.4
7374 1A00: BSF 0A.3
7375 1A01: MOVF 5E,W
7376 1A02: INCF 5E,F
7377 1A03: ADDLW 52
7378 1A04: MOVWF 04
7379 1A05: BCF 03.7
7380 1A06: MOVF 00,W
7381 1A07: XORWF 5F,F
7382 1A08: GOTO 1E9
7383 .................... sprintf(output,"%9.2f \0", altimet_p);
7384 1A09: CLRF 36
7385 1A0A: MOVLW 52
7386 1A0B: MOVWF 35
7387 1A0C: MOVLW 08
7388 1A0D: MOVWF 04
7389 1A0E: MOVF 3E,W
7390 1A0F: MOVWF 63
7391 1A10: MOVF 3D,W
7392 1A11: MOVWF 62
7393 1A12: MOVF 3C,W
7394 1A13: MOVWF 61
7395 1A14: MOVF 3B,W
7396 1A15: MOVWF 60
7397 1A16: MOVLW 02
7398 1A17: MOVWF 64
7399 1A18: BCF 0A.4
7400 1A19: CALL 702
7401 1A1A: BSF 0A.4
7402 1A1B: MOVLW 20
7403 1A1C: MOVWF 6D
7404 1A1D: BCF 0A.4
7405 1A1E: CALL 632
7406 1A1F: BSF 0A.4
7407 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7408 1A20: CLRF 5E
7409 1A21: MOVLW 52
7410 1A22: ADDWF 5E,W
7411 1A23: MOVWF 04
7412 1A24: BCF 03.7
7413 1A25: MOVF 00,F
7414 1A26: BTFSC 03.2
7415 1A27: GOTO 241
7416 1A28: MOVLW 21
7417 1A29: MOVWF 77
7418 1A2A: DECFSZ 77,F
7419 1A2B: GOTO 22A
7420 1A2C: MOVLW 52
7421 1A2D: ADDWF 5E,W
7422 1A2E: MOVWF 04
7423 1A2F: BCF 03.7
7424 1A30: MOVF 00,W
7425 1A31: MOVWF 60
7426 1A32: MOVF 60,W
7427 1A33: MOVWF 64
7428 1A34: BCF 0A.4
7429 1A35: BCF 0A.3
7430 1A36: CALL 3D1
7431 1A37: BSF 0A.4
7432 1A38: BSF 0A.3
7433 1A39: MOVF 5E,W
7434 1A3A: INCF 5E,F
7435 1A3B: ADDLW 52
7436 1A3C: MOVWF 04
7437 1A3D: BCF 03.7
7438 1A3E: MOVF 00,W
7439 1A3F: XORWF 5F,F
7440 1A40: GOTO 221
7441 .................... sprintf(output,"%6.2f \0", sht25_t);
7442 1A41: CLRF 36
7443 1A42: MOVLW 52
7444 1A43: MOVWF 35
7445 1A44: MOVLW 05
7446 1A45: MOVWF 04
7447 1A46: MOVF 46,W
7448 1A47: MOVWF 63
7449 1A48: MOVF 45,W
7450 1A49: MOVWF 62
7451 1A4A: MOVF 44,W
7452 1A4B: MOVWF 61
7453 1A4C: MOVF 43,W
7454 1A4D: MOVWF 60
7455 1A4E: MOVLW 02
7456 1A4F: MOVWF 64
7457 1A50: BCF 0A.4
7458 1A51: CALL 702
7459 1A52: BSF 0A.4
7460 1A53: MOVLW 20
7461 1A54: MOVWF 6D
7462 1A55: BCF 0A.4
7463 1A56: CALL 632
7464 1A57: BSF 0A.4
7465 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7466 1A58: CLRF 5E
7467 1A59: MOVLW 52
7468 1A5A: ADDWF 5E,W
7469 1A5B: MOVWF 04
7470 1A5C: BCF 03.7
7471 1A5D: MOVF 00,F
7472 1A5E: BTFSC 03.2
7473 1A5F: GOTO 279
7474 1A60: MOVLW 21
7475 1A61: MOVWF 77
7476 1A62: DECFSZ 77,F
7477 1A63: GOTO 262
7478 1A64: MOVLW 52
7479 1A65: ADDWF 5E,W
7480 1A66: MOVWF 04
7481 1A67: BCF 03.7
7482 1A68: MOVF 00,W
7483 1A69: MOVWF 60
7484 1A6A: MOVF 60,W
7485 1A6B: MOVWF 64
7486 1A6C: BCF 0A.4
7487 1A6D: BCF 0A.3
7488 1A6E: CALL 3D1
7489 1A6F: BSF 0A.4
7490 1A70: BSF 0A.3
7491 1A71: MOVF 5E,W
7492 1A72: INCF 5E,F
7493 1A73: ADDLW 52
7494 1A74: MOVWF 04
7495 1A75: BCF 03.7
7496 1A76: MOVF 00,W
7497 1A77: XORWF 5F,F
7498 1A78: GOTO 259
7499 .................... sprintf(output,"%6.2f \0", sht25_h);
7500 1A79: CLRF 36
7501 1A7A: MOVLW 52
7502 1A7B: MOVWF 35
7503 1A7C: MOVLW 05
7504 1A7D: MOVWF 04
7505 1A7E: MOVF 4A,W
7506 1A7F: MOVWF 63
7507 1A80: MOVF 49,W
7508 1A81: MOVWF 62
7509 1A82: MOVF 48,W
7510 1A83: MOVWF 61
7511 1A84: MOVF 47,W
7512 1A85: MOVWF 60
7513 1A86: MOVLW 02
7514 1A87: MOVWF 64
7515 1A88: BCF 0A.4
7516 1A89: CALL 702
7517 1A8A: BSF 0A.4
7518 1A8B: MOVLW 20
7519 1A8C: MOVWF 6D
7520 1A8D: BCF 0A.4
7521 1A8E: CALL 632
7522 1A8F: BSF 0A.4
7523 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7524 1A90: CLRF 5E
7525 1A91: MOVLW 52
7526 1A92: ADDWF 5E,W
7527 1A93: MOVWF 04
7528 1A94: BCF 03.7
7529 1A95: MOVF 00,F
7530 1A96: BTFSC 03.2
7531 1A97: GOTO 2B1
7532 1A98: MOVLW 21
7533 1A99: MOVWF 77
7534 1A9A: DECFSZ 77,F
7535 1A9B: GOTO 29A
7536 1A9C: MOVLW 52
7537 1A9D: ADDWF 5E,W
7538 1A9E: MOVWF 04
7539 1A9F: BCF 03.7
7540 1AA0: MOVF 00,W
7541 1AA1: MOVWF 60
7542 1AA2: MOVF 60,W
7543 1AA3: MOVWF 64
7544 1AA4: BCF 0A.4
7545 1AA5: BCF 0A.3
7546 1AA6: CALL 3D1
7547 1AA7: BSF 0A.4
7548 1AA8: BSF 0A.3
7549 1AA9: MOVF 5E,W
7550 1AAA: INCF 5E,F
7551 1AAB: ADDLW 52
7552 1AAC: MOVWF 04
7553 1AAD: BCF 03.7
7554 1AAE: MOVF 00,W
7555 1AAF: XORWF 5F,F
7556 1AB0: GOTO 291
7557 .................... sprintf(output,"%6.2f \0", smer_v);
7558 1AB1: CLRF 36
7559 1AB2: MOVLW 52
7560 1AB3: MOVWF 35
7561 1AB4: MOVLW 05
7562 1AB5: MOVWF 04
7563 1AB6: MOVF 4E,W
7564 1AB7: MOVWF 63
7565 1AB8: MOVF 4D,W
7566 1AB9: MOVWF 62
7567 1ABA: MOVF 4C,W
7568 1ABB: MOVWF 61
7569 1ABC: MOVF 4B,W
7570 1ABD: MOVWF 60
7571 1ABE: MOVLW 02
7572 1ABF: MOVWF 64
7573 1AC0: BCF 0A.4
7574 1AC1: CALL 702
7575 1AC2: BSF 0A.4
7576 1AC3: MOVLW 20
7577 1AC4: MOVWF 6D
7578 1AC5: BCF 0A.4
7579 1AC6: CALL 632
7580 1AC7: BSF 0A.4
7581 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7582 1AC8: CLRF 5E
7583 1AC9: MOVLW 52
7584 1ACA: ADDWF 5E,W
7585 1ACB: MOVWF 04
7586 1ACC: BCF 03.7
7587 1ACD: MOVF 00,F
7588 1ACE: BTFSC 03.2
7589 1ACF: GOTO 2E9
7590 1AD0: MOVLW 21
7591 1AD1: MOVWF 77
7592 1AD2: DECFSZ 77,F
7593 1AD3: GOTO 2D2
7594 1AD4: MOVLW 52
7595 1AD5: ADDWF 5E,W
7596 1AD6: MOVWF 04
7597 1AD7: BCF 03.7
7598 1AD8: MOVF 00,W
7599 1AD9: MOVWF 60
7600 1ADA: MOVF 60,W
7601 1ADB: MOVWF 64
7602 1ADC: BCF 0A.4
7603 1ADD: BCF 0A.3
7604 1ADE: CALL 3D1
7605 1ADF: BSF 0A.4
7606 1AE0: BSF 0A.3
7607 1AE1: MOVF 5E,W
7608 1AE2: INCF 5E,F
7609 1AE3: ADDLW 52
7610 1AE4: MOVWF 04
7611 1AE5: BCF 03.7
7612 1AE6: MOVF 00,W
7613 1AE7: XORWF 5F,F
7614 1AE8: GOTO 2C9
7615 .................... sprintf(output,"%5.2f \0", anemo);
7616 1AE9: CLRF 36
7617 1AEA: MOVLW 52
7618 1AEB: MOVWF 35
7619 1AEC: MOVLW 04
7620 1AED: MOVWF 04
7621 1AEE: MOVF 34,W
7622 1AEF: MOVWF 63
7623 1AF0: MOVF 33,W
7624 1AF1: MOVWF 62
7625 1AF2: MOVF 32,W
7626 1AF3: MOVWF 61
7627 1AF4: MOVF 31,W
7628 1AF5: MOVWF 60
7629 1AF6: MOVLW 02
7630 1AF7: MOVWF 64
7631 1AF8: BCF 0A.4
7632 1AF9: CALL 702
7633 1AFA: BSF 0A.4
7634 1AFB: MOVLW 20
7635 1AFC: MOVWF 6D
7636 1AFD: BCF 0A.4
7637 1AFE: CALL 632
7638 1AFF: BSF 0A.4
7639 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
7640 1B00: CLRF 5E
7641 1B01: MOVLW 52
7642 1B02: ADDWF 5E,W
7643 1B03: MOVWF 04
7644 1B04: BCF 03.7
7645 1B05: MOVF 00,F
7646 1B06: BTFSC 03.2
7647 1B07: GOTO 321
7648 1B08: MOVLW 21
7649 1B09: MOVWF 77
7650 1B0A: DECFSZ 77,F
7651 1B0B: GOTO 30A
7652 1B0C: MOVLW 52
7653 1B0D: ADDWF 5E,W
7654 1B0E: MOVWF 04
7655 1B0F: BCF 03.7
7656 1B10: MOVF 00,W
7657 1B11: MOVWF 60
7658 1B12: MOVF 60,W
7659 1B13: MOVWF 64
7660 1B14: BCF 0A.4
7661 1B15: BCF 0A.3
7662 1B16: CALL 3D1
7663 1B17: BSF 0A.4
7664 1B18: BSF 0A.3
7665 1B19: MOVF 5E,W
7666 1B1A: INCF 5E,F
7667 1B1B: ADDLW 52
7668 1B1C: MOVWF 04
7669 1B1D: BCF 03.7
7670 1B1E: MOVF 00,W
7671 1B1F: XORWF 5F,F
7672 1B20: GOTO 301
7673 .................... sprintf(output,"*%X\r\n\0", check);
7674 1B21: CLRF 36
7675 1B22: MOVLW 52
7676 1B23: MOVWF 35
7677 1B24: MOVLW 2A
7678 1B25: MOVWF 6D
7679 1B26: BCF 0A.4
7680 1B27: CALL 632
7681 1B28: BSF 0A.4
7682 1B29: MOVF 5F,W
7683 1B2A: MOVWF 60
7684 1B2B: MOVLW 37
7685 1B2C: MOVWF 61
7686 1B2D: BCF 0A.3
7687 1B2E: GOTO 4A4
7688 1B2F: BSF 0A.3
7689 1B30: MOVLW 0D
7690 1B31: MOVWF 6D
7691 1B32: BCF 0A.4
7692 1B33: CALL 632
7693 1B34: BSF 0A.4
7694 1B35: MOVLW 0A
7695 1B36: MOVWF 6D
7696 1B37: BCF 0A.4
7697 1B38: CALL 632
7698 1B39: BSF 0A.4
7699 .................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); }
7700 1B3A: CLRF 5E
7701 1B3B: MOVLW 52
7702 1B3C: ADDWF 5E,W
7703 1B3D: MOVWF 04
7704 1B3E: BCF 03.7
7705 1B3F: MOVF 00,F
7706 1B40: BTFSC 03.2
7707 1B41: GOTO 355
7708 1B42: MOVLW 21
7709 1B43: MOVWF 77
7710 1B44: DECFSZ 77,F
7711 1B45: GOTO 344
7712 1B46: MOVF 5E,W
7713 1B47: INCF 5E,F
7714 1B48: ADDLW 52
7715 1B49: MOVWF 04
7716 1B4A: BCF 03.7
7717 1B4B: MOVF 00,W
7718 1B4C: MOVWF 60
7719 1B4D: MOVF 60,W
7720 1B4E: MOVWF 64
7721 1B4F: BCF 0A.4
7722 1B50: BCF 0A.3
7723 1B51: CALL 3D1
7724 1B52: BSF 0A.4
7725 1B53: BSF 0A.3
7726 1B54: GOTO 33B
7727 .................... delay_us(SEND_DELAY);
7728 1B55: MOVLW 21
7729 1B56: MOVWF 77
7730 1B57: DECFSZ 77,F
7731 1B58: GOTO 357
7732 ....................
7733 .................... poradi++;
7734 1B59: INCF 4F,F
7735 1B5A: BTFSC 03.2
7736 1B5B: INCF 50,F
7737 .................... restart_wdt();
7738 1B5C: CLRWDT
7739 .................... }
7740 1B5D: GOTO 0B7
7741 ....................
7742 .................... }
7743 ....................
7744 ....................
7745 ....................
7746 1B5E: SLEEP
7747  
7748 Configuration Fuses:
7749 Word 1: 2CFD INTRC WDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
7750 Word 2: 3FFF NOWRT BORV40