CCS PCM C Compiler, Version 4.106, 47914 06-5-13 11:39
Filename: c:\users\honza\documents\pic\meteo_stanice\nová sloka\main.lst
ROM used: 5847 words (71%)
Largest free fragment is 2048
RAM used: 25 (7%) at main() level
260 (71%) worst case
Stack: 5 worst case (3 in main + 2 for interrupts)
*
0000: MOVLW 15
0001: MOVWF 0A
0002: GOTO 53E
0003: NOP
0004: MOVWF 7F
0005: SWAPF 03,W
0006: CLRF 03
0007: MOVWF 21
0008: MOVF 0A,W
0009: MOVWF 20
000A: CLRF 0A
000B: MOVF 04,W
000C: MOVWF 22
000D: MOVF 77,W
000E: MOVWF 23
000F: MOVF 78,W
0010: MOVWF 24
0011: MOVF 79,W
0012: MOVWF 25
0013: MOVF 7A,W
0014: MOVWF 26
0015: BCF 03.7
0016: BCF 03.5
0017: MOVLW 8C
0018: MOVWF 04
0019: BTFSS 00.0
001A: GOTO 01D
001B: BTFSC 0C.0
001C: GOTO 032
001D: BTFSS 0B.5
001E: GOTO 021
001F: BTFSC 0B.2
0020: GOTO 035
0021: MOVF 22,W
0022: MOVWF 04
0023: MOVF 23,W
0024: MOVWF 77
0025: MOVF 24,W
0026: MOVWF 78
0027: MOVF 25,W
0028: MOVWF 79
0029: MOVF 26,W
002A: MOVWF 7A
002B: MOVF 20,W
002C: MOVWF 0A
002D: SWAPF 21,W
002E: MOVWF 03
002F: SWAPF 7F,F
0030: SWAPF 7F,W
0031: RETFIE
0032: BCF 0A.3
0033: BCF 0A.4
0034: GOTO 123
0035: BCF 0A.3
0036: BCF 0A.4
0037: GOTO 191
....................
.................... //Meteorologicka cast
.................... #define VERSION "0.1"
.................... #define AUTOR "Jan Chroust"
.................... #define DATE "15.4.2013"
....................
.................... #include <main.h>
.................... #include <16F887.h>
.................... //////// Standard Header file for the PIC16F887 device ////////////////
.................... #device PIC16F887
.................... #list
....................
.................... #device adc=8
....................
....................
....................
.................... //#FUSES WDT // Watch Dog Timer
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES INTRC //Internal RC Osc
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOBROWNOUT //No brownout reset
.................... #FUSES IESO //Internal External Switch Over mode enabled
.................... #FUSES FCMEN //Fail-safe clock monitor enabled
.................... #FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES BORV40 //Brownout reset at 4.0V
....................
.................... #use delay(clock=8000000)
*
0303: MOVLW E2
0304: MOVWF 04
0305: BCF 03.7
0306: MOVF 00,W
0307: BTFSC 03.2
0308: GOTO 316
0309: MOVLW 02
030A: MOVWF 78
030B: CLRF 77
030C: DECFSZ 77,F
030D: GOTO 30C
030E: DECFSZ 78,F
030F: GOTO 30B
0310: MOVLW 97
0311: MOVWF 77
0312: DECFSZ 77,F
0313: GOTO 312
0314: DECFSZ 00,F
0315: GOTO 309
0316: RETURN
....................
.................... //set I2C
.................... #define PIN_SDA PIN_C3
.................... #define PIN_SCL PIN_C4
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL)
*
022E: MOVLW 08
022F: MOVWF 78
0230: NOP
0231: BCF 07.4
0232: BCF 28.4
0233: MOVF 28,W
0234: BSF 03.5
0235: MOVWF 07
0236: NOP
0237: BCF 03.5
0238: BSF 03.6
0239: RLF 12,F
023A: BCF 03.6
023B: BCF 07.3
023C: BTFSS 03.0
023D: GOTO 244
023E: BSF 28.3
023F: MOVF 28,W
0240: BSF 03.5
0241: MOVWF 07
0242: GOTO 248
0243: BCF 03.5
0244: BCF 28.3
0245: MOVF 28,W
0246: BSF 03.5
0247: MOVWF 07
0248: NOP
0249: BCF 03.5
024A: BSF 28.4
024B: MOVF 28,W
024C: BSF 03.5
024D: MOVWF 07
024E: BCF 03.5
024F: BTFSS 07.4
0250: GOTO 24F
0251: DECFSZ 78,F
0252: GOTO 230
0253: NOP
0254: BCF 07.4
0255: BCF 28.4
0256: MOVF 28,W
0257: BSF 03.5
0258: MOVWF 07
0259: NOP
025A: BCF 03.5
025B: BSF 28.3
025C: MOVF 28,W
025D: BSF 03.5
025E: MOVWF 07
025F: NOP
0260: NOP
0261: BCF 03.5
0262: BSF 28.4
0263: MOVF 28,W
0264: BSF 03.5
0265: MOVWF 07
0266: BCF 03.5
0267: BTFSS 07.4
0268: GOTO 267
0269: CLRF 78
026A: NOP
026B: BTFSC 07.3
026C: BSF 78.0
026D: BCF 07.4
026E: BCF 28.4
026F: MOVF 28,W
0270: BSF 03.5
0271: MOVWF 07
0272: BCF 03.5
0273: BCF 07.3
0274: BCF 28.3
0275: MOVF 28,W
0276: BSF 03.5
0277: MOVWF 07
0278: BCF 03.5
0279: RETURN
*
02B6: MOVLW 08
02B7: BSF 03.6
02B8: MOVWF 13
02B9: MOVF 77,W
02BA: MOVWF 14
02BB: BCF 03.6
02BC: BSF 28.3
02BD: MOVF 28,W
02BE: BSF 03.5
02BF: MOVWF 07
02C0: NOP
02C1: BCF 03.5
02C2: BSF 28.4
02C3: MOVF 28,W
02C4: BSF 03.5
02C5: MOVWF 07
02C6: BCF 03.5
02C7: BTFSS 07.4
02C8: GOTO 2C7
02C9: BTFSC 07.3
02CA: BSF 03.0
02CB: BTFSS 07.3
02CC: BCF 03.0
02CD: RLF 78,F
02CE: NOP
02CF: BCF 28.4
02D0: MOVF 28,W
02D1: BSF 03.5
02D2: MOVWF 07
02D3: BCF 03.5
02D4: BCF 07.4
02D5: BSF 03.6
02D6: DECFSZ 13,F
02D7: GOTO 2BB
02D8: BCF 03.6
02D9: BSF 28.3
02DA: MOVF 28,W
02DB: BSF 03.5
02DC: MOVWF 07
02DD: NOP
02DE: BCF 03.5
02DF: BCF 07.3
02E0: BSF 03.6
02E1: MOVF 14,W
02E2: BTFSC 03.2
02E3: GOTO 2EB
02E4: BCF 03.6
02E5: BCF 28.3
02E6: MOVF 28,W
02E7: BSF 03.5
02E8: MOVWF 07
02E9: BCF 03.5
02EA: BSF 03.6
02EB: NOP
02EC: BCF 03.6
02ED: BSF 28.4
02EE: MOVF 28,W
02EF: BSF 03.5
02F0: MOVWF 07
02F1: BCF 03.5
02F2: BTFSS 07.4
02F3: GOTO 2F2
02F4: NOP
02F5: BCF 07.4
02F6: BCF 28.4
02F7: MOVF 28,W
02F8: BSF 03.5
02F9: MOVWF 07
02FA: NOP
02FB: BCF 03.5
02FC: BCF 07.3
02FD: BCF 28.3
02FE: MOVF 28,W
02FF: BSF 03.5
0300: MOVWF 07
0301: BCF 03.5
0302: RETURN
.................... //set RS232
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
*
0F62: BCF 03.5
0F63: BCF 28.7
0F64: MOVF 28,W
0F65: BSF 03.5
0F66: MOVWF 07
0F67: BCF 03.5
0F68: BCF 07.7
0F69: MOVLW 08
0F6A: MOVWF 78
0F6B: GOTO 76C
0F6C: NOP
0F6D: BSF 78.7
0F6E: GOTO 77F
0F6F: BCF 78.7
0F70: BSF 03.5
0F71: RRF 5F,F
0F72: BCF 03.5
0F73: BTFSC 03.0
0F74: BSF 07.7
0F75: BTFSS 03.0
0F76: BCF 07.7
0F77: BSF 78.6
0F78: GOTO 77F
0F79: BCF 78.6
0F7A: DECFSZ 78,F
0F7B: GOTO 770
0F7C: GOTO 77D
0F7D: NOP
0F7E: BSF 07.7
0F7F: MOVLW 3F
0F80: MOVWF 04
0F81: DECFSZ 04,F
0F82: GOTO 781
0F83: NOP
0F84: BTFSC 78.7
0F85: GOTO 76F
0F86: BTFSC 78.6
0F87: GOTO 779
....................
....................
.................... #include <math.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2008 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// History: ////
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. ////
.................... //// The code now is small, much faster, ////
.................... //// and more accurate. ////
.................... //// * 2/21/2007 : Compiler handles & operator differently and does
.................... //// not return generic (int8 *) so type cast is done ////
.................... //// ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef MATH_H
.................... #define MATH_H
....................
.................... #ifdef PI
.................... #undef PI
.................... #endif
.................... #define PI 3.1415926535897932
....................
....................
.................... #define SQRT2 1.4142135623730950
....................
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279};
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718};
....................
.................... ///////////////////////////// Round Functions //////////////////////////////
....................
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n)
.................... {
.................... float32 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float32)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float32)l);
.................... res = 32768.0*(float32)l;
.................... res += (float32)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float32)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
....................
.................... // Overloaded Functions to take care for new Data types in PCD
.................... // Overloaded function CEIL_FLOOR() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n)
.................... {
.................... float48 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float48)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float48)l);
.................... res = 32768.0*(float32)l;
.................... res += (float48)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float48)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
....................
....................
.................... // Overloaded function CEIL_FLOOR() for data type - Float64
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n)
.................... {
.................... float64 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float64)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float64)l);
.................... res = 32768.0*(float64)l;
.................... res += (float64)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float64)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float floor(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : rounds down the number x.
.................... // Date : N/A
.................... //
.................... float32 floor(float32 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
.................... // Following 2 functions are overloaded functions of floor() for PCD
.................... // Overloaded function floor() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 floor(float48 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
....................
.................... // Overloaded function floor() for data type - Float64
.................... float64 floor(float64 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
.................... #endif
....................
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float ceil(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : rounds up the number x.
.................... // Date : N/A
.................... //
.................... float32 ceil(float32 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
.................... // Following 2 functions are overloaded functions of ceil() for PCD
.................... // Overloaded function ceil() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 ceil(float48 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
....................
.................... // Overloaded function ceil() for data type - Float64
.................... float64 ceil(float64 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float fabs(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the absolute value of floating point number x
.................... // Returns : returns the absolute value of x
.................... // Date : N/A
.................... //
.................... #define fabs abs
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float fmod(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the floating point remainder of x/y
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the
.................... // magnitude of y. If y is zero then a domain error occurs.
.................... // Date : N/A
.................... //
....................
.................... float fmod(float32 x,float32 y)
.................... {
.................... float32 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... //Overloaded function for fmod() for PCD
.................... // Overloaded function fmod() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 fmod(float48 x,float48 y)
.................... {
.................... float48 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... // Overloaded function fmod() for data type - Float64
.................... float64 fmod(float64 x,float64 y)
.................... {
.................... float64 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... #endif
.................... //////////////////// Exponential and logarithmic functions ////////////////////
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float exp(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (e^x)
.................... // Date : N/A
.................... //
.................... #define LN2 0.6931471805599453
....................
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093,
.................... 0.0554965651, 0.240227138, 0.693147172};
....................
....................
.................... float32 exp(float32 x)
.................... {
.................... float32 y, res, r;
.................... #if defined(__PCD__)
.................... int8 data1;
.................... #endif
.................... signed int8 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 88.722838)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&res)) = n + 0x7F;
.................... #endif
....................
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD
.................... data1 = n+0x7F;
.................... if(bit_test(data1,0))
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7);
.................... rotate_right(&data1,1);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&res)+3)) = data1;
.................... #endif
....................
.................... y = y/LN2 - (float32)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
....................
.................... //Overloaded function for exp() for PCD
.................... // Overloaded function exp() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 exp(float48 x)
.................... {
.................... float48 y, res, r;
.................... int8 data1;
.................... signed int8 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 88.722838)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
....................
.................... data1 = n+0x7F;
.................... if(bit_test(data1,0))
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7);
.................... rotate_right(&data1,1);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&res)+5)) = data1;
....................
.................... y = y/LN2 - (float48)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
.................... // Overloaded function exp() for data type - Float64
.................... float64 exp(float64 x)
.................... {
.................... float64 y, res, r;
.................... unsigned int16 data1, data2;
.................... unsigned int16 *p;
.................... signed int16 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 709.7827128)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
....................
.................... #if !defined(__PCD__)
.................... *((unsigned int16 *)(&res)) = n + 0x7F;
.................... #endif
.................... p= (((unsigned int16 *)(&res))+3);
.................... data1 = *p;
.................... data2 = *p;
.................... data1 = n + 0x3FF;
.................... data1 = data1 <<4;
.................... if(bit_test(data2,15))
.................... bit_set(data1,15);
.................... data2 = data2 & 0x000F;
.................... data1 ^= data2;
....................
.................... *(((unsigned int16 *)(&res)+3)) = data1;
....................
....................
.................... y = y/LN2 - (float64)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
.................... #ENDIF
....................
....................
.................... /************************************************************/
....................
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float log(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the the natural log of x
.................... // Date : N/A
.................... //
.................... float32 log(float32 x)
.................... {
.................... float32 y, res, r, y2;
.................... #if defined(__PCD__)
.................... unsigned int8 data1,data2;
.................... #endif
.................... signed int8 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
....................
.................... #if defined(__PCD__) // Takes care of IEEE format
.................... data2 = *(((unsigned int8 *)(&y))+3);
.................... *(((unsigned int8 *)(&y))+3) = 0x3F;
.................... data1 = *(((unsigned int8 *)(&y))+2);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&y))+2) = data1;
.................... if(bit_test(data2,7))
.................... bit_set(*(((unsigned int8 *)(&y))+3),7);
.................... #endif
....................
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl[0]*y2 + pl[1];
.................... res = res*y2 + pl[2];
.................... res = res*y2 + pl[3];
....................
.................... r = ql[0]*y2 + ql[1];
.................... r = r*y2 + ql[2];
.................... r = r*y2 + ql[3];
....................
.................... res = y*res/r;
.................... #if !defined(__PCD__)
.................... n = *((unsigned int8 *)(&x)) - 0x7E;
.................... #endif
.................... #if defined(__PCD__)
.................... data1 = *(((unsigned int8 *)(&x)+3));
.................... rotate_left(&data1,1);
.................... data2 = *(((unsigned int8 *)(&x)+2));
.................... if(bit_test (data2,7))
.................... bit_set(data1,0);
.................... n = data1 - 0x7E;
.................... #endif
....................
.................... if (n<0)
.................... r = -(float32)-n;
.................... else
.................... r = (float32)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
....................
.................... //Overloaded function for log() for PCD
.................... // Overloaded function log() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 log(float48 x)
.................... {
.................... float48 y, res, r, y2;
.................... unsigned int8 data1,data2;
.................... signed int8 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
....................
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
.................... data2 = *(((unsigned int8 *)(&y))+5);
.................... *(((unsigned int8 *)(&y))+5) = 0x3F;
.................... data1 = *(((unsigned int8 *)(&y))+4);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&y))+4) = data1;
....................
.................... if(bit_test(data2,7))
.................... bit_set(*(((unsigned int8 *)(&y))+4),7);
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl[0]*y2 + pl[1];
.................... res = res*y2 + pl[2];
.................... res = res*y2 + pl[3];
....................
.................... r = ql[0]*y2 + ql[1];
.................... r = r*y2 + ql[2];
.................... r = r*y2 + ql[3];
....................
.................... res = y*res/r;
....................
.................... data1 = *(((unsigned int8 *)(&x)+5));
.................... rotate_left(&data1,1);
.................... data2 = *(((unsigned int8 *)(&x)+4));
.................... if(bit_test (data2,7))
.................... bit_set(data1,0);
....................
.................... n = data1 - 0x7E;
....................
.................... if (n<0)
.................... r = -(float48)-n;
.................... else
.................... r = (float48)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function log() for data type - Float48
.................... #if defined(__PCD__)
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
.................... #endif
.................... float64 log(float64 x)
.................... {
.................... float64 y, res, r, y2;
.................... unsigned int16 data1,data2;
.................... unsigned int16 *p;
.................... signed int16 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
.................... p= (((unsigned int16 *)(&y))+3);
.................... data1 = *p;
.................... data2 = *p;
.................... data1 = 0x3FE;
.................... data1 = data1 <<4;
.................... if(bit_test (data2,15))
.................... bit_set(data1,15);
.................... data2 = data2 & 0x000F;
.................... data1 ^=data2;
....................
.................... *p = data1;
....................
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl_64[0]*y2 + pl_64[1];
.................... res = res*y2 + pl_64[2];
.................... res = res*y2 + pl_64[3];
....................
.................... r = ql_64[0]*y2 + ql_64[1];
.................... r = r*y2 + ql_64[2];
.................... r = r*y2 + ql_64[3];
....................
.................... res = y*res/r;
....................
.................... p= (((unsigned int16 *)(&x))+3);
.................... data1 = *p;
.................... bit_clear(data1,15);
.................... data1 = data1 >>4;
.................... n = data1 - 0x3FE;
....................
....................
.................... if (n<0)
.................... r = -(float64)-n;
.................... else
.................... r = (float64)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
.................... #endif
....................
....................
.................... #define LN10 2.3025850929940456
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float log10(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the the log base 10 of x
.................... // Date : N/A
.................... //
.................... float32 log10(float32 x)
.................... {
.................... float32 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
....................
.................... //Overloaded functions for log10() for PCD
.................... // Overloaded function log10() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 log10(float48 x)
.................... {
.................... float48 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
....................
.................... // Overloaded function log10() for data type - Float64
.................... float64 log10(float64 x)
.................... {
.................... float64 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
.................... #endif
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float modf(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description :breaks the argument value int integral and fractional parts,
.................... // ach of which have the same sign as the argument. It stores the integral part
.................... // as a float in the object pointed to by the iptr
.................... // Returns : returns the signed fractional part of value.
.................... // Date : N/A
.................... //
....................
.................... float32 modf(float32 value,float32 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... //Overloaded functions for modf() for PCD
.................... // Overloaded function modf() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 modf(float48 value,float48 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... // Overloaded function modf() for data type - Float64
.................... float64 modf(float64 value,float64 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float pwr(float x,float y)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (x^y)
.................... // Date : N/A
.................... // Note : 0 is returned when the function will generate an imaginary number
.................... //
.................... float32 pwr(float32 x,float32 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... //Overloaded functions for pwr() for PCD
.................... // Overloaded function pwr() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 pwr(float48 x,float48 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... // Overloaded function pwr() for data type - Float64
.................... float64 pwr(float64 x,float64 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... #endif
....................
.................... //////////////////// Power functions ////////////////////
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float pow(float x,float y)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (x^y)
.................... // Date : N/A
.................... // Note : 0 is returned when the function will generate an imaginary number
.................... //
.................... float32 pow(float32 x,float32 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... //Overloaded functions for pow() for PCD
.................... // Overloaded function for pow() data type - Float48
.................... #if defined(__PCD__)
.................... float48 pow(float48 x,float48 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
....................
.................... // Overloaded function pow() for data type - Float64
.................... float64 pow(float64 x,float64 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sqrt(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the square root of x
.................... // Date : N/A
.................... //
.................... float32 sqrt(float32 x)
.................... {
.................... float32 y, res;
.................... #if defined(__PCD__)
.................... unsigned int16 data1,data2;
.................... #endif
.................... BYTE *p;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
....................
.................... #if !defined(__PCD__)
.................... p=&y;
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
.................... #endif
....................
.................... #if defined(__PCD__)
.................... p = (((unsigned int8 *)(&y))+3);
.................... data1 = *(((unsigned int8 *)(&y))+3);
.................... data2 = *(((unsigned int8 *)(&y))+2);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1 = ((data1+127) >>1);
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+3) = data1;
.................... *(((unsigned int8 *)(&y))+2) = data2;
....................
.................... #endif
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
....................
.................... #if !defined(__PCD__)
.................... (*p)--;
.................... #endif
....................
.................... #if defined(__PCD__)
.................... data1 = *(((unsigned int8 *)(&y))+3);
.................... data2 = *(((unsigned int8 *)(&y))+2);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1--;
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+3) = data1;
.................... *(((unsigned int8 *)(&y))+2) = data2;
....................
.................... #endif
.................... } while(res != y);
....................
.................... return(res);
.................... }
.................... //Overloaded functions for sqrt() for PCD
.................... // Overloaded function sqrt() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sqrt(float48 x)
.................... {
.................... float48 y, res;
.................... unsigned int16 data1,data2;
.................... BYTE *p;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
....................
.................... #if !defined(__PCD__)
.................... p=&y;
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
.................... #endif
....................
.................... #if defined(__PCD__)
.................... p = (((unsigned int8 *)(&y))+5);
.................... data1 = *(((unsigned int8 *)(&y))+5);
.................... data2 = *(((unsigned int8 *)(&y))+4);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1 = ((data1+127) >>1);
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+5) = data1;
.................... *(((unsigned int8 *)(&y))+4) = data2;
....................
.................... #endif
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
....................
.................... #if !defined(__PCD__)
.................... (*p)--;
.................... #endif
....................
.................... data1 = *(((unsigned int8 *)(&y))+5);
.................... data2 = *(((unsigned int8 *)(&y))+4);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1--;
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+5) = data1;
.................... *(((unsigned int8 *)(&y))+4) = data2;
....................
.................... } while(res != y);
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function sqrt() for data type - Float64
.................... float64 sqrt(float64 x)
.................... {
.................... float64 y, res;
.................... unsigned int16 *p;
.................... unsigned int16 temp1,temp2;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
.................... p= (((unsigned int16 *)(&y))+3);
.................... temp1 = *p;
.................... temp2 = *p;
.................... bit_clear(temp1,15);
.................... temp1 = (temp1>>4)+1023;
.................... temp1 = temp1 >> 1;
.................... temp1 = (temp1<<4) & 0xFFF0;
.................... if(bit_test(temp2,15))
.................... bit_set(temp1,15);
.................... temp2 = temp2 & 0x000F;
.................... temp1 ^= temp2;
....................
.................... (*p) = temp1;
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
.................... temp1 = *p;
.................... temp2 = *p;
.................... bit_clear(temp1,15);
.................... temp1 = (temp1>>4);
.................... temp1--;
.................... temp1 = (temp1<<4) & 0xFFF0;
.................... if(bit_test(temp2,15))
.................... bit_set(temp1,15);
.................... temp2 = temp2 & 0x000F;
.................... temp1 ^= temp2;
.................... (*p) = temp1;
....................
.................... } while(res != y);
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... ////////////////////////////// Trig Functions //////////////////////////////
.................... #ifdef PI_DIV_BY_TWO
.................... #undef PI_DIV_BY_TWO
.................... #endif
.................... #define PI_DIV_BY_TWO 1.5707963267948966
.................... #ifdef TWOBYPI
.................... #undef TWOBYPI
.................... #define TWOBYPI 0.6366197723675813
.................... #endif
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float cos(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the cosine value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 cos(float32 x)
.................... {
.................... float32 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float32 frac;
.................... float32 p[6] = { //by the series definition for cosine
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
.................... 0.04166666666667,
.................... -0.00138888888889,
.................... 0.00002480158730,
.................... -0.00000027557319,
.................... 0.00000000208767,
.................... //-0.00000000001147,
.................... // 0.00000000000005
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 1.0;
.................... t = t * t;
.................... for (i = 0; i <= 5; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
....................
.................... //Overloaded functions for cos() for PCD
.................... // Overloaded function cos() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 cos(float48 x)
.................... {
.................... float48 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float48 frac;
.................... float48 p[6] = { //by the series definition for cosine
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
.................... 0.04166666666667,
.................... -0.00138888888889,
.................... 0.00002480158730,
.................... -0.00000027557319,
.................... 0.00000000208767,
.................... //-0.00000000001147,
.................... // 0.00000000000005
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 5; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
.................... // Overloaded function cos() for data type - Float48
.................... float64 cos(float64 x)
.................... {
.................... float64 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float64 frac;
.................... float64 p[6] = { //by the series definition for cosine
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
.................... 0.04166666666667,
.................... -0.00138888888889,
.................... 0.00002480158730,
.................... -0.00000027557319,
.................... 0.00000000208767,
.................... //-0.00000000001147,
.................... // 0.00000000000005
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 5; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sin(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the sine value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 sin(float32 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
....................
.................... //Overloaded functions for sin() for PCD
.................... // Overloaded function sin() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sin(float48 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
....................
.................... // Overloaded function sin() for data type - Float48
.................... float64 sin(float64 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float tan(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the tangent value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 tan(float32 x)
.................... {
.................... float32 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
.................... //Overloaded functions for tan() for PCD
.................... // Overloaded function tan() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 tan(float48 x)
.................... {
.................... float48 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
....................
.................... // Overloaded function tan() for data type - Float48
.................... float64 tan(float64 x)
.................... {
.................... float64 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
.................... #endif
....................
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290};
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290};
....................
.................... float32 ASIN_COS(float32 x, unsigned int8 n)
.................... {
.................... float32 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
....................
.................... //Overloaded functions for ASIN_COS() for PCD
.................... // Overloaded function ASIN_COS() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 ASIN_COS(float48 x, unsigned int8 n)
.................... {
.................... float48 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function ASIN_COS() for data type - Float64
.................... float64 ASIN_COS(float64 x, unsigned int8 n)
.................... {
.................... float64 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float asin(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arcsine value of the value x.
.................... // Date : N/A
.................... //
.................... float32 asin(float32 x)
.................... {
.................... float32 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
.................... //Overloaded functions for asin() for PCD
.................... // Overloaded function asin() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 asin(float48 x)
.................... {
.................... float48 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
....................
.................... // Overloaded function asin() for data type - Float64
.................... float64 asin(float64 x)
.................... {
.................... float64 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float acos(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arccosine value of the value x.
.................... // Date : N/A
.................... //
.................... float32 acos(float32 x)
.................... {
.................... float32 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
.................... //Overloaded functions for acos() for PCD
.................... // Overloaded function acos() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 acos(float48 x)
.................... {
.................... float48 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
....................
.................... // Overloaded function acos() for data type - Float64
.................... float64 acos(float64 x)
.................... {
.................... float64 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
.................... #endif
....................
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457};
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457};
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float atan(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arctangent value of the value x.
.................... // Date : N/A
.................... //
.................... float32 atan(float32 x)
.................... {
.................... float32 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
*
10E7: BCF 6F.0
.................... flag = 0;
10E8: BCF 6F.1
.................... y = x;
10E9: MOVF 6E,W
10EA: BCF 03.5
10EB: BSF 03.6
10EC: MOVWF 13
10ED: BSF 03.5
10EE: BCF 03.6
10EF: MOVF 6D,W
10F0: BCF 03.5
10F1: BSF 03.6
10F2: MOVWF 12
10F3: BSF 03.5
10F4: BCF 03.6
10F5: MOVF 6C,W
10F6: BCF 03.5
10F7: BSF 03.6
10F8: MOVWF 11
10F9: BSF 03.5
10FA: BCF 03.6
10FB: MOVF 6B,W
10FC: BCF 03.5
10FD: BSF 03.6
10FE: MOVWF 10
....................
.................... if (x < 0)
10FF: BSF 03.5
1100: BCF 03.6
1101: MOVF 6E,W
1102: BCF 03.5
1103: BSF 03.6
1104: MOVWF 20
1105: BSF 03.5
1106: BCF 03.6
1107: MOVF 6D,W
1108: BCF 03.5
1109: BSF 03.6
110A: MOVWF 1F
110B: BSF 03.5
110C: BCF 03.6
110D: MOVF 6C,W
110E: BCF 03.5
110F: BSF 03.6
1110: MOVWF 1E
1111: BSF 03.5
1112: BCF 03.6
1113: MOVF 6B,W
1114: BCF 03.5
1115: BSF 03.6
1116: MOVWF 1D
1117: CLRF 24
1118: CLRF 23
1119: CLRF 22
111A: CLRF 21
111B: BCF 0A.4
111C: BSF 0A.3
111D: BCF 03.6
111E: CALL 5A9
111F: BSF 0A.4
1120: BCF 0A.3
1121: BTFSS 03.0
1122: GOTO 12B
.................... {
.................... s = 1;
1123: BSF 03.5
1124: BSF 6F.0
.................... y = -y;
1125: BCF 03.5
1126: BSF 03.6
1127: MOVF 11,W
1128: XORLW 80
1129: MOVWF 11
112A: BCF 03.6
.................... }
....................
.................... if (y > 1.0)
112B: BSF 03.6
112C: CLRF 20
112D: CLRF 1F
112E: CLRF 1E
112F: MOVLW 7F
1130: MOVWF 1D
1131: MOVF 13,W
1132: MOVWF 24
1133: MOVF 12,W
1134: MOVWF 23
1135: MOVF 11,W
1136: MOVWF 22
1137: MOVF 10,W
1138: MOVWF 21
1139: BCF 0A.4
113A: BSF 0A.3
113B: BCF 03.6
113C: CALL 5A9
113D: BSF 0A.4
113E: BCF 0A.3
113F: BTFSS 03.0
1140: GOTO 166
1141: CLRF 27
1142: BTFSC 0B.7
1143: BSF 27.7
1144: BCF 0B.7
.................... {
.................... y = 1.0/y;
1145: BSF 03.6
1146: CLRF 59
1147: CLRF 58
1148: CLRF 57
1149: MOVLW 7F
114A: MOVWF 56
114B: MOVF 13,W
114C: MOVWF 5D
114D: MOVF 12,W
114E: MOVWF 5C
114F: MOVF 11,W
1150: MOVWF 5B
1151: MOVF 10,W
1152: MOVWF 5A
1153: BCF 0A.4
1154: BCF 03.6
1155: CALL 057
1156: BSF 0A.4
1157: BTFSC 27.7
1158: BSF 0B.7
1159: MOVF 7A,W
115A: BSF 03.6
115B: MOVWF 13
115C: MOVF 79,W
115D: MOVWF 12
115E: MOVF 78,W
115F: MOVWF 11
1160: MOVF 77,W
1161: MOVWF 10
.................... flag = 1;
1162: BSF 03.5
1163: BCF 03.6
1164: BSF 6F.1
1165: BCF 03.5
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
1166: MOVLW 0A
1167: BSF 03.6
1168: MOVWF 24
1169: MOVLW 89
116A: MOVWF 23
116B: MOVLW 34
116C: MOVWF 22
116D: MOVLW 7C
116E: MOVWF 21
116F: MOVF 13,W
1170: MOVWF 28
1171: MOVF 12,W
1172: MOVWF 27
1173: MOVF 11,W
1174: MOVWF 26
1175: MOVF 10,W
1176: MOVWF 25
1177: BCF 0A.4
1178: BSF 0A.3
1179: BCF 03.6
117A: CALL 2AB
117B: BSF 0A.4
117C: BCF 0A.3
117D: MOVF 77,W
117E: BSF 03.6
117F: MOVWF 1C
1180: MOVF 78,W
1181: MOVWF 1D
1182: MOVF 79,W
1183: MOVWF 1E
1184: MOVF 7A,W
1185: MOVWF 1F
1186: MOVWF 24
1187: MOVF 1E,W
1188: MOVWF 23
1189: MOVF 1D,W
118A: MOVWF 22
118B: MOVF 1C,W
118C: MOVWF 21
118D: MOVF 13,W
118E: MOVWF 28
118F: MOVF 12,W
1190: MOVWF 27
1191: MOVF 11,W
1192: MOVWF 26
1193: MOVF 10,W
1194: MOVWF 25
1195: BCF 0A.4
1196: BSF 0A.3
1197: BCF 03.6
1198: CALL 2AB
1199: BSF 0A.4
119A: BCF 0A.3
119B: MOVF 77,W
119C: BSF 03.6
119D: MOVWF 1C
119E: MOVF 78,W
119F: MOVWF 1D
11A0: MOVF 79,W
11A1: MOVWF 1E
11A2: MOVF 7A,W
11A3: MOVWF 1F
11A4: BCF 03.1
11A5: MOVF 1F,W
11A6: MOVWF 24
11A7: MOVF 1E,W
11A8: MOVWF 23
11A9: MOVF 1D,W
11AA: MOVWF 22
11AB: MOVF 1C,W
11AC: MOVWF 21
11AD: MOVLW 7C
11AE: MOVWF 28
11AF: MOVLW 79
11B0: MOVWF 27
11B1: MOVLW 35
11B2: MOVWF 26
11B3: MOVLW 81
11B4: MOVWF 25
11B5: BCF 0A.4
11B6: BCF 03.6
11B7: CALL 5DC
11B8: BSF 0A.4
11B9: MOVF 7A,W
11BA: BSF 03.6
11BB: MOVWF 17
11BC: MOVF 79,W
11BD: MOVWF 16
11BE: MOVF 78,W
11BF: MOVWF 15
11C0: MOVF 77,W
11C1: MOVWF 14
.................... res = res*y*y + pat[2];
11C2: MOVF 17,W
11C3: MOVWF 24
11C4: MOVF 16,W
11C5: MOVWF 23
11C6: MOVF 15,W
11C7: MOVWF 22
11C8: MOVF 14,W
11C9: MOVWF 21
11CA: MOVF 13,W
11CB: MOVWF 28
11CC: MOVF 12,W
11CD: MOVWF 27
11CE: MOVF 11,W
11CF: MOVWF 26
11D0: MOVF 10,W
11D1: MOVWF 25
11D2: BCF 0A.4
11D3: BSF 0A.3
11D4: BCF 03.6
11D5: CALL 2AB
11D6: BSF 0A.4
11D7: BCF 0A.3
11D8: MOVF 77,W
11D9: BSF 03.6
11DA: MOVWF 1C
11DB: MOVF 78,W
11DC: MOVWF 1D
11DD: MOVF 79,W
11DE: MOVWF 1E
11DF: MOVF 7A,W
11E0: MOVWF 1F
11E1: MOVWF 24
11E2: MOVF 1E,W
11E3: MOVWF 23
11E4: MOVF 1D,W
11E5: MOVWF 22
11E6: MOVF 1C,W
11E7: MOVWF 21
11E8: MOVF 13,W
11E9: MOVWF 28
11EA: MOVF 12,W
11EB: MOVWF 27
11EC: MOVF 11,W
11ED: MOVWF 26
11EE: MOVF 10,W
11EF: MOVWF 25
11F0: BCF 0A.4
11F1: BSF 0A.3
11F2: BCF 03.6
11F3: CALL 2AB
11F4: BSF 0A.4
11F5: BCF 0A.3
11F6: MOVF 77,W
11F7: BSF 03.6
11F8: MOVWF 1C
11F9: MOVF 78,W
11FA: MOVWF 1D
11FB: MOVF 79,W
11FC: MOVWF 1E
11FD: MOVF 7A,W
11FE: MOVWF 1F
11FF: BCF 03.1
1200: MOVF 1F,W
1201: MOVWF 24
1202: MOVF 1E,W
1203: MOVWF 23
1204: MOVF 1D,W
1205: MOVWF 22
1206: MOVF 1C,W
1207: MOVWF 21
1208: MOVLW 3F
1209: MOVWF 28
120A: MOVLW 02
120B: MOVWF 27
120C: MOVLW 33
120D: MOVWF 26
120E: MOVLW 83
120F: MOVWF 25
1210: BCF 0A.4
1211: BCF 03.6
1212: CALL 5DC
1213: BSF 0A.4
1214: MOVF 7A,W
1215: BSF 03.6
1216: MOVWF 17
1217: MOVF 79,W
1218: MOVWF 16
1219: MOVF 78,W
121A: MOVWF 15
121B: MOVF 77,W
121C: MOVWF 14
.................... res = res*y*y + pat[3];
121D: MOVF 17,W
121E: MOVWF 24
121F: MOVF 16,W
1220: MOVWF 23
1221: MOVF 15,W
1222: MOVWF 22
1223: MOVF 14,W
1224: MOVWF 21
1225: MOVF 13,W
1226: MOVWF 28
1227: MOVF 12,W
1228: MOVWF 27
1229: MOVF 11,W
122A: MOVWF 26
122B: MOVF 10,W
122C: MOVWF 25
122D: BCF 0A.4
122E: BSF 0A.3
122F: BCF 03.6
1230: CALL 2AB
1231: BSF 0A.4
1232: BCF 0A.3
1233: MOVF 77,W
1234: BSF 03.6
1235: MOVWF 1C
1236: MOVF 78,W
1237: MOVWF 1D
1238: MOVF 79,W
1239: MOVWF 1E
123A: MOVF 7A,W
123B: MOVWF 1F
123C: MOVWF 24
123D: MOVF 1E,W
123E: MOVWF 23
123F: MOVF 1D,W
1240: MOVWF 22
1241: MOVF 1C,W
1242: MOVWF 21
1243: MOVF 13,W
1244: MOVWF 28
1245: MOVF 12,W
1246: MOVWF 27
1247: MOVF 11,W
1248: MOVWF 26
1249: MOVF 10,W
124A: MOVWF 25
124B: BCF 0A.4
124C: BSF 0A.3
124D: BCF 03.6
124E: CALL 2AB
124F: BSF 0A.4
1250: BCF 0A.3
1251: MOVF 77,W
1252: BSF 03.6
1253: MOVWF 1C
1254: MOVF 78,W
1255: MOVWF 1D
1256: MOVF 79,W
1257: MOVWF 1E
1258: MOVF 7A,W
1259: MOVWF 1F
125A: BCF 03.1
125B: MOVF 1F,W
125C: MOVWF 24
125D: MOVF 1E,W
125E: MOVWF 23
125F: MOVF 1D,W
1260: MOVWF 22
1261: MOVF 1C,W
1262: MOVWF 21
1263: MOVLW 33
1264: MOVWF 28
1265: MOVLW 8C
1266: MOVWF 27
1267: MOVLW 1E
1268: MOVWF 26
1269: MOVLW 83
126A: MOVWF 25
126B: BCF 0A.4
126C: BCF 03.6
126D: CALL 5DC
126E: BSF 0A.4
126F: MOVF 7A,W
1270: BSF 03.6
1271: MOVWF 17
1272: MOVF 79,W
1273: MOVWF 16
1274: MOVF 78,W
1275: MOVWF 15
1276: MOVF 77,W
1277: MOVWF 14
....................
.................... r = qat[0]*y*y + qat[1];
1278: CLRF 24
1279: CLRF 23
127A: CLRF 22
127B: MOVLW 7F
127C: MOVWF 21
127D: MOVF 13,W
127E: MOVWF 28
127F: MOVF 12,W
1280: MOVWF 27
1281: MOVF 11,W
1282: MOVWF 26
1283: MOVF 10,W
1284: MOVWF 25
1285: BCF 0A.4
1286: BSF 0A.3
1287: BCF 03.6
1288: CALL 2AB
1289: BSF 0A.4
128A: BCF 0A.3
128B: MOVF 77,W
128C: BSF 03.6
128D: MOVWF 1C
128E: MOVF 78,W
128F: MOVWF 1D
1290: MOVF 79,W
1291: MOVWF 1E
1292: MOVF 7A,W
1293: MOVWF 1F
1294: MOVWF 24
1295: MOVF 1E,W
1296: MOVWF 23
1297: MOVF 1D,W
1298: MOVWF 22
1299: MOVF 1C,W
129A: MOVWF 21
129B: MOVF 13,W
129C: MOVWF 28
129D: MOVF 12,W
129E: MOVWF 27
129F: MOVF 11,W
12A0: MOVWF 26
12A1: MOVF 10,W
12A2: MOVWF 25
12A3: BCF 0A.4
12A4: BSF 0A.3
12A5: BCF 03.6
12A6: CALL 2AB
12A7: BSF 0A.4
12A8: BCF 0A.3
12A9: MOVF 77,W
12AA: BSF 03.6
12AB: MOVWF 1C
12AC: MOVF 78,W
12AD: MOVWF 1D
12AE: MOVF 79,W
12AF: MOVWF 1E
12B0: MOVF 7A,W
12B1: MOVWF 1F
12B2: BCF 03.1
12B3: MOVF 1F,W
12B4: MOVWF 24
12B5: MOVF 1E,W
12B6: MOVWF 23
12B7: MOVF 1D,W
12B8: MOVWF 22
12B9: MOVF 1C,W
12BA: MOVWF 21
12BB: MOVLW 1B
12BC: MOVWF 28
12BD: MOVLW E4
12BE: MOVWF 27
12BF: MOVLW 35
12C0: MOVWF 26
12C1: MOVLW 82
12C2: MOVWF 25
12C3: BCF 0A.4
12C4: BCF 03.6
12C5: CALL 5DC
12C6: BSF 0A.4
12C7: MOVF 7A,W
12C8: BSF 03.6
12C9: MOVWF 1B
12CA: MOVF 79,W
12CB: MOVWF 1A
12CC: MOVF 78,W
12CD: MOVWF 19
12CE: MOVF 77,W
12CF: MOVWF 18
.................... r = r*y*y + qat[2];
12D0: MOVF 1B,W
12D1: MOVWF 24
12D2: MOVF 1A,W
12D3: MOVWF 23
12D4: MOVF 19,W
12D5: MOVWF 22
12D6: MOVF 18,W
12D7: MOVWF 21
12D8: MOVF 13,W
12D9: MOVWF 28
12DA: MOVF 12,W
12DB: MOVWF 27
12DC: MOVF 11,W
12DD: MOVWF 26
12DE: MOVF 10,W
12DF: MOVWF 25
12E0: BCF 0A.4
12E1: BSF 0A.3
12E2: BCF 03.6
12E3: CALL 2AB
12E4: BSF 0A.4
12E5: BCF 0A.3
12E6: MOVF 77,W
12E7: BSF 03.6
12E8: MOVWF 1C
12E9: MOVF 78,W
12EA: MOVWF 1D
12EB: MOVF 79,W
12EC: MOVWF 1E
12ED: MOVF 7A,W
12EE: MOVWF 1F
12EF: MOVWF 24
12F0: MOVF 1E,W
12F1: MOVWF 23
12F2: MOVF 1D,W
12F3: MOVWF 22
12F4: MOVF 1C,W
12F5: MOVWF 21
12F6: MOVF 13,W
12F7: MOVWF 28
12F8: MOVF 12,W
12F9: MOVWF 27
12FA: MOVF 11,W
12FB: MOVWF 26
12FC: MOVF 10,W
12FD: MOVWF 25
12FE: BCF 0A.4
12FF: BSF 0A.3
1300: BCF 03.6
1301: CALL 2AB
1302: BSF 0A.4
1303: BCF 0A.3
1304: MOVF 77,W
1305: BSF 03.6
1306: MOVWF 1C
1307: MOVF 78,W
1308: MOVWF 1D
1309: MOVF 79,W
130A: MOVWF 1E
130B: MOVF 7A,W
130C: MOVWF 1F
130D: BCF 03.1
130E: MOVF 1F,W
130F: MOVWF 24
1310: MOVF 1E,W
1311: MOVWF 23
1312: MOVF 1D,W
1313: MOVWF 22
1314: MOVF 1C,W
1315: MOVWF 21
1316: MOVLW A4
1317: MOVWF 28
1318: MOVLW DB
1319: MOVWF 27
131A: MOVLW 67
131B: MOVWF 26
131C: MOVLW 83
131D: MOVWF 25
131E: BCF 0A.4
131F: BCF 03.6
1320: CALL 5DC
1321: BSF 0A.4
1322: MOVF 7A,W
1323: BSF 03.6
1324: MOVWF 1B
1325: MOVF 79,W
1326: MOVWF 1A
1327: MOVF 78,W
1328: MOVWF 19
1329: MOVF 77,W
132A: MOVWF 18
.................... r = r*y*y + qat[3];
132B: MOVF 1B,W
132C: MOVWF 24
132D: MOVF 1A,W
132E: MOVWF 23
132F: MOVF 19,W
1330: MOVWF 22
1331: MOVF 18,W
1332: MOVWF 21
1333: MOVF 13,W
1334: MOVWF 28
1335: MOVF 12,W
1336: MOVWF 27
1337: MOVF 11,W
1338: MOVWF 26
1339: MOVF 10,W
133A: MOVWF 25
133B: BCF 0A.4
133C: BSF 0A.3
133D: BCF 03.6
133E: CALL 2AB
133F: BSF 0A.4
1340: BCF 0A.3
1341: MOVF 77,W
1342: BSF 03.6
1343: MOVWF 1C
1344: MOVF 78,W
1345: MOVWF 1D
1346: MOVF 79,W
1347: MOVWF 1E
1348: MOVF 7A,W
1349: MOVWF 1F
134A: MOVWF 24
134B: MOVF 1E,W
134C: MOVWF 23
134D: MOVF 1D,W
134E: MOVWF 22
134F: MOVF 1C,W
1350: MOVWF 21
1351: MOVF 13,W
1352: MOVWF 28
1353: MOVF 12,W
1354: MOVWF 27
1355: MOVF 11,W
1356: MOVWF 26
1357: MOVF 10,W
1358: MOVWF 25
1359: BCF 0A.4
135A: BSF 0A.3
135B: BCF 03.6
135C: CALL 2AB
135D: BSF 0A.4
135E: BCF 0A.3
135F: MOVF 77,W
1360: BSF 03.6
1361: MOVWF 1C
1362: MOVF 78,W
1363: MOVWF 1D
1364: MOVF 79,W
1365: MOVWF 1E
1366: MOVF 7A,W
1367: MOVWF 1F
1368: BCF 03.1
1369: MOVF 1F,W
136A: MOVWF 24
136B: MOVF 1E,W
136C: MOVWF 23
136D: MOVF 1D,W
136E: MOVWF 22
136F: MOVF 1C,W
1370: MOVWF 21
1371: MOVLW 33
1372: MOVWF 28
1373: MOVLW 8C
1374: MOVWF 27
1375: MOVLW 1E
1376: MOVWF 26
1377: MOVLW 83
1378: MOVWF 25
1379: BCF 0A.4
137A: BCF 03.6
137B: CALL 5DC
137C: BSF 0A.4
137D: MOVF 7A,W
137E: BSF 03.6
137F: MOVWF 1B
1380: MOVF 79,W
1381: MOVWF 1A
1382: MOVF 78,W
1383: MOVWF 19
1384: MOVF 77,W
1385: MOVWF 18
....................
.................... res = y*res/r;
1386: MOVF 13,W
1387: MOVWF 24
1388: MOVF 12,W
1389: MOVWF 23
138A: MOVF 11,W
138B: MOVWF 22
138C: MOVF 10,W
138D: MOVWF 21
138E: MOVF 17,W
138F: MOVWF 28
1390: MOVF 16,W
1391: MOVWF 27
1392: MOVF 15,W
1393: MOVWF 26
1394: MOVF 14,W
1395: MOVWF 25
1396: BCF 0A.4
1397: BSF 0A.3
1398: BCF 03.6
1399: CALL 2AB
139A: BSF 0A.4
139B: BCF 0A.3
139C: MOVF 77,W
139D: BSF 03.6
139E: MOVWF 1C
139F: MOVF 78,W
13A0: MOVWF 1D
13A1: MOVF 79,W
13A2: MOVWF 1E
13A3: MOVF 7A,W
13A4: MOVWF 1F
13A5: BCF 03.6
13A6: CLRF 27
13A7: BTFSC 0B.7
13A8: BSF 27.7
13A9: BCF 0B.7
13AA: BSF 03.6
13AB: MOVF 1F,W
13AC: MOVWF 59
13AD: MOVF 1E,W
13AE: MOVWF 58
13AF: MOVF 1D,W
13B0: MOVWF 57
13B1: MOVF 1C,W
13B2: MOVWF 56
13B3: MOVF 1B,W
13B4: MOVWF 5D
13B5: MOVF 1A,W
13B6: MOVWF 5C
13B7: MOVF 19,W
13B8: MOVWF 5B
13B9: MOVF 18,W
13BA: MOVWF 5A
13BB: BCF 0A.4
13BC: BCF 03.6
13BD: CALL 057
13BE: BSF 0A.4
13BF: BTFSC 27.7
13C0: BSF 0B.7
13C1: MOVF 7A,W
13C2: BSF 03.6
13C3: MOVWF 17
13C4: MOVF 79,W
13C5: MOVWF 16
13C6: MOVF 78,W
13C7: MOVWF 15
13C8: MOVF 77,W
13C9: MOVWF 14
....................
....................
.................... if (flag) // for |x| > 1
13CA: BSF 03.5
13CB: BCF 03.6
13CC: BTFSS 6F.1
13CD: GOTO 3F0
.................... res = PI_DIV_BY_TWO - res;
13CE: BSF 03.1
13CF: MOVLW DB
13D0: BCF 03.5
13D1: BSF 03.6
13D2: MOVWF 24
13D3: MOVLW 0F
13D4: MOVWF 23
13D5: MOVLW 49
13D6: MOVWF 22
13D7: MOVLW 7F
13D8: MOVWF 21
13D9: MOVF 17,W
13DA: MOVWF 28
13DB: MOVF 16,W
13DC: MOVWF 27
13DD: MOVF 15,W
13DE: MOVWF 26
13DF: MOVF 14,W
13E0: MOVWF 25
13E1: BCF 0A.4
13E2: BCF 03.6
13E3: CALL 5DC
13E4: BSF 0A.4
13E5: MOVF 7A,W
13E6: BSF 03.6
13E7: MOVWF 17
13E8: MOVF 79,W
13E9: MOVWF 16
13EA: MOVF 78,W
13EB: MOVWF 15
13EC: MOVF 77,W
13ED: MOVWF 14
13EE: BSF 03.5
13EF: BCF 03.6
.................... if (s)
13F0: BTFSS 6F.0
13F1: GOTO 3F9
.................... res = -res;
13F2: BCF 03.5
13F3: BSF 03.6
13F4: MOVF 15,W
13F5: XORLW 80
13F6: MOVWF 15
13F7: BSF 03.5
13F8: BCF 03.6
....................
.................... return(res);
13F9: BCF 03.5
13FA: BSF 03.6
13FB: MOVF 14,W
13FC: MOVWF 77
13FD: MOVF 15,W
13FE: MOVWF 78
13FF: MOVF 16,W
1400: MOVWF 79
1401: MOVF 17,W
1402: MOVWF 7A
.................... }
.................... //Overloaded functions for atan() for PCD
.................... // Overloaded function atan() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 atan(float48 x)
.................... {
.................... float48 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
.................... flag = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 1.0)
.................... {
.................... y = 1.0/y;
.................... flag = 1;
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
.................... res = res*y*y + pat[2];
.................... res = res*y*y + pat[3];
....................
.................... r = qat[0]*y*y + qat[1];
.................... r = r*y*y + qat[2];
.................... r = r*y*y + qat[3];
....................
.................... res = y*res/r;
....................
....................
.................... if (flag) // for |x| > 1
.................... res = PI_DIV_BY_TWO - res;
.................... if (s)
.................... res = -res;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function atan() for data type - Float64
.................... float64 atan(float64 x)
.................... {
.................... float64 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
.................... flag = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 1.0)
.................... {
.................... y = 1.0/y;
.................... flag = 1;
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
.................... res = res*y*y + pat[2];
.................... res = res*y*y + pat[3];
....................
.................... r = qat[0]*y*y + qat[1];
.................... r = r*y*y + qat[2];
.................... r = r*y*y + qat[3];
....................
.................... res = y*res/r;
....................
....................
.................... if (flag) // for |x| > 1
.................... res = PI_DIV_BY_TWO - res;
.................... if (s)
.................... res = -res;
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... /////////////////////////////////////////////////////////////////////////////
.................... // float atan2(float y, float x)
.................... /////////////////////////////////////////////////////////////////////////////
.................... // Description :computes the principal value of arc tangent of y/x, using the
.................... // signs of both the arguments to determine the quadrant of the return value
.................... // Returns : returns the arc tangent of y/x.
.................... // Date : N/A
.................... //
....................
.................... float32 atan2(float32 y,float32 x)
.................... {
.................... float32 z;
.................... int1 sign;
.................... unsigned int8 quad;
.................... sign=0;
.................... quad=0; //quadrant
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
.................... if(y<0.0)
.................... {
.................... sign=1;
.................... y=-y;
.................... }
.................... if(x<0.0)
.................... {
.................... x=-x;
.................... }
.................... if (x==0.0)
.................... {
.................... if(y==0.0)
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... else
.................... {
.................... if(sign)
.................... {
.................... return (-(PI_DIV_BY_TWO));
.................... }
.................... else
.................... {
.................... return (PI_DIV_BY_TWO);
.................... }
.................... }
.................... }
.................... else
.................... {
.................... z=y/x;
.................... switch(quad)
.................... {
.................... case 1:
.................... {
.................... return atan(z);
.................... break;
.................... }
.................... case 2:
.................... {
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
.................... return (PI-atan(z));
.................... break;
.................... }
.................... case 3:
.................... {
.................... return (atan(z)-PI);
.................... break;
.................... }
.................... case 4:
.................... {
.................... return (-atan(z));
.................... break;
.................... }
.................... }
.................... }
.................... }
....................
.................... //Overloaded functions for atan2() for PCD
.................... // Overloaded function atan2() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 atan2(float48 y,float48 x)
.................... {
.................... float48 z;
.................... int1 sign;
.................... unsigned int8 quad;
.................... sign=0;
.................... quad=0; //quadrant
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
.................... if(y<0.0)
.................... {
.................... sign=1;
.................... y=-y;
.................... }
.................... if(x<0.0)
.................... {
.................... x=-x;
.................... }
.................... if (x==0.0)
.................... {
.................... if(y==0.0)
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... else
.................... {
.................... if(sign)
.................... {
.................... return (-(PI_DIV_BY_TWO));
.................... }
.................... else
.................... {
.................... return (PI_DIV_BY_TWO);
.................... }
.................... }
.................... }
.................... else
.................... {
.................... z=y/x;
.................... switch(quad)
.................... {
.................... case 1:
.................... {
.................... return atan(z);
.................... break;
.................... }
.................... case 2:
.................... {
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
.................... return (PI-atan(z));
.................... break;
.................... }
.................... case 3:
.................... {
.................... return (atan(z)-PI);
.................... break;
.................... }
.................... case 4:
.................... {
.................... return (-atan(z));
.................... break;
.................... }
.................... }
.................... }
.................... }
....................
.................... // Overloaded function atan2() for data type - Float64
.................... float64 atan2(float64 y,float64 x)
.................... {
.................... float64 z;
.................... int1 sign;
.................... unsigned int8 quad;
.................... sign=0;
.................... quad=0; //quadrant
.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));
.................... if(y<0.0)
.................... {
.................... sign=1;
.................... y=-y;
.................... }
.................... if(x<0.0)
.................... {
.................... x=-x;
.................... }
.................... if (x==0.0)
.................... {
.................... if(y==0.0)
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... else
.................... {
.................... if(sign)
.................... {
.................... return (-(PI_DIV_BY_TWO));
.................... }
.................... else
.................... {
.................... return (PI_DIV_BY_TWO);
.................... }
.................... }
.................... }
.................... else
.................... {
.................... z=y/x;
.................... switch(quad)
.................... {
.................... case 1:
.................... {
.................... return atan(z);
.................... break;
.................... }
.................... case 2:
.................... {
.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122
.................... return (PI-atan(z));
.................... break;
.................... }
.................... case 3:
.................... {
.................... return (atan(z)-PI);
.................... break;
.................... }
.................... case 4:
.................... {
.................... return (-atan(z));
.................... break;
.................... }
.................... }
.................... }
.................... }
.................... #endif
....................
.................... //////////////////// Hyperbolic functions ////////////////////
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float cosh(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the hyperbolic cosine value of x
.................... // Returns : returns the hyperbolic cosine value of x
.................... // Date : N/A
.................... //
....................
.................... float32 cosh(float32 x)
.................... {
.................... return ((exp(x)+exp(-x))/2);
.................... }
.................... //Overloaded functions for cosh() for PCD
.................... // Overloaded function cosh() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 cosh(float48 x)
.................... {
.................... return ((exp(x)+exp(-x))/2);
.................... }
....................
.................... // Overloaded function cosh() for data type - Float64
.................... float64 cosh(float64 x)
.................... {
.................... return ((exp(x)+exp(-x))/2);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sinh(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the hyperbolic sine value of x
.................... // Returns : returns the hyperbolic sine value of x
.................... // Date : N/A
.................... //
....................
.................... float32 sinh(float32 x)
.................... {
....................
.................... return ((exp(x) - exp(-x))/2);
.................... }
.................... //Overloaded functions for sinh() for PCD
.................... // Overloaded function sinh() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sinh(float48 x)
.................... {
....................
.................... return ((exp(x) - exp(-x))/2);
.................... }
....................
.................... // Overloaded function sinh() for data type - Float48
.................... float64 sinh(float64 x)
.................... {
....................
.................... return ((exp(x) - exp(-x))/2);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float tanh(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the hyperbolic tangent value of x
.................... // Returns : returns the hyperbolic tangent value of x
.................... // Date : N/A
.................... //
....................
.................... float32 tanh(float32 x)
.................... {
.................... return(sinh(x)/cosh(x));
.................... }
.................... //Overloaded functions for tanh() for PCD
.................... // Overloaded function tanh() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 tanh(float48 x)
.................... {
.................... return(sinh(x)/cosh(x));
.................... }
....................
.................... // Overloaded function tanh() for data type - Float64
.................... float64 tanh(float64 x)
.................... {
.................... return(sinh(x)/cosh(x));
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float frexp(float x, signed int *exp)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : breaks a floating point number into a normalized fraction and an integral
.................... // power of 2. It stores the integer in the signed int object pointed to by exp.
.................... // Returns : returns the value x, such that x is a double with magnitude in the interval
.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero,
.................... // both parts of the result are zero.
.................... // Date : N/A
.................... //
....................
.................... #define LOG2 .30102999566398119521
.................... float32 frexp(float32 x, signed int8 *exp)
.................... {
.................... float32 res;
.................... int1 sign = 0;
.................... if(x == 0.0)
.................... {
.................... *exp=0;
.................... return (0.0);
.................... }
.................... if(x < 0.0)
.................... {
.................... x=-x;
.................... sign=1;
.................... }
.................... if (x > 1.0)
.................... {
.................... *exp=(ceil(log10(x)/LOG2));
.................... res=x/(pow(2, *exp));
.................... if (res == 1)
.................... {
.................... *exp=*exp+1;
.................... res=.5;
.................... }
.................... }
.................... else
.................... {
.................... if(x < 0.5)
.................... {
.................... *exp=-1;
.................... res=x*2;
.................... }
.................... else
.................... {
.................... *exp=0;
.................... res=x;
.................... }
.................... }
.................... if(sign)
.................... {
.................... res=-res;
.................... }
.................... return res;
.................... }
....................
.................... //Overloaded functions for frexp() for PCD
.................... // Overloaded function frexp() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 frexp(float48 x, signed int8 *exp)
.................... {
.................... float48 res;
.................... int1 sign = 0;
.................... if(x == 0.0)
.................... {
.................... *exp=0;
.................... return (0.0);
.................... }
.................... if(x < 0.0)
.................... {
.................... x=-x;
.................... sign=1;
.................... }
.................... if (x > 1.0)
.................... {
.................... *exp=(ceil(log10(x)/LOG2));
.................... res=x/(pow(2, *exp));
.................... if (res == 1)
.................... {
.................... *exp=*exp+1;
.................... res=.5;
.................... }
.................... }
.................... else
.................... {
.................... if(x < 0.5)
.................... {
.................... *exp=-1;
.................... res=x*2;
.................... }
.................... else
.................... {
.................... *exp=0;
.................... res=x;
.................... }
.................... }
.................... if(sign)
.................... {
.................... res=-res;
.................... }
.................... return res;
.................... }
....................
.................... // Overloaded function frexp() for data type - Float64
.................... float64 frexp(float64 x, signed int8 *exp)
.................... {
.................... float64 res;
.................... int1 sign = 0;
.................... if(x == 0.0)
.................... {
.................... *exp=0;
.................... return (0.0);
.................... }
.................... if(x < 0.0)
.................... {
.................... x=-x;
.................... sign=1;
.................... }
.................... if (x > 1.0)
.................... {
.................... *exp=(ceil(log10(x)/LOG2));
.................... res=x/(pow(2, *exp));
.................... if (res == 1)
.................... {
.................... *exp=*exp+1;
.................... res=.5;
.................... }
.................... }
.................... else
.................... {
.................... if(x < 0.5)
.................... {
.................... *exp=-1;
.................... res=x*2;
.................... }
.................... else
.................... {
.................... *exp=0;
.................... res=x;
.................... }
.................... }
.................... if(sign)
.................... {
.................... res=-res;
.................... }
.................... return res;
.................... }
.................... #endif
....................
.................... //////////////////////////////////////////////////////////////////////////////
.................... // float ldexp(float x, signed int *exp)
.................... //////////////////////////////////////////////////////////////////////////////
.................... // Description : multiplies a floating point number by an integral power of 2.
.................... // Returns : returns the value of x times 2 raised to the power exp.
.................... // Date : N/A
.................... //
....................
.................... float32 ldexp(float32 value, signed int8 exp)
.................... {
.................... return (value * pow(2,exp));
.................... }
.................... //Overloaded functions for ldexp() for PCD
.................... // Overloaded function ldexp() for data type - Float48
....................
.................... #if defined(__PCD__)
.................... float48 ldexp(float48 value, signed int8 exp)
.................... {
.................... return (value * pow(2,exp));
.................... }
.................... // Overloaded function ldexp() for data type - Float64
.................... float64 ldexp(float64 value, signed int8 exp)
.................... {
.................... return (value * pow(2,exp));
.................... }
.................... #endif
....................
.................... #endif
....................
.................... #include <string.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2008 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STRING
.................... #define _STRING
.................... #include <stddef.h>
.................... ///////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ///////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _STDDEF
....................
.................... #define _STDDEF
....................
.................... #if sizeof(unsigned int8 *)==1
.................... #define ptrdiff_t unsigned int8
.................... #else
.................... #define ptrdiff_t unsigned int16
.................... #endif
....................
.................... #define size_t unsigned int8
.................... #define wchar_t char
.................... #define NULL 0
....................
.................... #define offsetof(s,f) (offsetofbit(s,f)/8)
....................
.................... #endif
....................
.................... #include <ctype.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2003 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef _CTYPE
.................... #define _CTYPE
....................
.................... #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz")
.................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
.................... #define isdigit(x) isamong(x,"0123456789")
.................... #define isspace(x) ((x)==' ')
.................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef")
.................... #define iscntrl(x) ((x)<' ')
.................... #define isprint(x) ((x)>=' ')
.................... #define isgraph(x) ((x)>' ')
.................... #define ispunct(x) (((x)>' ')&&!isalnum(x))
....................
.................... #endif
....................
....................
....................
....................
....................
.................... //////////////////////////////////////////////
.................... //// Uncomment the following define to ////
.................... //// allow some functions to use a ////
.................... //// quicker algorithm, but use more ROM ////
.................... //// ////
.................... //// #define FASTER_BUT_MORE_ROM ////
.................... //////////////////////////////////////////////
....................
....................
....................
.................... /*Copying functions*/
.................... /* standard template:
.................... void *memmove(void *s1, void *s2, size_t n).
.................... Copies max of n characters safely (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *memmove(void *s1,char *s2,size_t n)
.................... {
.................... char *sc1;
.................... char *sc2;
.................... sc1=s1;
.................... sc2=s2;
.................... if(sc2<sc1 && sc1 <sc2 +n)
.................... for(sc1+=n,sc2+=n;0<n;--n)
.................... *--sc1=*--sc2;
.................... else
.................... for(;0<n;--n)
.................... *sc1++=*sc2++;
.................... return s1;
.................... }
....................
.................... /* Standard template: char *strcpy(char *s1, const char *s2)
.................... copies the string s2 including the null character to s1.
.................... This is a compiler built in to handle the different address
.................... spaces */
....................
.................... #define strcopy strcpy
....................
.................... /* standard template:
.................... char *strncpy(char *s1, const char *s2, size_t n).
.................... Copies max of n characters (not following ending '\0')
.................... from s2 in s1; if s2 has less than n characters, appends 0 */
....................
.................... char *strncpy(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(s1);
.................... }
.................... /***********************************************************/
....................
.................... /*concatenation functions*/
.................... /* standard template: char *strcat(char *s1, const char *s2)
.................... appends s2 to s1*/
....................
.................... char *strcat(char *s1, char *s2)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0')
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
.................... /* standard template: char *strncat(char *s1, char *s2,size_t n)
.................... appends not more than n characters from s2 to s1*/
....................
.................... char *strncat(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
....................
.................... for (s = s1; *s != '\0'; ++s);
.................... while(*s2 != '\0' && 0<n)
.................... {
.................... *s = *s2;
.................... ++s;
.................... ++s2;
.................... --n;
.................... }
....................
.................... *s = '\0';
.................... return(s1);
.................... }
....................
.................... /***********************************************************/
....................
....................
.................... /*comparison functions*/
.................... /* standard template: signed int memcmp(void *s1, void *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int8 memcmp(void * s1,char *s2,size_t n)
.................... {
.................... char *su1, *su2;
.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n)
.................... {
.................... if(*su1!=*su2)
.................... return ((*su1<*su2)?-1:+1);
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: int strcmp(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int8 strcmp(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
.................... /* standard template: int strcoll(const char *s1, const char *s2).
.................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */
....................
.................... signed int8 strcoll(char *s1, char *s2)
.................... {
.................... for (; *s1 == *s2; s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
....................
.................... /* standard template:
.................... int strncmp(const char *s1, const char *s2, size_t n).
.................... Compares max of n characters (not following 0) from s1 to s2;
.................... returns same as strcmp */
....................
.................... signed int8 strncmp(char *s1, char *s2, size_t n)
.................... {
.................... for (; n > 0; s1++, s2++, n--)
.................... if (*s1 != *s2)
.................... return((*s1 <*s2) ? -1: 1);
.................... else if (*s1 == '\0')
.................... return(0);
.................... return(0);
.................... }
.................... /* standard template:
.................... int strxfrm(const char *s1, const char *s2, size_t n).
.................... transforms maximum of n characters from s2 and places them into s1*/
.................... size_t strxfrm(char *s1, char *s2, size_t n)
.................... {
.................... char *s;
.................... unsigned int8 n1;
.................... n1=n;
.................... for (s = s1; n > 0 && *s2 != '\0'; n--)
.................... *s++ = *s2++;
.................... for (; n > 0; n--)
.................... *s++ = '\0';
....................
.................... return(n1);
.................... }
....................
....................
....................
....................
....................
.................... /***********************************************************/
.................... /*Search functions*/
.................... /* standard template: void *memchr(const char *s, int c).
.................... Finds first occurrence of c in n characters of s */
....................
.................... char *memchr(void *s,unsigned int8 c,size_t n)
.................... {
.................... char uc;
.................... char *su;
.................... uc=c;
.................... for(su=s;0<n;++su,--n)
.................... if(*su==uc)
.................... return su;
.................... return NULL;
.................... }
....................
.................... /* standard template: char *strchr(const char *s, int c).
.................... Finds first occurrence of c in s */
....................
.................... char *strchr(char *s, unsigned int8 c)
.................... {
.................... for (; *s != c; s++)
.................... if (*s == '\0')
.................... return(0);
.................... return(s);
.................... }
.................... /* standard template:
.................... size_t strcspn(const char *s1, const char *s2).
.................... Computes length of max initial segment of s1 that
.................... consists entirely of characters NOT from s2*/
....................
.................... unsigned int8 strcspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1 - s1);
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strpbrk(const char *s1, const char *s2).
.................... Locates first occurence of any character from s2 in s1;
.................... returns s1 if s2 is empty string */
....................
.................... char *strpbrk(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; *sc2 != 0; sc2++)
.................... if (*sc1 == *sc2)
.................... return(sc1);
.................... return(0);
.................... }
....................
....................
.................... /* standard template: char *strrchr(const char *s, int c).
.................... Finds last occurrence of c in s */
....................
.................... char *strrchr(char *s, unsigned int8 c)
.................... {
.................... char *p;
....................
.................... for (p = 0; ; s++)
.................... {
.................... if (*s == c)
.................... p = s;
.................... if (*s == '\0')
.................... return(p);
.................... }
.................... }
.................... /* computes length of max initial segment of s1 consisting
.................... entirely of characters from s2 */
....................
.................... unsigned int8 strspn(char *s1, char *s2)
.................... {
.................... char *sc1, *sc2;
....................
.................... for (sc1 = s1; *sc1 != 0; sc1++)
.................... for (sc2 = s2; ; sc2++)
.................... if (*sc2 == '\0')
.................... return(sc1 - s1);
.................... else if (*sc1 == *sc2)
.................... break;
.................... return(sc1 - s1);
.................... }
.................... /* standard template:
.................... char *strstr(const char *s1, const char *s2);
.................... Locates first occurence of character sequence s2 in s1;
.................... returns 0 if s2 is empty string
....................
.................... Uncomment #define FASTER_BUT_MORE_ROM at the top of the
.................... file to use the faster algorithm */
.................... char *strstr(char *s1, char *s2)
.................... {
.................... char *s, *t;
....................
.................... #ifdef FASTER_BUT_MORE_ROM
.................... if (*s2 == '\0')
.................... return(s1);
.................... #endif
....................
.................... while (*s1)
.................... {
.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t);
....................
.................... if (*t == '\0')
.................... return s1;
.................... ++s1;
.................... #ifdef FASTER_BUT_MORE_ROM
.................... while(*s1 != '\0' && *s1 != *s2)
.................... ++s1;
.................... #endif
.................... }
.................... return 0;
.................... }
....................
.................... /* standard template: char *strtok(char *s1, const char *s2).
....................
.................... Finds next token in s1 delimited by a character from separator
.................... string s2 (which can be different from call to call). First call
.................... starts at beginning of s1 searching for first character NOT
.................... contained in s2; returns 0 if none is found.
.................... If one is found, it is the start of first token (return value).
.................... Function then searches from there for a character contained in s2.
.................... If none is found, current token extends to end of s1, and subsequent
.................... searches for a token will return 0. If one is found, it is
.................... overwritten by '\0', which terminates current token. Function saves
.................... pointer to following character from which next search will start.
.................... Each subsequent call, with 0 as first argument, starts searching
.................... from saved pointer */
....................
.................... char *strtok(char *s1, char *s2)
.................... {
.................... char *beg, *end;
.................... static char *save;
*
1563: CLRF 29
1564: CLRF 2A
....................
.................... beg = (s1)? s1: save;
.................... beg += strspn(beg, s2);
.................... if (*beg == '\0')
.................... {
.................... *save = ' ';
.................... return(0);
.................... }
.................... end = strpbrk(beg, s2);
.................... if (*end != '\0')
.................... {
.................... *end = '\0';
.................... end++;
.................... }
.................... save = end;
.................... return(beg);
.................... }
....................
.................... /*****************************************************************/
.................... /*Miscellaneous functions*/
.................... /* standard template
.................... maps error number in errnum to an error message string
.................... Returns: Pointer to string
.................... */
.................... #ifdef _ERRNO
.................... char * strerror(unsigned int8 errnum)
.................... {
.................... char s[15];
.................... switch( errnum)
.................... {
.................... case 0:
.................... strcpy(s,"no errors");
.................... return s;
.................... case EDOM :
.................... strcpy(s,"domain error");
.................... return s;
.................... case ERANGE:
.................... strcpy(s,"range error");
.................... return s;
.................... }
.................... }
.................... #ENDIF
.................... /* standard template: size_t strlen(const char *s).
.................... Computes length of s1 (preceding terminating 0) */
....................
.................... unsigned int8 strlen(char *s)
.................... {
.................... char *sc;
....................
.................... for (sc = s; *sc != 0; sc++);
.................... return(sc - s);
.................... }
....................
.................... /* standard template: size_t stricmp(const char *s1, const char *s2).
.................... Compares s1 to s2 ignoring case (upper vs. lower) */
....................
.................... signed int8 stricmp(char *s1, char *s2)
.................... {
.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));
.................... s1++, s2++)
.................... if (*s1 == '\0')
.................... return(0);
.................... return((*s1 < *s2) ? -1: 1);
.................... }
....................
....................
.................... /* standard template: char *strlwr(char *s).
.................... Replaces uppercase letters by lowercase;
.................... returns pointer to new string s */
....................
.................... char *strlwr(char *s)
.................... {
.................... char *p;
....................
.................... for (p = s; *p != '\0'; p++)
.................... if (*p >= 'A' && *p <='Z')
.................... *p += 'a' - 'A';
.................... return(s);
.................... }
....................
....................
.................... /************************************************************/
....................
....................
.................... #endif
....................
....................
.................... #include "SHT25.h"
....................
.................... #define SHT25_HEATER_ON 0x04
.................... #define SHT25_HEATER_OFF 0x00
.................... #define SHT25_OTP_reload_off 0x02
.................... #define SHT25_RH12_T14 0x00
.................... #define SHT25_RH8_T12 0x01
.................... #define SHT25_RH10_T13 0x80
.................... #define SHT25_RH11_T11 0x81
....................
.................... #define SHT25_ADDR 0x80
....................
.................... #include "SHT25.c"
.................... void SHT25_soft_reset()
.................... {
.................... i2c_start(); // Start condition
*
027A: BSF 28.3
027B: MOVF 28,W
027C: BSF 03.5
027D: MOVWF 07
027E: NOP
027F: BCF 03.5
0280: BSF 28.4
0281: MOVF 28,W
0282: BSF 03.5
0283: MOVWF 07
0284: NOP
0285: BCF 03.5
0286: BCF 07.3
0287: BCF 28.3
0288: MOVF 28,W
0289: BSF 03.5
028A: MOVWF 07
028B: NOP
028C: BCF 03.5
028D: BCF 07.4
028E: BCF 28.4
028F: MOVF 28,W
0290: BSF 03.5
0291: MOVWF 07
.................... i2c_write(0x80); // Device address
0292: MOVLW 80
0293: BCF 03.5
0294: BSF 03.6
0295: MOVWF 12
0296: BCF 03.6
0297: CALL 22E
.................... i2c_write(0xFE); // Device command
0298: MOVLW FE
0299: BSF 03.6
029A: MOVWF 12
029B: BCF 03.6
029C: CALL 22E
.................... i2c_stop(); // Stop condition
029D: BCF 28.3
029E: MOVF 28,W
029F: BSF 03.5
02A0: MOVWF 07
02A1: NOP
02A2: BCF 03.5
02A3: BSF 28.4
02A4: MOVF 28,W
02A5: BSF 03.5
02A6: MOVWF 07
02A7: BCF 03.5
02A8: BTFSS 07.4
02A9: GOTO 2A8
02AA: NOP
02AB: GOTO 2AC
02AC: NOP
02AD: BSF 28.3
02AE: MOVF 28,W
02AF: BSF 03.5
02B0: MOVWF 07
02B1: NOP
.................... }
02B2: BCF 03.5
02B3: BCF 0A.3
02B4: BSF 0A.4
02B5: GOTO 5B0 (RETURN)
....................
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value
.................... {
.................... unsigned int8 reg;
....................
.................... i2c_start(); // Start condition
*
0317: BSF 28.3
0318: MOVF 28,W
0319: BSF 03.5
031A: MOVWF 07
031B: NOP
031C: BCF 03.5
031D: BSF 28.4
031E: MOVF 28,W
031F: BSF 03.5
0320: MOVWF 07
0321: NOP
0322: BCF 03.5
0323: BCF 07.3
0324: BCF 28.3
0325: MOVF 28,W
0326: BSF 03.5
0327: MOVWF 07
0328: NOP
0329: BCF 03.5
032A: BCF 07.4
032B: BCF 28.4
032C: MOVF 28,W
032D: BSF 03.5
032E: MOVWF 07
.................... i2c_write(SHT25_ADDR); // Device address
032F: MOVLW 80
0330: BCF 03.5
0331: BSF 03.6
0332: MOVWF 12
0333: BCF 03.6
0334: CALL 22E
.................... i2c_write(0xE7); // Device command
0335: MOVLW E7
0336: BSF 03.6
0337: MOVWF 12
0338: BCF 03.6
0339: CALL 22E
....................
.................... i2c_start(); // Start condition
033A: BSF 28.3
033B: MOVF 28,W
033C: BSF 03.5
033D: MOVWF 07
033E: NOP
033F: BCF 03.5
0340: BSF 28.4
0341: MOVF 28,W
0342: BSF 03.5
0343: MOVWF 07
0344: NOP
0345: BCF 03.5
0346: BTFSS 07.4
0347: GOTO 346
0348: BCF 07.3
0349: BCF 28.3
034A: MOVF 28,W
034B: BSF 03.5
034C: MOVWF 07
034D: NOP
034E: BCF 03.5
034F: BCF 07.4
0350: BCF 28.4
0351: MOVF 28,W
0352: BSF 03.5
0353: MOVWF 07
.................... i2c_write(SHT25_ADDR+1); // Device address
0354: MOVLW 81
0355: BCF 03.5
0356: BSF 03.6
0357: MOVWF 12
0358: BCF 03.6
0359: CALL 22E
.................... reg=i2c_read(0); // Read status actual status register
035A: CLRF 77
035B: CALL 2B6
035C: MOVF 78,W
035D: BSF 03.5
035E: MOVWF 5E
....................
.................... reg = (reg & 0x3A) | setup_reg;
035F: MOVF 5E,W
0360: ANDLW 3A
0361: IORWF 5D,W
0362: MOVWF 5E
....................
.................... i2c_start(); // Start condition
0363: BCF 03.5
0364: BSF 28.3
0365: MOVF 28,W
0366: BSF 03.5
0367: MOVWF 07
0368: NOP
0369: BCF 03.5
036A: BSF 28.4
036B: MOVF 28,W
036C: BSF 03.5
036D: MOVWF 07
036E: NOP
036F: BCF 03.5
0370: BTFSS 07.4
0371: GOTO 370
0372: BCF 07.3
0373: BCF 28.3
0374: MOVF 28,W
0375: BSF 03.5
0376: MOVWF 07
0377: NOP
0378: BCF 03.5
0379: BCF 07.4
037A: BCF 28.4
037B: MOVF 28,W
037C: BSF 03.5
037D: MOVWF 07
.................... i2c_write(SHT25_ADDR); // Device address
037E: MOVLW 80
037F: BCF 03.5
0380: BSF 03.6
0381: MOVWF 12
0382: BCF 03.6
0383: CALL 22E
.................... i2c_write(0xE6); // Write to status register
0384: MOVLW E6
0385: BSF 03.6
0386: MOVWF 12
0387: BCF 03.6
0388: CALL 22E
.................... i2c_write(reg); // Device command
0389: BSF 03.5
038A: MOVF 5E,W
038B: BCF 03.5
038C: BSF 03.6
038D: MOVWF 12
038E: BCF 03.6
038F: CALL 22E
.................... i2c_stop(); // Stop condition
0390: BCF 28.3
0391: MOVF 28,W
0392: BSF 03.5
0393: MOVWF 07
0394: NOP
0395: BCF 03.5
0396: BSF 28.4
0397: MOVF 28,W
0398: BSF 03.5
0399: MOVWF 07
039A: BCF 03.5
039B: BTFSS 07.4
039C: GOTO 39B
039D: NOP
039E: GOTO 39F
039F: NOP
03A0: BSF 28.3
03A1: MOVF 28,W
03A2: BSF 03.5
03A3: MOVWF 07
03A4: NOP
....................
.................... delay_ms(10);
03A5: MOVLW 0A
03A6: MOVWF 62
03A7: BCF 03.5
03A8: CALL 303
....................
.................... i2c_start(); // Start condition
03A9: BSF 28.3
03AA: MOVF 28,W
03AB: BSF 03.5
03AC: MOVWF 07
03AD: NOP
03AE: BCF 03.5
03AF: BSF 28.4
03B0: MOVF 28,W
03B1: BSF 03.5
03B2: MOVWF 07
03B3: NOP
03B4: BCF 03.5
03B5: BCF 07.3
03B6: BCF 28.3
03B7: MOVF 28,W
03B8: BSF 03.5
03B9: MOVWF 07
03BA: NOP
03BB: BCF 03.5
03BC: BCF 07.4
03BD: BCF 28.4
03BE: MOVF 28,W
03BF: BSF 03.5
03C0: MOVWF 07
.................... i2c_write(SHT25_ADDR); // Device address
03C1: MOVLW 80
03C2: BCF 03.5
03C3: BSF 03.6
03C4: MOVWF 12
03C5: BCF 03.6
03C6: CALL 22E
.................... i2c_write(0xE7); // Device command
03C7: MOVLW E7
03C8: BSF 03.6
03C9: MOVWF 12
03CA: BCF 03.6
03CB: CALL 22E
....................
.................... i2c_start(); // Start condition
03CC: BSF 28.3
03CD: MOVF 28,W
03CE: BSF 03.5
03CF: MOVWF 07
03D0: NOP
03D1: BCF 03.5
03D2: BSF 28.4
03D3: MOVF 28,W
03D4: BSF 03.5
03D5: MOVWF 07
03D6: NOP
03D7: BCF 03.5
03D8: BTFSS 07.4
03D9: GOTO 3D8
03DA: BCF 07.3
03DB: BCF 28.3
03DC: MOVF 28,W
03DD: BSF 03.5
03DE: MOVWF 07
03DF: NOP
03E0: BCF 03.5
03E1: BCF 07.4
03E2: BCF 28.4
03E3: MOVF 28,W
03E4: BSF 03.5
03E5: MOVWF 07
.................... i2c_write(SHT25_ADDR+1); // Device address
03E6: MOVLW 81
03E7: BCF 03.5
03E8: BSF 03.6
03E9: MOVWF 12
03EA: BCF 03.6
03EB: CALL 22E
.................... reg=i2c_read(0); // Read status actual status register
03EC: CLRF 77
03ED: CALL 2B6
03EE: MOVF 78,W
03EF: BSF 03.5
03F0: MOVWF 5E
....................
.................... return (reg);
03F1: MOVF 5E,W
03F2: MOVWF 78
.................... }
03F3: BCF 03.5
03F4: BCF 0A.3
03F5: BSF 0A.4
03F6: GOTO 5B8 (RETURN)
....................
....................
.................... float SHT25_get_temp()
.................... {
.................... unsigned int8 MSB, LSB, Check;
.................... unsigned int16 data;
....................
.................... i2c_start();
*
0B22: BSF 28.3
0B23: MOVF 28,W
0B24: BSF 03.5
0B25: MOVWF 07
0B26: NOP
0B27: BCF 03.5
0B28: BSF 28.4
0B29: MOVF 28,W
0B2A: BSF 03.5
0B2B: MOVWF 07
0B2C: NOP
0B2D: BCF 03.5
0B2E: BTFSS 07.4
0B2F: GOTO 32E
0B30: BCF 07.3
0B31: BCF 28.3
0B32: MOVF 28,W
0B33: BSF 03.5
0B34: MOVWF 07
0B35: NOP
0B36: BCF 03.5
0B37: BCF 07.4
0B38: BCF 28.4
0B39: MOVF 28,W
0B3A: BSF 03.5
0B3B: MOVWF 07
.................... I2C_Write(SHT25_ADDR);
0B3C: MOVLW 80
0B3D: BCF 03.5
0B3E: BSF 03.6
0B3F: MOVWF 12
0B40: BCF 0A.3
0B41: BCF 03.6
0B42: CALL 22E
0B43: BSF 0A.3
.................... I2C_write(0xE3);
0B44: MOVLW E3
0B45: BSF 03.6
0B46: MOVWF 12
0B47: BCF 0A.3
0B48: BCF 03.6
0B49: CALL 22E
0B4A: BSF 0A.3
.................... i2c_stop();
0B4B: BCF 28.3
0B4C: MOVF 28,W
0B4D: BSF 03.5
0B4E: MOVWF 07
0B4F: NOP
0B50: BCF 03.5
0B51: BSF 28.4
0B52: MOVF 28,W
0B53: BSF 03.5
0B54: MOVWF 07
0B55: BCF 03.5
0B56: BTFSS 07.4
0B57: GOTO 356
0B58: NOP
0B59: GOTO 35A
0B5A: NOP
0B5B: BSF 28.3
0B5C: MOVF 28,W
0B5D: BSF 03.5
0B5E: MOVWF 07
0B5F: NOP
....................
.................... delay_ms(100);
0B60: MOVLW 64
0B61: MOVWF 62
0B62: BCF 0A.3
0B63: BCF 03.5
0B64: CALL 303
0B65: BSF 0A.3
....................
.................... i2c_start();
0B66: BSF 28.3
0B67: MOVF 28,W
0B68: BSF 03.5
0B69: MOVWF 07
0B6A: NOP
0B6B: BCF 03.5
0B6C: BSF 28.4
0B6D: MOVF 28,W
0B6E: BSF 03.5
0B6F: MOVWF 07
0B70: NOP
0B71: BCF 03.5
0B72: BCF 07.3
0B73: BCF 28.3
0B74: MOVF 28,W
0B75: BSF 03.5
0B76: MOVWF 07
0B77: NOP
0B78: BCF 03.5
0B79: BCF 07.4
0B7A: BCF 28.4
0B7B: MOVF 28,W
0B7C: BSF 03.5
0B7D: MOVWF 07
.................... I2C_Write(SHT25_ADDR+1);
0B7E: MOVLW 81
0B7F: BCF 03.5
0B80: BSF 03.6
0B81: MOVWF 12
0B82: BCF 0A.3
0B83: BCF 03.6
0B84: CALL 22E
0B85: BSF 0A.3
.................... MSB=i2c_read(1);
0B86: MOVLW 01
0B87: MOVWF 77
0B88: BCF 0A.3
0B89: CALL 2B6
0B8A: BSF 0A.3
0B8B: MOVF 78,W
0B8C: BSF 03.5
0B8D: MOVWF 5D
.................... LSB=i2c_read(1);
0B8E: MOVLW 01
0B8F: MOVWF 77
0B90: BCF 0A.3
0B91: BCF 03.5
0B92: CALL 2B6
0B93: BSF 0A.3
0B94: MOVF 78,W
0B95: BSF 03.5
0B96: MOVWF 5E
.................... Check=i2c_read(0);
0B97: CLRF 77
0B98: BCF 0A.3
0B99: BCF 03.5
0B9A: CALL 2B6
0B9B: BSF 0A.3
0B9C: MOVF 78,W
0B9D: BSF 03.5
0B9E: MOVWF 5F
.................... i2c_stop();
0B9F: BCF 03.5
0BA0: BCF 28.3
0BA1: MOVF 28,W
0BA2: BSF 03.5
0BA3: MOVWF 07
0BA4: NOP
0BA5: BCF 03.5
0BA6: BSF 28.4
0BA7: MOVF 28,W
0BA8: BSF 03.5
0BA9: MOVWF 07
0BAA: BCF 03.5
0BAB: BTFSS 07.4
0BAC: GOTO 3AB
0BAD: NOP
0BAE: GOTO 3AF
0BAF: NOP
0BB0: BSF 28.3
0BB1: MOVF 28,W
0BB2: BSF 03.5
0BB3: MOVWF 07
0BB4: NOP
....................
.................... LSB = LSB >> 2; // trow out status bits
0BB5: RRF 5E,F
0BB6: RRF 5E,F
0BB7: MOVLW 3F
0BB8: ANDWF 5E,F
....................
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4));
0BB9: CLRF 63
0BBA: MOVF 5D,W
0BBB: MOVWF 62
0BBC: MOVWF 63
0BBD: CLRF 62
0BBE: SWAPF 5E,W
0BBF: MOVWF 77
0BC0: MOVLW F0
0BC1: ANDWF 77,F
0BC2: MOVF 77,W
0BC3: ADDWF 62,W
0BC4: MOVWF 60
0BC5: MOVF 63,W
0BC6: MOVWF 61
0BC7: BTFSC 03.0
0BC8: INCF 61,F
0BC9: BCF 03.5
0BCA: CLRF 27
0BCB: BTFSC 0B.7
0BCC: BSF 27.7
0BCD: BCF 0B.7
.................... return(-46.85 + 175.72*((float)data/0xFFFF));
0BCE: BSF 03.5
0BCF: MOVF 61,W
0BD0: BCF 03.5
0BD1: BSF 03.6
0BD2: MOVWF 45
0BD3: BSF 03.5
0BD4: BCF 03.6
0BD5: MOVF 60,W
0BD6: BCF 03.5
0BD7: BSF 03.6
0BD8: MOVWF 44
0BD9: BCF 0A.3
0BDA: BCF 03.6
0BDB: CALL 038
0BDC: BSF 0A.3
0BDD: BTFSC 27.7
0BDE: BSF 0B.7
0BDF: MOVF 77,W
0BE0: BSF 03.5
0BE1: MOVWF 62
0BE2: MOVF 78,W
0BE3: MOVWF 63
0BE4: MOVF 79,W
0BE5: MOVWF 64
0BE6: MOVF 7A,W
0BE7: MOVWF 65
0BE8: BCF 03.5
0BE9: CLRF 27
0BEA: BTFSC 0B.7
0BEB: BSF 27.7
0BEC: BCF 0B.7
0BED: BSF 03.5
0BEE: MOVF 65,W
0BEF: BCF 03.5
0BF0: BSF 03.6
0BF1: MOVWF 59
0BF2: BSF 03.5
0BF3: BCF 03.6
0BF4: MOVF 64,W
0BF5: BCF 03.5
0BF6: BSF 03.6
0BF7: MOVWF 58
0BF8: BSF 03.5
0BF9: BCF 03.6
0BFA: MOVF 63,W
0BFB: BCF 03.5
0BFC: BSF 03.6
0BFD: MOVWF 57
0BFE: BSF 03.5
0BFF: BCF 03.6
0C00: MOVF 62,W
0C01: BCF 03.5
0C02: BSF 03.6
0C03: MOVWF 56
0C04: CLRF 5D
0C05: MOVLW FF
0C06: MOVWF 5C
0C07: MOVLW 7F
0C08: MOVWF 5B
0C09: MOVLW 8E
0C0A: MOVWF 5A
0C0B: BCF 0A.3
0C0C: BCF 03.6
0C0D: CALL 057
0C0E: BSF 0A.3
0C0F: BTFSC 27.7
0C10: BSF 0B.7
0C11: MOVLW 52
0C12: BSF 03.6
0C13: MOVWF 24
0C14: MOVLW B8
0C15: MOVWF 23
0C16: MOVLW 2F
0C17: MOVWF 22
0C18: MOVLW 86
0C19: MOVWF 21
0C1A: MOVF 7A,W
0C1B: MOVWF 28
0C1C: MOVF 79,W
0C1D: MOVWF 27
0C1E: MOVF 78,W
0C1F: MOVWF 26
0C20: MOVF 77,W
0C21: MOVWF 25
0C22: BCF 03.6
0C23: CALL 2AB
0C24: BCF 03.1
0C25: MOVLW 66
0C26: BSF 03.6
0C27: MOVWF 24
0C28: MOVWF 23
0C29: MOVLW BB
0C2A: MOVWF 22
0C2B: MOVLW 84
0C2C: MOVWF 21
0C2D: MOVF 7A,W
0C2E: MOVWF 28
0C2F: MOVF 79,W
0C30: MOVWF 27
0C31: MOVF 78,W
0C32: MOVWF 26
0C33: MOVF 77,W
0C34: MOVWF 25
0C35: BCF 0A.3
0C36: BCF 03.6
0C37: CALL 5DC
0C38: BSF 0A.3
.................... }
0C39: BCF 0A.3
0C3A: BSF 0A.4
0C3B: GOTO 611 (RETURN)
....................
.................... float SHT25_get_hum()
.................... {
.................... unsigned int8 MSB, LSB, Check;
.................... unsigned int16 data;
....................
.................... i2c_start(); //RH
0C3C: BSF 28.3
0C3D: MOVF 28,W
0C3E: BSF 03.5
0C3F: MOVWF 07
0C40: NOP
0C41: BCF 03.5
0C42: BSF 28.4
0C43: MOVF 28,W
0C44: BSF 03.5
0C45: MOVWF 07
0C46: NOP
0C47: BCF 03.5
0C48: BCF 07.3
0C49: BCF 28.3
0C4A: MOVF 28,W
0C4B: BSF 03.5
0C4C: MOVWF 07
0C4D: NOP
0C4E: BCF 03.5
0C4F: BCF 07.4
0C50: BCF 28.4
0C51: MOVF 28,W
0C52: BSF 03.5
0C53: MOVWF 07
.................... I2C_Write(SHT25_ADDR);
0C54: MOVLW 80
0C55: BCF 03.5
0C56: BSF 03.6
0C57: MOVWF 12
0C58: BCF 0A.3
0C59: BCF 03.6
0C5A: CALL 22E
0C5B: BSF 0A.3
.................... I2C_write(0xE5);
0C5C: MOVLW E5
0C5D: BSF 03.6
0C5E: MOVWF 12
0C5F: BCF 0A.3
0C60: BCF 03.6
0C61: CALL 22E
0C62: BSF 0A.3
....................
.................... delay_ms(100);
0C63: MOVLW 64
0C64: BSF 03.5
0C65: MOVWF 62
0C66: BCF 0A.3
0C67: BCF 03.5
0C68: CALL 303
0C69: BSF 0A.3
....................
.................... i2c_start();
0C6A: BSF 28.3
0C6B: MOVF 28,W
0C6C: BSF 03.5
0C6D: MOVWF 07
0C6E: NOP
0C6F: BCF 03.5
0C70: BSF 28.4
0C71: MOVF 28,W
0C72: BSF 03.5
0C73: MOVWF 07
0C74: NOP
0C75: BCF 03.5
0C76: BTFSS 07.4
0C77: GOTO 476
0C78: BCF 07.3
0C79: BCF 28.3
0C7A: MOVF 28,W
0C7B: BSF 03.5
0C7C: MOVWF 07
0C7D: NOP
0C7E: BCF 03.5
0C7F: BCF 07.4
0C80: BCF 28.4
0C81: MOVF 28,W
0C82: BSF 03.5
0C83: MOVWF 07
.................... I2C_Write(SHT25_ADDR+1);
0C84: MOVLW 81
0C85: BCF 03.5
0C86: BSF 03.6
0C87: MOVWF 12
0C88: BCF 0A.3
0C89: BCF 03.6
0C8A: CALL 22E
0C8B: BSF 0A.3
.................... MSB=i2c_read(1);
0C8C: MOVLW 01
0C8D: MOVWF 77
0C8E: BCF 0A.3
0C8F: CALL 2B6
0C90: BSF 0A.3
0C91: MOVF 78,W
0C92: BSF 03.5
0C93: MOVWF 5D
.................... LSB=i2c_read(1);
0C94: MOVLW 01
0C95: MOVWF 77
0C96: BCF 0A.3
0C97: BCF 03.5
0C98: CALL 2B6
0C99: BSF 0A.3
0C9A: MOVF 78,W
0C9B: BSF 03.5
0C9C: MOVWF 5E
.................... Check=i2c_read(0);
0C9D: CLRF 77
0C9E: BCF 0A.3
0C9F: BCF 03.5
0CA0: CALL 2B6
0CA1: BSF 0A.3
0CA2: MOVF 78,W
0CA3: BSF 03.5
0CA4: MOVWF 5F
.................... i2c_stop();
0CA5: BCF 03.5
0CA6: BCF 28.3
0CA7: MOVF 28,W
0CA8: BSF 03.5
0CA9: MOVWF 07
0CAA: NOP
0CAB: BCF 03.5
0CAC: BSF 28.4
0CAD: MOVF 28,W
0CAE: BSF 03.5
0CAF: MOVWF 07
0CB0: BCF 03.5
0CB1: BTFSS 07.4
0CB2: GOTO 4B1
0CB3: NOP
0CB4: GOTO 4B5
0CB5: NOP
0CB6: BSF 28.3
0CB7: MOVF 28,W
0CB8: BSF 03.5
0CB9: MOVWF 07
0CBA: NOP
....................
.................... LSB = LSB >> 2; // trow out status bits
0CBB: RRF 5E,F
0CBC: RRF 5E,F
0CBD: MOVLW 3F
0CBE: ANDWF 5E,F
....................
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) );
0CBF: CLRF 63
0CC0: MOVF 5D,W
0CC1: MOVWF 62
0CC2: MOVWF 63
0CC3: CLRF 62
0CC4: SWAPF 5E,W
0CC5: MOVWF 77
0CC6: MOVLW F0
0CC7: ANDWF 77,F
0CC8: MOVF 77,W
0CC9: ADDWF 62,W
0CCA: MOVWF 60
0CCB: MOVF 63,W
0CCC: MOVWF 61
0CCD: BTFSC 03.0
0CCE: INCF 61,F
0CCF: BCF 03.5
0CD0: CLRF 27
0CD1: BTFSC 0B.7
0CD2: BSF 27.7
0CD3: BCF 0B.7
.................... return( -6.0 + 125.0*((float)data/0xFFFF));
0CD4: BSF 03.5
0CD5: MOVF 61,W
0CD6: BCF 03.5
0CD7: BSF 03.6
0CD8: MOVWF 45
0CD9: BSF 03.5
0CDA: BCF 03.6
0CDB: MOVF 60,W
0CDC: BCF 03.5
0CDD: BSF 03.6
0CDE: MOVWF 44
0CDF: BCF 0A.3
0CE0: BCF 03.6
0CE1: CALL 038
0CE2: BSF 0A.3
0CE3: BTFSC 27.7
0CE4: BSF 0B.7
0CE5: MOVF 77,W
0CE6: BSF 03.5
0CE7: MOVWF 62
0CE8: MOVF 78,W
0CE9: MOVWF 63
0CEA: MOVF 79,W
0CEB: MOVWF 64
0CEC: MOVF 7A,W
0CED: MOVWF 65
0CEE: BCF 03.5
0CEF: CLRF 27
0CF0: BTFSC 0B.7
0CF1: BSF 27.7
0CF2: BCF 0B.7
0CF3: BSF 03.5
0CF4: MOVF 65,W
0CF5: BCF 03.5
0CF6: BSF 03.6
0CF7: MOVWF 59
0CF8: BSF 03.5
0CF9: BCF 03.6
0CFA: MOVF 64,W
0CFB: BCF 03.5
0CFC: BSF 03.6
0CFD: MOVWF 58
0CFE: BSF 03.5
0CFF: BCF 03.6
0D00: MOVF 63,W
0D01: BCF 03.5
0D02: BSF 03.6
0D03: MOVWF 57
0D04: BSF 03.5
0D05: BCF 03.6
0D06: MOVF 62,W
0D07: BCF 03.5
0D08: BSF 03.6
0D09: MOVWF 56
0D0A: CLRF 5D
0D0B: MOVLW FF
0D0C: MOVWF 5C
0D0D: MOVLW 7F
0D0E: MOVWF 5B
0D0F: MOVLW 8E
0D10: MOVWF 5A
0D11: BCF 0A.3
0D12: BCF 03.6
0D13: CALL 057
0D14: BSF 0A.3
0D15: BTFSC 27.7
0D16: BSF 0B.7
0D17: BSF 03.6
0D18: CLRF 24
0D19: CLRF 23
0D1A: MOVLW 7A
0D1B: MOVWF 22
0D1C: MOVLW 85
0D1D: MOVWF 21
0D1E: MOVF 7A,W
0D1F: MOVWF 28
0D20: MOVF 79,W
0D21: MOVWF 27
0D22: MOVF 78,W
0D23: MOVWF 26
0D24: MOVF 77,W
0D25: MOVWF 25
0D26: BCF 03.6
0D27: CALL 2AB
0D28: BCF 03.1
0D29: BSF 03.6
0D2A: CLRF 24
0D2B: CLRF 23
0D2C: MOVLW C0
0D2D: MOVWF 22
0D2E: MOVLW 81
0D2F: MOVWF 21
0D30: MOVF 7A,W
0D31: MOVWF 28
0D32: MOVF 79,W
0D33: MOVWF 27
0D34: MOVF 78,W
0D35: MOVWF 26
0D36: MOVF 77,W
0D37: MOVWF 25
0D38: BCF 0A.3
0D39: BCF 03.6
0D3A: CALL 5DC
0D3B: BSF 0A.3
.................... }
0D3C: BCF 0A.3
0D3D: BSF 0A.4
0D3E: GOTO 61E (RETURN)
....................
....................
....................
....................
.................... #include "MPL3115.h"
.................... #define MPL3115_ADDR_R 0xC1 //addresa pro cteni
.................... #define MPL3115_ADDR_W 0xC0
....................
.................... #include "MPL3115.c"
.................... void mpl3115_setA (void) //nastavení pro výku
.................... {
....................
....................
.................... i2c_start(); //STANDBY mode
*
090A: BSF 28.3
090B: MOVF 28,W
090C: BSF 03.5
090D: MOVWF 07
090E: NOP
090F: BCF 03.5
0910: BSF 28.4
0911: MOVF 28,W
0912: BSF 03.5
0913: MOVWF 07
0914: NOP
0915: BCF 03.5
0916: BCF 07.3
0917: BCF 28.3
0918: MOVF 28,W
0919: BSF 03.5
091A: MOVWF 07
091B: NOP
091C: BCF 03.5
091D: BCF 07.4
091E: BCF 28.4
091F: MOVF 28,W
0920: BSF 03.5
0921: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0922: MOVLW C0
0923: BCF 03.5
0924: BSF 03.6
0925: MOVWF 12
0926: BCF 0A.3
0927: BCF 03.6
0928: CALL 22E
0929: BSF 0A.3
.................... I2C_write(0x26);
092A: MOVLW 26
092B: BSF 03.6
092C: MOVWF 12
092D: BCF 0A.3
092E: BCF 03.6
092F: CALL 22E
0930: BSF 0A.3
.................... I2C_write(0xB8);
0931: MOVLW B8
0932: BSF 03.6
0933: MOVWF 12
0934: BCF 0A.3
0935: BCF 03.6
0936: CALL 22E
0937: BSF 0A.3
.................... i2c_stop();
0938: BCF 28.3
0939: MOVF 28,W
093A: BSF 03.5
093B: MOVWF 07
093C: NOP
093D: BCF 03.5
093E: BSF 28.4
093F: MOVF 28,W
0940: BSF 03.5
0941: MOVWF 07
0942: BCF 03.5
0943: BTFSS 07.4
0944: GOTO 143
0945: NOP
0946: GOTO 147
0947: NOP
0948: BSF 28.3
0949: MOVF 28,W
094A: BSF 03.5
094B: MOVWF 07
094C: NOP
....................
.................... i2c_start(); //PT_DATA_CFG set
094D: BCF 03.5
094E: BSF 28.3
094F: MOVF 28,W
0950: BSF 03.5
0951: MOVWF 07
0952: NOP
0953: BCF 03.5
0954: BSF 28.4
0955: MOVF 28,W
0956: BSF 03.5
0957: MOVWF 07
0958: NOP
0959: BCF 03.5
095A: BCF 07.3
095B: BCF 28.3
095C: MOVF 28,W
095D: BSF 03.5
095E: MOVWF 07
095F: NOP
0960: BCF 03.5
0961: BCF 07.4
0962: BCF 28.4
0963: MOVF 28,W
0964: BSF 03.5
0965: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0966: MOVLW C0
0967: BCF 03.5
0968: BSF 03.6
0969: MOVWF 12
096A: BCF 0A.3
096B: BCF 03.6
096C: CALL 22E
096D: BSF 0A.3
.................... I2C_write(0x13);
096E: MOVLW 13
096F: BSF 03.6
0970: MOVWF 12
0971: BCF 0A.3
0972: BCF 03.6
0973: CALL 22E
0974: BSF 0A.3
.................... I2C_write(0x07); //hodnota
0975: MOVLW 07
0976: BSF 03.6
0977: MOVWF 12
0978: BCF 0A.3
0979: BCF 03.6
097A: CALL 22E
097B: BSF 0A.3
.................... i2c_stop();
097C: BCF 28.3
097D: MOVF 28,W
097E: BSF 03.5
097F: MOVWF 07
0980: NOP
0981: BCF 03.5
0982: BSF 28.4
0983: MOVF 28,W
0984: BSF 03.5
0985: MOVWF 07
0986: BCF 03.5
0987: BTFSS 07.4
0988: GOTO 187
0989: NOP
098A: GOTO 18B
098B: NOP
098C: BSF 28.3
098D: MOVF 28,W
098E: BSF 03.5
098F: MOVWF 07
0990: NOP
....................
.................... i2c_start(); //ACTIVE mode
0991: BCF 03.5
0992: BSF 28.3
0993: MOVF 28,W
0994: BSF 03.5
0995: MOVWF 07
0996: NOP
0997: BCF 03.5
0998: BSF 28.4
0999: MOVF 28,W
099A: BSF 03.5
099B: MOVWF 07
099C: NOP
099D: BCF 03.5
099E: BCF 07.3
099F: BCF 28.3
09A0: MOVF 28,W
09A1: BSF 03.5
09A2: MOVWF 07
09A3: NOP
09A4: BCF 03.5
09A5: BCF 07.4
09A6: BCF 28.4
09A7: MOVF 28,W
09A8: BSF 03.5
09A9: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
09AA: MOVLW C0
09AB: BCF 03.5
09AC: BSF 03.6
09AD: MOVWF 12
09AE: BCF 0A.3
09AF: BCF 03.6
09B0: CALL 22E
09B1: BSF 0A.3
.................... I2C_write(0x26);
09B2: MOVLW 26
09B3: BSF 03.6
09B4: MOVWF 12
09B5: BCF 0A.3
09B6: BCF 03.6
09B7: CALL 22E
09B8: BSF 0A.3
.................... I2C_write(0xB9);
09B9: MOVLW B9
09BA: BSF 03.6
09BB: MOVWF 12
09BC: BCF 0A.3
09BD: BCF 03.6
09BE: CALL 22E
09BF: BSF 0A.3
.................... i2c_stop();
09C0: BCF 28.3
09C1: MOVF 28,W
09C2: BSF 03.5
09C3: MOVWF 07
09C4: NOP
09C5: BCF 03.5
09C6: BSF 28.4
09C7: MOVF 28,W
09C8: BSF 03.5
09C9: MOVWF 07
09CA: BCF 03.5
09CB: BTFSS 07.4
09CC: GOTO 1CB
09CD: NOP
09CE: GOTO 1CF
09CF: NOP
09D0: BSF 28.3
09D1: MOVF 28,W
09D2: BSF 03.5
09D3: MOVWF 07
09D4: NOP
.................... }
09D5: BCF 03.5
09D6: BCF 0A.3
09D7: BSF 0A.4
09D8: GOTO 5F4 (RETURN)
....................
.................... void mpl3115_setP (void) //nastavení pro tlak
.................... {
....................
....................
.................... i2c_start(); //STANDBY mode
*
04BB: BSF 28.3
04BC: MOVF 28,W
04BD: BSF 03.5
04BE: MOVWF 07
04BF: NOP
04C0: BCF 03.5
04C1: BSF 28.4
04C2: MOVF 28,W
04C3: BSF 03.5
04C4: MOVWF 07
04C5: NOP
04C6: BCF 03.5
04C7: BCF 07.3
04C8: BCF 28.3
04C9: MOVF 28,W
04CA: BSF 03.5
04CB: MOVWF 07
04CC: NOP
04CD: BCF 03.5
04CE: BCF 07.4
04CF: BCF 28.4
04D0: MOVF 28,W
04D1: BSF 03.5
04D2: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
04D3: MOVLW C0
04D4: BCF 03.5
04D5: BSF 03.6
04D6: MOVWF 12
04D7: BCF 03.6
04D8: CALL 22E
.................... I2C_write(0x26);
04D9: MOVLW 26
04DA: BSF 03.6
04DB: MOVWF 12
04DC: BCF 03.6
04DD: CALL 22E
.................... I2C_write(0xB8);
04DE: MOVLW B8
04DF: BSF 03.6
04E0: MOVWF 12
04E1: BCF 03.6
04E2: CALL 22E
.................... i2c_stop();
04E3: BCF 28.3
04E4: MOVF 28,W
04E5: BSF 03.5
04E6: MOVWF 07
04E7: NOP
04E8: BCF 03.5
04E9: BSF 28.4
04EA: MOVF 28,W
04EB: BSF 03.5
04EC: MOVWF 07
04ED: BCF 03.5
04EE: BTFSS 07.4
04EF: GOTO 4EE
04F0: NOP
04F1: GOTO 4F2
04F2: NOP
04F3: BSF 28.3
04F4: MOVF 28,W
04F5: BSF 03.5
04F6: MOVWF 07
04F7: NOP
....................
.................... i2c_start(); //PT_DATA_CFG set
04F8: BCF 03.5
04F9: BSF 28.3
04FA: MOVF 28,W
04FB: BSF 03.5
04FC: MOVWF 07
04FD: NOP
04FE: BCF 03.5
04FF: BSF 28.4
0500: MOVF 28,W
0501: BSF 03.5
0502: MOVWF 07
0503: NOP
0504: BCF 03.5
0505: BCF 07.3
0506: BCF 28.3
0507: MOVF 28,W
0508: BSF 03.5
0509: MOVWF 07
050A: NOP
050B: BCF 03.5
050C: BCF 07.4
050D: BCF 28.4
050E: MOVF 28,W
050F: BSF 03.5
0510: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0511: MOVLW C0
0512: BCF 03.5
0513: BSF 03.6
0514: MOVWF 12
0515: BCF 03.6
0516: CALL 22E
.................... I2C_write(0x13);
0517: MOVLW 13
0518: BSF 03.6
0519: MOVWF 12
051A: BCF 03.6
051B: CALL 22E
.................... I2C_write(0x07); //hodnota
051C: MOVLW 07
051D: BSF 03.6
051E: MOVWF 12
051F: BCF 03.6
0520: CALL 22E
.................... i2c_stop();
0521: BCF 28.3
0522: MOVF 28,W
0523: BSF 03.5
0524: MOVWF 07
0525: NOP
0526: BCF 03.5
0527: BSF 28.4
0528: MOVF 28,W
0529: BSF 03.5
052A: MOVWF 07
052B: BCF 03.5
052C: BTFSS 07.4
052D: GOTO 52C
052E: NOP
052F: GOTO 530
0530: NOP
0531: BSF 28.3
0532: MOVF 28,W
0533: BSF 03.5
0534: MOVWF 07
0535: NOP
....................
.................... i2c_start(); //ACTIVE mode
0536: BCF 03.5
0537: BSF 28.3
0538: MOVF 28,W
0539: BSF 03.5
053A: MOVWF 07
053B: NOP
053C: BCF 03.5
053D: BSF 28.4
053E: MOVF 28,W
053F: BSF 03.5
0540: MOVWF 07
0541: NOP
0542: BCF 03.5
0543: BCF 07.3
0544: BCF 28.3
0545: MOVF 28,W
0546: BSF 03.5
0547: MOVWF 07
0548: NOP
0549: BCF 03.5
054A: BCF 07.4
054B: BCF 28.4
054C: MOVF 28,W
054D: BSF 03.5
054E: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
054F: MOVLW C0
0550: BCF 03.5
0551: BSF 03.6
0552: MOVWF 12
0553: BCF 03.6
0554: CALL 22E
.................... I2C_write(0x26);
0555: MOVLW 26
0556: BSF 03.6
0557: MOVWF 12
0558: BCF 03.6
0559: CALL 22E
.................... I2C_write(0x39);
055A: MOVLW 39
055B: BSF 03.6
055C: MOVWF 12
055D: BCF 03.6
055E: CALL 22E
.................... i2c_stop();
055F: BCF 28.3
0560: MOVF 28,W
0561: BSF 03.5
0562: MOVWF 07
0563: NOP
0564: BCF 03.5
0565: BSF 28.4
0566: MOVF 28,W
0567: BSF 03.5
0568: MOVWF 07
0569: BCF 03.5
056A: BTFSS 07.4
056B: GOTO 56A
056C: NOP
056D: GOTO 56E
056E: NOP
056F: BSF 28.3
0570: MOVF 28,W
0571: BSF 03.5
0572: MOVWF 07
0573: NOP
.................... }
0574: BCF 03.5
0575: BCF 0A.3
0576: BSF 0A.4
0577: GOTO 5CD (RETURN)
....................
....................
.................... byte mpl3115_read (byte reg)
.................... {
.................... byte i;
....................
.................... i2c_start();
0578: BSF 28.3
0579: MOVF 28,W
057A: BSF 03.5
057B: MOVWF 07
057C: NOP
057D: BCF 03.5
057E: BSF 28.4
057F: MOVF 28,W
0580: BSF 03.5
0581: MOVWF 07
0582: NOP
0583: BCF 03.5
0584: BCF 07.3
0585: BCF 28.3
0586: MOVF 28,W
0587: BSF 03.5
0588: MOVWF 07
0589: NOP
058A: BCF 03.5
058B: BCF 07.4
058C: BCF 28.4
058D: MOVF 28,W
058E: BSF 03.5
058F: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0590: MOVLW C0
0591: BCF 03.5
0592: BSF 03.6
0593: MOVWF 12
0594: BCF 03.6
0595: CALL 22E
.................... I2C_write(reg);
0596: BSF 03.6
0597: MOVF 10,W
0598: MOVWF 12
0599: BCF 03.6
059A: CALL 22E
.................... i2c_start();
059B: BSF 28.3
059C: MOVF 28,W
059D: BSF 03.5
059E: MOVWF 07
059F: NOP
05A0: BCF 03.5
05A1: BSF 28.4
05A2: MOVF 28,W
05A3: BSF 03.5
05A4: MOVWF 07
05A5: NOP
05A6: BCF 03.5
05A7: BTFSS 07.4
05A8: GOTO 5A7
05A9: BCF 07.3
05AA: BCF 28.3
05AB: MOVF 28,W
05AC: BSF 03.5
05AD: MOVWF 07
05AE: NOP
05AF: BCF 03.5
05B0: BCF 07.4
05B1: BCF 28.4
05B2: MOVF 28,W
05B3: BSF 03.5
05B4: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_R);
05B5: MOVLW C1
05B6: BCF 03.5
05B7: BSF 03.6
05B8: MOVWF 12
05B9: BCF 03.6
05BA: CALL 22E
.................... i=i2c_read(0);
05BB: CLRF 77
05BC: CALL 2B6
05BD: MOVF 78,W
05BE: BSF 03.6
05BF: MOVWF 11
.................... i2c_stop();
05C0: BCF 03.6
05C1: BCF 28.3
05C2: MOVF 28,W
05C3: BSF 03.5
05C4: MOVWF 07
05C5: NOP
05C6: BCF 03.5
05C7: BSF 28.4
05C8: MOVF 28,W
05C9: BSF 03.5
05CA: MOVWF 07
05CB: BCF 03.5
05CC: BTFSS 07.4
05CD: GOTO 5CC
05CE: NOP
05CF: GOTO 5D0
05D0: NOP
05D1: BSF 28.3
05D2: MOVF 28,W
05D3: BSF 03.5
05D4: MOVWF 07
05D5: NOP
....................
.................... return i;
05D6: BCF 03.5
05D7: BSF 03.6
05D8: MOVF 11,W
05D9: MOVWF 78
.................... }
05DA: BCF 03.6
05DB: RETURN
....................
....................
.................... float mpl3115_T (void) //teplota ve stupnich
.................... {
.................... int m;
.................... float l, t;
....................
.................... m= mpl3115_read (0x04);
*
0722: MOVLW 04
0723: BSF 03.6
0724: MOVWF 10
0725: BCF 03.6
0726: CALL 578
0727: MOVF 78,W
0728: BSF 03.5
0729: MOVWF 5D
.................... l= (float)(mpl3115_read(0x05)>>4)/16.0;
072A: MOVLW 05
072B: BCF 03.5
072C: BSF 03.6
072D: MOVWF 10
072E: BCF 03.6
072F: CALL 578
0730: SWAPF 78,W
0731: MOVWF 77
0732: MOVLW 0F
0733: ANDWF 77,F
0734: MOVF 77,W
0735: CLRF 27
0736: BTFSC 0B.7
0737: BSF 27.7
0738: BCF 0B.7
0739: BSF 03.6
073A: CLRF 45
073B: MOVWF 44
073C: BCF 03.6
073D: CALL 038
073E: BTFSC 27.7
073F: BSF 0B.7
0740: MOVF 77,W
0741: BSF 03.5
0742: MOVWF 66
0743: MOVF 78,W
0744: MOVWF 67
0745: MOVF 79,W
0746: MOVWF 68
0747: MOVF 7A,W
0748: MOVWF 69
0749: BCF 03.5
074A: CLRF 27
074B: BTFSC 0B.7
074C: BSF 27.7
074D: BCF 0B.7
074E: BSF 03.5
074F: MOVF 69,W
0750: BCF 03.5
0751: BSF 03.6
0752: MOVWF 59
0753: BSF 03.5
0754: BCF 03.6
0755: MOVF 68,W
0756: BCF 03.5
0757: BSF 03.6
0758: MOVWF 58
0759: BSF 03.5
075A: BCF 03.6
075B: MOVF 67,W
075C: BCF 03.5
075D: BSF 03.6
075E: MOVWF 57
075F: BSF 03.5
0760: BCF 03.6
0761: MOVF 66,W
0762: BCF 03.5
0763: BSF 03.6
0764: MOVWF 56
0765: CLRF 5D
0766: CLRF 5C
0767: CLRF 5B
0768: MOVLW 83
0769: MOVWF 5A
076A: BCF 03.6
076B: CALL 057
076C: BTFSC 27.7
076D: BSF 0B.7
076E: MOVF 7A,W
076F: BSF 03.5
0770: MOVWF 61
0771: MOVF 79,W
0772: MOVWF 60
0773: MOVF 78,W
0774: MOVWF 5F
0775: MOVF 77,W
0776: MOVWF 5E
0777: BCF 03.5
0778: CLRF 27
0779: BTFSC 0B.7
077A: BSF 27.7
077B: BCF 0B.7
.................... t = (float)(M + L);
077C: BSF 03.6
077D: CLRF 45
077E: BSF 03.5
077F: BCF 03.6
0780: MOVF 5D,W
0781: BCF 03.5
0782: BSF 03.6
0783: MOVWF 44
0784: BCF 03.6
0785: CALL 038
0786: BTFSC 27.7
0787: BSF 0B.7
0788: BCF 03.1
0789: MOVF 7A,W
078A: BSF 03.6
078B: MOVWF 24
078C: MOVF 79,W
078D: MOVWF 23
078E: MOVF 78,W
078F: MOVWF 22
0790: MOVF 77,W
0791: MOVWF 21
0792: BSF 03.5
0793: BCF 03.6
0794: MOVF 61,W
0795: BCF 03.5
0796: BSF 03.6
0797: MOVWF 28
0798: BSF 03.5
0799: BCF 03.6
079A: MOVF 60,W
079B: BCF 03.5
079C: BSF 03.6
079D: MOVWF 27
079E: BSF 03.5
079F: BCF 03.6
07A0: MOVF 5F,W
07A1: BCF 03.5
07A2: BSF 03.6
07A3: MOVWF 26
07A4: BSF 03.5
07A5: BCF 03.6
07A6: MOVF 5E,W
07A7: BCF 03.5
07A8: BSF 03.6
07A9: MOVWF 25
07AA: BCF 03.6
07AB: CALL 5DC
07AC: MOVF 7A,W
07AD: BSF 03.5
07AE: MOVWF 65
07AF: MOVF 79,W
07B0: MOVWF 64
07B1: MOVF 78,W
07B2: MOVWF 63
07B3: MOVF 77,W
07B4: MOVWF 62
.................... return t;
07B5: MOVF 62,W
07B6: MOVWF 77
07B7: MOVF 63,W
07B8: MOVWF 78
07B9: MOVF 64,W
07BA: MOVWF 79
07BB: MOVF 65,W
07BC: MOVWF 7A
.................... }
07BD: BCF 03.5
07BE: BCF 0A.3
07BF: BSF 0A.4
07C0: GOTO 5DB (RETURN)
....................
.................... float mpl3115_A (void) //vyska v m
.................... {
....................
.................... int16 m;
.................... unsigned int8 c;
.................... float l, a;
....................
.................... m= mpl3115_read (0x01);
*
09D9: MOVLW 01
09DA: BSF 03.6
09DB: MOVWF 10
09DC: BCF 0A.3
09DD: BCF 03.6
09DE: CALL 578
09DF: BSF 0A.3
09E0: BSF 03.5
09E1: CLRF 5E
09E2: MOVF 78,W
09E3: MOVWF 5D
.................... c= mpl3115_read (0x02);
09E4: MOVLW 02
09E5: BCF 03.5
09E6: BSF 03.6
09E7: MOVWF 10
09E8: BCF 0A.3
09E9: BCF 03.6
09EA: CALL 578
09EB: BSF 0A.3
09EC: MOVF 78,W
09ED: BSF 03.5
09EE: MOVWF 5F
.................... l= (float)(mpl3115_read(0x03)>>4)/16.0;
09EF: MOVLW 03
09F0: BCF 03.5
09F1: BSF 03.6
09F2: MOVWF 10
09F3: BCF 0A.3
09F4: BCF 03.6
09F5: CALL 578
09F6: BSF 0A.3
09F7: SWAPF 78,W
09F8: MOVWF 77
09F9: MOVLW 0F
09FA: ANDWF 77,F
09FB: MOVF 77,W
09FC: CLRF 27
09FD: BTFSC 0B.7
09FE: BSF 27.7
09FF: BCF 0B.7
0A00: BSF 03.6
0A01: CLRF 45
0A02: MOVWF 44
0A03: BCF 0A.3
0A04: BCF 03.6
0A05: CALL 038
0A06: BSF 0A.3
0A07: BTFSC 27.7
0A08: BSF 0B.7
0A09: MOVF 77,W
0A0A: BSF 03.5
0A0B: MOVWF 68
0A0C: MOVF 78,W
0A0D: MOVWF 69
0A0E: MOVF 79,W
0A0F: MOVWF 6A
0A10: MOVF 7A,W
0A11: MOVWF 6B
0A12: BCF 03.5
0A13: CLRF 27
0A14: BTFSC 0B.7
0A15: BSF 27.7
0A16: BCF 0B.7
0A17: BSF 03.5
0A18: MOVF 6B,W
0A19: BCF 03.5
0A1A: BSF 03.6
0A1B: MOVWF 59
0A1C: BSF 03.5
0A1D: BCF 03.6
0A1E: MOVF 6A,W
0A1F: BCF 03.5
0A20: BSF 03.6
0A21: MOVWF 58
0A22: BSF 03.5
0A23: BCF 03.6
0A24: MOVF 69,W
0A25: BCF 03.5
0A26: BSF 03.6
0A27: MOVWF 57
0A28: BSF 03.5
0A29: BCF 03.6
0A2A: MOVF 68,W
0A2B: BCF 03.5
0A2C: BSF 03.6
0A2D: MOVWF 56
0A2E: CLRF 5D
0A2F: CLRF 5C
0A30: CLRF 5B
0A31: MOVLW 83
0A32: MOVWF 5A
0A33: BCF 0A.3
0A34: BCF 03.6
0A35: CALL 057
0A36: BSF 0A.3
0A37: BTFSC 27.7
0A38: BSF 0B.7
0A39: MOVF 7A,W
0A3A: BSF 03.5
0A3B: MOVWF 63
0A3C: MOVF 79,W
0A3D: MOVWF 62
0A3E: MOVF 78,W
0A3F: MOVWF 61
0A40: MOVF 77,W
0A41: MOVWF 60
.................... a = (float)((m << 8)|c) + l;
0A42: MOVF 5D,W
0A43: MOVWF 6A
0A44: CLRF 69
0A45: MOVF 69,W
0A46: IORWF 5F,W
0A47: MOVWF 77
0A48: MOVF 5D,W
0A49: MOVWF 7A
0A4A: MOVF 77,W
0A4B: BCF 03.5
0A4C: CLRF 27
0A4D: BTFSC 0B.7
0A4E: BSF 27.7
0A4F: BCF 0B.7
0A50: BSF 03.6
0A51: MOVWF 44
0A52: MOVF 7A,W
0A53: MOVWF 45
0A54: BCF 0A.3
0A55: BCF 03.6
0A56: CALL 038
0A57: BSF 0A.3
0A58: BTFSC 27.7
0A59: BSF 0B.7
0A5A: MOVF 77,W
0A5B: BSF 03.5
0A5C: MOVWF 69
0A5D: MOVF 78,W
0A5E: MOVWF 6A
0A5F: MOVF 79,W
0A60: MOVWF 6B
0A61: MOVF 7A,W
0A62: MOVWF 6C
0A63: BCF 03.1
0A64: MOVF 6C,W
0A65: BCF 03.5
0A66: BSF 03.6
0A67: MOVWF 24
0A68: BSF 03.5
0A69: BCF 03.6
0A6A: MOVF 6B,W
0A6B: BCF 03.5
0A6C: BSF 03.6
0A6D: MOVWF 23
0A6E: BSF 03.5
0A6F: BCF 03.6
0A70: MOVF 6A,W
0A71: BCF 03.5
0A72: BSF 03.6
0A73: MOVWF 22
0A74: BSF 03.5
0A75: BCF 03.6
0A76: MOVF 69,W
0A77: BCF 03.5
0A78: BSF 03.6
0A79: MOVWF 21
0A7A: BSF 03.5
0A7B: BCF 03.6
0A7C: MOVF 63,W
0A7D: BCF 03.5
0A7E: BSF 03.6
0A7F: MOVWF 28
0A80: BSF 03.5
0A81: BCF 03.6
0A82: MOVF 62,W
0A83: BCF 03.5
0A84: BSF 03.6
0A85: MOVWF 27
0A86: BSF 03.5
0A87: BCF 03.6
0A88: MOVF 61,W
0A89: BCF 03.5
0A8A: BSF 03.6
0A8B: MOVWF 26
0A8C: BSF 03.5
0A8D: BCF 03.6
0A8E: MOVF 60,W
0A8F: BCF 03.5
0A90: BSF 03.6
0A91: MOVWF 25
0A92: BCF 0A.3
0A93: BCF 03.6
0A94: CALL 5DC
0A95: BSF 0A.3
0A96: MOVF 7A,W
0A97: BSF 03.5
0A98: MOVWF 67
0A99: MOVF 79,W
0A9A: MOVWF 66
0A9B: MOVF 78,W
0A9C: MOVWF 65
0A9D: MOVF 77,W
0A9E: MOVWF 64
.................... return a;
0A9F: MOVF 64,W
0AA0: MOVWF 77
0AA1: MOVF 65,W
0AA2: MOVWF 78
0AA3: MOVF 66,W
0AA4: MOVWF 79
0AA5: MOVF 67,W
0AA6: MOVWF 7A
.................... }
0AA7: BCF 03.5
0AA8: BCF 0A.3
0AA9: BSF 0A.4
0AAA: GOTO 604 (RETURN)
....................
....................
.................... float mpl3115_P (void) //tlak v Pa
.................... {
.................... unsigned int32 m;
.................... unsigned int16 c;
.................... unsigned int8 l,l2;
.................... float p, l1;
....................
.................... m= mpl3115_read (0x01);
*
0800: MOVLW 01
0801: BSF 03.6
0802: MOVWF 10
0803: BCF 0A.3
0804: BCF 03.6
0805: CALL 578
0806: BSF 0A.3
0807: BSF 03.5
0808: CLRF 60
0809: CLRF 5F
080A: CLRF 5E
080B: MOVF 78,W
080C: MOVWF 5D
.................... c= mpl3115_read (0x02);
080D: MOVLW 02
080E: BCF 03.5
080F: BSF 03.6
0810: MOVWF 10
0811: BCF 0A.3
0812: BCF 03.6
0813: CALL 578
0814: BSF 0A.3
0815: BSF 03.5
0816: CLRF 62
0817: MOVF 78,W
0818: MOVWF 61
.................... l=mpl3115_read(0x03);
0819: MOVLW 03
081A: BCF 03.5
081B: BSF 03.6
081C: MOVWF 10
081D: BCF 0A.3
081E: BCF 03.6
081F: CALL 578
0820: BSF 0A.3
0821: MOVF 78,W
0822: BSF 03.5
0823: MOVWF 63
.................... l2=l<<2;
0824: RLF 63,W
0825: MOVWF 64
0826: RLF 64,F
0827: MOVLW FC
0828: ANDWF 64,F
.................... l1= (float)(l>>6)/4.0;
0829: SWAPF 63,W
082A: MOVWF 77
082B: RRF 77,F
082C: RRF 77,F
082D: MOVLW 03
082E: ANDWF 77,F
082F: MOVF 77,W
0830: BCF 03.5
0831: CLRF 27
0832: BTFSC 0B.7
0833: BSF 27.7
0834: BCF 0B.7
0835: BSF 03.6
0836: CLRF 45
0837: MOVWF 44
0838: BCF 0A.3
0839: BCF 03.6
083A: CALL 038
083B: BSF 0A.3
083C: BTFSC 27.7
083D: BSF 0B.7
083E: MOVF 77,W
083F: BSF 03.6
0840: MOVWF 11
0841: MOVF 78,W
0842: MOVWF 12
0843: MOVF 79,W
0844: MOVWF 13
0845: MOVF 7A,W
0846: MOVWF 14
0847: BCF 03.6
0848: CLRF 27
0849: BTFSC 0B.7
084A: BSF 27.7
084B: BCF 0B.7
084C: BSF 03.6
084D: MOVF 14,W
084E: MOVWF 59
084F: MOVF 13,W
0850: MOVWF 58
0851: MOVF 12,W
0852: MOVWF 57
0853: MOVF 11,W
0854: MOVWF 56
0855: CLRF 5D
0856: CLRF 5C
0857: CLRF 5B
0858: MOVLW 81
0859: MOVWF 5A
085A: BCF 0A.3
085B: BCF 03.6
085C: CALL 057
085D: BSF 0A.3
085E: BTFSC 27.7
085F: BSF 0B.7
0860: MOVF 7A,W
0861: BSF 03.5
0862: MOVWF 6C
0863: MOVF 79,W
0864: MOVWF 6B
0865: MOVF 78,W
0866: MOVWF 6A
0867: MOVF 77,W
0868: MOVWF 69
.................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1;
0869: BCF 03.5
086A: BSF 03.6
086B: CLRF 11
086C: BSF 03.5
086D: BCF 03.6
086E: RLF 5D,W
086F: BCF 03.5
0870: BSF 03.6
0871: MOVWF 12
0872: BSF 03.5
0873: BCF 03.6
0874: RLF 5E,W
0875: BCF 03.5
0876: BSF 03.6
0877: MOVWF 13
0878: BSF 03.5
0879: BCF 03.6
087A: RLF 5F,W
087B: BCF 03.5
087C: BSF 03.6
087D: MOVWF 14
087E: RLF 12,F
087F: RLF 13,F
0880: RLF 14,F
0881: MOVLW FC
0882: ANDWF 12,F
0883: BSF 03.5
0884: BCF 03.6
0885: RLF 61,W
0886: MOVWF 79
0887: RLF 62,W
0888: MOVWF 7A
0889: RLF 79,F
088A: RLF 7A,F
088B: MOVLW FC
088C: ANDWF 79,F
088D: MOVF 79,W
088E: BCF 03.5
088F: BSF 03.6
0890: IORWF 11,F
0891: MOVF 7A,W
0892: IORWF 12,F
0893: BSF 03.5
0894: BCF 03.6
0895: SWAPF 63,W
0896: MOVWF 77
0897: RRF 77,F
0898: RRF 77,F
0899: MOVLW 03
089A: ANDWF 77,F
089B: MOVF 77,W
089C: BCF 03.5
089D: BSF 03.6
089E: IORWF 11,W
089F: MOVWF 77
08A0: MOVF 12,W
08A1: MOVWF 78
08A2: MOVF 13,W
08A3: MOVWF 79
08A4: MOVF 14,W
08A5: MOVWF 7A
08A6: MOVF 7A,W
08A7: MOVWF 1A
08A8: MOVF 79,W
08A9: MOVWF 19
08AA: MOVF 78,W
08AB: MOVWF 18
08AC: MOVF 77,W
08AD: MOVWF 17
*
08C8: MOVF 77,W
08C9: MOVWF 11
08CA: MOVF 78,W
08CB: MOVWF 12
08CC: MOVF 79,W
08CD: MOVWF 13
08CE: MOVF 7A,W
08CF: MOVWF 14
08D0: BCF 03.1
08D1: MOVF 14,W
08D2: MOVWF 24
08D3: MOVF 13,W
08D4: MOVWF 23
08D5: MOVF 12,W
08D6: MOVWF 22
08D7: MOVF 11,W
08D8: MOVWF 21
08D9: BSF 03.5
08DA: BCF 03.6
08DB: MOVF 6C,W
08DC: BCF 03.5
08DD: BSF 03.6
08DE: MOVWF 28
08DF: BSF 03.5
08E0: BCF 03.6
08E1: MOVF 6B,W
08E2: BCF 03.5
08E3: BSF 03.6
08E4: MOVWF 27
08E5: BSF 03.5
08E6: BCF 03.6
08E7: MOVF 6A,W
08E8: BCF 03.5
08E9: BSF 03.6
08EA: MOVWF 26
08EB: BSF 03.5
08EC: BCF 03.6
08ED: MOVF 69,W
08EE: BCF 03.5
08EF: BSF 03.6
08F0: MOVWF 25
08F1: BCF 0A.3
08F2: BCF 03.6
08F3: CALL 5DC
08F4: BSF 0A.3
08F5: MOVF 7A,W
08F6: BSF 03.5
08F7: MOVWF 68
08F8: MOVF 79,W
08F9: MOVWF 67
08FA: MOVF 78,W
08FB: MOVWF 66
08FC: MOVF 77,W
08FD: MOVWF 65
....................
.................... return p;
08FE: MOVF 65,W
08FF: MOVWF 77
0900: MOVF 66,W
0901: MOVWF 78
0902: MOVF 67,W
0903: MOVWF 79
0904: MOVF 68,W
0905: MOVWF 7A
.................... }
0906: BCF 03.5
0907: BCF 0A.3
0908: BSF 0A.4
0909: GOTO 5E7 (RETURN)
....................
....................
....................
.................... #include "HMC5883L.h"
.................... #define MAG_ADDR_R 0x3D //addresa pro cteni
.................... #define MAG_ADDR_W 0x3C
....................
....................
.................... //Konstanty nastavujici rozsah
.................... //pro void set_mag_roz (unsigned int8 h)
.................... #define MAG_ROZ088 0x00
.................... #define MAG_ROZ130 0x20
.................... #define MAG_ROZ190 0x40
.................... #define MAG_ROZ250 0x60
.................... #define MAG_ROZ400 0x80
.................... #define MAG_ROZ470 0xA0
.................... #define MAG_ROZ560 0xC0
.................... #define MAG_ROZ810 0xE0
....................
....................
.................... #include "HMC5883L.c"
.................... void set_mag (void) //uvodni nastaveni na kontinualni mereni, rozsah ± 8.1 Ga, frekvence mereni 15HZ
.................... {
.................... i2c_start(); //nastavení Configuration Register A
*
03F7: BSF 28.3
03F8: MOVF 28,W
03F9: BSF 03.5
03FA: MOVWF 07
03FB: NOP
03FC: BCF 03.5
03FD: BSF 28.4
03FE: MOVF 28,W
03FF: BSF 03.5
0400: MOVWF 07
0401: NOP
0402: BCF 03.5
0403: BCF 07.3
0404: BCF 28.3
0405: MOVF 28,W
0406: BSF 03.5
0407: MOVWF 07
0408: NOP
0409: BCF 03.5
040A: BCF 07.4
040B: BCF 28.4
040C: MOVF 28,W
040D: BSF 03.5
040E: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
040F: MOVLW 3C
0410: BCF 03.5
0411: BSF 03.6
0412: MOVWF 12
0413: BCF 03.6
0414: CALL 22E
.................... I2C_Write(0x00);
0415: BSF 03.6
0416: CLRF 12
0417: BCF 03.6
0418: CALL 22E
.................... I2C_Write(0x70);
0419: MOVLW 70
041A: BSF 03.6
041B: MOVWF 12
041C: BCF 03.6
041D: CALL 22E
.................... i2c_stop();
041E: BCF 28.3
041F: MOVF 28,W
0420: BSF 03.5
0421: MOVWF 07
0422: NOP
0423: BCF 03.5
0424: BSF 28.4
0425: MOVF 28,W
0426: BSF 03.5
0427: MOVWF 07
0428: BCF 03.5
0429: BTFSS 07.4
042A: GOTO 429
042B: NOP
042C: GOTO 42D
042D: NOP
042E: BSF 28.3
042F: MOVF 28,W
0430: BSF 03.5
0431: MOVWF 07
0432: NOP
.................... Delay_ms(6);
0433: MOVLW 06
0434: MOVWF 62
0435: BCF 03.5
0436: CALL 303
....................
.................... i2c_start(); //nastavení Configuration Register B
0437: BSF 28.3
0438: MOVF 28,W
0439: BSF 03.5
043A: MOVWF 07
043B: NOP
043C: BCF 03.5
043D: BSF 28.4
043E: MOVF 28,W
043F: BSF 03.5
0440: MOVWF 07
0441: NOP
0442: BCF 03.5
0443: BCF 07.3
0444: BCF 28.3
0445: MOVF 28,W
0446: BSF 03.5
0447: MOVWF 07
0448: NOP
0449: BCF 03.5
044A: BCF 07.4
044B: BCF 28.4
044C: MOVF 28,W
044D: BSF 03.5
044E: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
044F: MOVLW 3C
0450: BCF 03.5
0451: BSF 03.6
0452: MOVWF 12
0453: BCF 03.6
0454: CALL 22E
.................... I2C_Write(0x01);
0455: MOVLW 01
0456: BSF 03.6
0457: MOVWF 12
0458: BCF 03.6
0459: CALL 22E
.................... I2C_Write(MAG_ROZ810);
045A: MOVLW E0
045B: BSF 03.6
045C: MOVWF 12
045D: BCF 03.6
045E: CALL 22E
.................... i2c_stop();
045F: BCF 28.3
0460: MOVF 28,W
0461: BSF 03.5
0462: MOVWF 07
0463: NOP
0464: BCF 03.5
0465: BSF 28.4
0466: MOVF 28,W
0467: BSF 03.5
0468: MOVWF 07
0469: BCF 03.5
046A: BTFSS 07.4
046B: GOTO 46A
046C: NOP
046D: GOTO 46E
046E: NOP
046F: BSF 28.3
0470: MOVF 28,W
0471: BSF 03.5
0472: MOVWF 07
0473: NOP
....................
.................... Delay_ms(6);
0474: MOVLW 06
0475: MOVWF 62
0476: BCF 03.5
0477: CALL 303
....................
.................... i2c_start(); //nastveni Mode Register
0478: BSF 28.3
0479: MOVF 28,W
047A: BSF 03.5
047B: MOVWF 07
047C: NOP
047D: BCF 03.5
047E: BSF 28.4
047F: MOVF 28,W
0480: BSF 03.5
0481: MOVWF 07
0482: NOP
0483: BCF 03.5
0484: BCF 07.3
0485: BCF 28.3
0486: MOVF 28,W
0487: BSF 03.5
0488: MOVWF 07
0489: NOP
048A: BCF 03.5
048B: BCF 07.4
048C: BCF 28.4
048D: MOVF 28,W
048E: BSF 03.5
048F: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
0490: MOVLW 3C
0491: BCF 03.5
0492: BSF 03.6
0493: MOVWF 12
0494: BCF 03.6
0495: CALL 22E
.................... I2C_Write(0x02);
0496: MOVLW 02
0497: BSF 03.6
0498: MOVWF 12
0499: BCF 03.6
049A: CALL 22E
.................... I2C_Write(0x00);
049B: BSF 03.6
049C: CLRF 12
049D: BCF 03.6
049E: CALL 22E
.................... i2c_stop();
049F: BCF 28.3
04A0: MOVF 28,W
04A1: BSF 03.5
04A2: MOVWF 07
04A3: NOP
04A4: BCF 03.5
04A5: BSF 28.4
04A6: MOVF 28,W
04A7: BSF 03.5
04A8: MOVWF 07
04A9: BCF 03.5
04AA: BTFSS 07.4
04AB: GOTO 4AA
04AC: NOP
04AD: GOTO 4AE
04AE: NOP
04AF: BSF 28.3
04B0: MOVF 28,W
04B1: BSF 03.5
04B2: MOVWF 07
04B3: NOP
.................... Delay_ms(6);
04B4: MOVLW 06
04B5: MOVWF 62
04B6: BCF 03.5
04B7: CALL 303
.................... }
04B8: BCF 0A.3
04B9: BSF 0A.4
04BA: GOTO 5C1 (RETURN)
....................
.................... void set_mag_roz (unsigned int8 h) //nastavy rozsah
.................... {
....................
.................... //
....................
....................
.................... i2c_start();
.................... I2C_Write(MAG_ADDR_W);
.................... I2C_Write(0x01);
.................... I2C_Write(h);
.................... i2c_stop();
....................
.................... Delay_ms(6);
....................
....................
.................... }
....................
....................
.................... byte mag_read(byte reg) //pro cteni reg
.................... {
....................
.................... i2c_start();
*
0D3F: BSF 28.3
0D40: MOVF 28,W
0D41: BSF 03.5
0D42: MOVWF 07
0D43: NOP
0D44: BCF 03.5
0D45: BSF 28.4
0D46: MOVF 28,W
0D47: BSF 03.5
0D48: MOVWF 07
0D49: NOP
0D4A: BCF 03.5
0D4B: BCF 07.3
0D4C: BCF 28.3
0D4D: MOVF 28,W
0D4E: BSF 03.5
0D4F: MOVWF 07
0D50: NOP
0D51: BCF 03.5
0D52: BCF 07.4
0D53: BCF 28.4
0D54: MOVF 28,W
0D55: BSF 03.5
0D56: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
0D57: MOVLW 3C
0D58: BCF 03.5
0D59: BSF 03.6
0D5A: MOVWF 12
0D5B: BCF 0A.3
0D5C: BCF 03.6
0D5D: CALL 22E
0D5E: BSF 0A.3
.................... I2C_write(reg);
0D5F: BSF 03.5
0D60: MOVF 6F,W
0D61: BCF 03.5
0D62: BSF 03.6
0D63: MOVWF 12
0D64: BCF 0A.3
0D65: BCF 03.6
0D66: CALL 22E
0D67: BSF 0A.3
.................... i2c_stop();
0D68: BCF 28.3
0D69: MOVF 28,W
0D6A: BSF 03.5
0D6B: MOVWF 07
0D6C: NOP
0D6D: BCF 03.5
0D6E: BSF 28.4
0D6F: MOVF 28,W
0D70: BSF 03.5
0D71: MOVWF 07
0D72: BCF 03.5
0D73: BTFSS 07.4
0D74: GOTO 573
0D75: NOP
0D76: GOTO 577
0D77: NOP
0D78: BSF 28.3
0D79: MOVF 28,W
0D7A: BSF 03.5
0D7B: MOVWF 07
0D7C: NOP
.................... i2c_start();
0D7D: BCF 03.5
0D7E: BSF 28.3
0D7F: MOVF 28,W
0D80: BSF 03.5
0D81: MOVWF 07
0D82: NOP
0D83: BCF 03.5
0D84: BSF 28.4
0D85: MOVF 28,W
0D86: BSF 03.5
0D87: MOVWF 07
0D88: NOP
0D89: BCF 03.5
0D8A: BCF 07.3
0D8B: BCF 28.3
0D8C: MOVF 28,W
0D8D: BSF 03.5
0D8E: MOVWF 07
0D8F: NOP
0D90: BCF 03.5
0D91: BCF 07.4
0D92: BCF 28.4
0D93: MOVF 28,W
0D94: BSF 03.5
0D95: MOVWF 07
.................... I2C_Write(MAG_ADDR_R);
0D96: MOVLW 3D
0D97: BCF 03.5
0D98: BSF 03.6
0D99: MOVWF 12
0D9A: BCF 0A.3
0D9B: BCF 03.6
0D9C: CALL 22E
0D9D: BSF 0A.3
.................... reg=i2c_read(0);
0D9E: CLRF 77
0D9F: BCF 0A.3
0DA0: CALL 2B6
0DA1: BSF 0A.3
0DA2: MOVF 78,W
0DA3: BSF 03.5
0DA4: MOVWF 6F
.................... return reg;
0DA5: MOVF 6F,W
0DA6: MOVWF 78
.................... }
0DA7: BCF 03.5
0DA8: RETURN
....................
....................
.................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo
.................... {
.................... signed int16 x;
.................... x = (((unsigned int16) h << 8) + l );
*
07C1: BSF 03.6
07C2: CLRF 14
07C3: BSF 03.5
07C4: BCF 03.6
07C5: MOVF 6F,W
07C6: BCF 03.5
07C7: BSF 03.6
07C8: MOVWF 13
07C9: MOVWF 14
07CA: CLRF 13
07CB: MOVF 10,W
07CC: ADDWF 13,W
07CD: MOVWF 11
07CE: MOVF 14,W
07CF: MOVWF 12
07D0: BTFSC 03.0
07D1: INCF 12,F
.................... return x;
07D2: MOVF 11,W
07D3: MOVWF 78
07D4: MOVF 12,W
07D5: MOVWF 79
.................... }
07D6: BCF 03.6
07D7: RETURN
....................
....................
.................... signed int16 mag_readX(void) //nacteni osy x
.................... {
.................... unsigned int8 h,l;
.................... signed int16 x;
.................... h=mag_read(0x03);
*
1000: MOVLW 03
1001: BSF 03.5
1002: MOVWF 6F
1003: BCF 0A.4
1004: BSF 0A.3
1005: BCF 03.5
1006: CALL 53F
1007: BSF 0A.4
1008: BCF 0A.3
1009: MOVF 78,W
100A: BSF 03.5
100B: MOVWF 6B
.................... l=mag_read(0x04);
100C: MOVLW 04
100D: MOVWF 6F
100E: BCF 0A.4
100F: BSF 0A.3
1010: BCF 03.5
1011: CALL 53F
1012: BSF 0A.4
1013: BCF 0A.3
1014: MOVF 78,W
1015: BSF 03.5
1016: MOVWF 6C
.................... x=mag_vypocet(h,l);
1017: MOVF 6B,W
1018: MOVWF 6F
1019: MOVF 6C,W
101A: BCF 03.5
101B: BSF 03.6
101C: MOVWF 10
101D: BCF 0A.4
101E: BCF 03.6
101F: CALL 7C1
1020: BSF 0A.4
1021: MOVF 79,W
1022: BSF 03.5
1023: MOVWF 6E
1024: MOVF 78,W
1025: MOVWF 6D
.................... return x;
1026: MOVF 6D,W
1027: MOVWF 78
1028: MOVF 6E,W
1029: MOVWF 79
....................
.................... }
....................
....................
.................... signed int16 mag_readY(void) //nacteni osy x
.................... {
.................... unsigned int8 h,l;
.................... signed int16 x;
.................... h=mag_read(0x07);
*
102E: MOVLW 07
102F: MOVWF 6F
1030: BCF 0A.4
1031: BSF 0A.3
1032: BCF 03.5
1033: CALL 53F
1034: BSF 0A.4
1035: BCF 0A.3
1036: MOVF 78,W
1037: BSF 03.5
1038: MOVWF 6B
.................... l=mag_read(0x08);
1039: MOVLW 08
103A: MOVWF 6F
103B: BCF 0A.4
103C: BSF 0A.3
103D: BCF 03.5
103E: CALL 53F
103F: BSF 0A.4
1040: BCF 0A.3
1041: MOVF 78,W
1042: BSF 03.5
1043: MOVWF 6C
.................... x=mag_vypocet(h,l);
1044: MOVF 6B,W
1045: MOVWF 6F
1046: MOVF 6C,W
1047: BCF 03.5
1048: BSF 03.6
1049: MOVWF 10
104A: BCF 0A.4
104B: BCF 03.6
104C: CALL 7C1
104D: BSF 0A.4
104E: MOVF 79,W
104F: BSF 03.5
1050: MOVWF 6E
1051: MOVF 78,W
1052: MOVWF 6D
.................... return x;
1053: MOVF 6D,W
1054: MOVWF 78
1055: MOVF 6E,W
1056: MOVWF 79
....................
.................... }
....................
....................
.................... signed int16 mag_readZ(void) //nacteni osy x
.................... {
.................... unsigned int8 h,l;
.................... signed int16 x;
.................... h=mag_read(0x05);
*
105B: MOVLW 05
105C: MOVWF 6F
105D: BCF 0A.4
105E: BSF 0A.3
105F: BCF 03.5
1060: CALL 53F
1061: BSF 0A.4
1062: BCF 0A.3
1063: MOVF 78,W
1064: BSF 03.5
1065: MOVWF 6B
.................... l=mag_read(0x06);
1066: MOVLW 06
1067: MOVWF 6F
1068: BCF 0A.4
1069: BSF 0A.3
106A: BCF 03.5
106B: CALL 53F
106C: BSF 0A.4
106D: BCF 0A.3
106E: MOVF 78,W
106F: BSF 03.5
1070: MOVWF 6C
.................... x=mag_vypocet(h,l);
1071: MOVF 6B,W
1072: MOVWF 6F
1073: MOVF 6C,W
1074: BCF 03.5
1075: BSF 03.6
1076: MOVWF 10
1077: BCF 0A.4
1078: BCF 03.6
1079: CALL 7C1
107A: BSF 0A.4
107B: MOVF 79,W
107C: BSF 03.5
107D: MOVWF 6E
107E: MOVF 78,W
107F: MOVWF 6D
.................... return x;
1080: MOVF 6D,W
1081: MOVWF 78
1082: MOVF 6E,W
1083: MOVWF 79
....................
.................... }
....................
....................
....................
....................
....................
....................
....................
....................
....................
.................... unsigned int16 timer0_overflow_count;
.................... float anemo=0;
....................
....................
....................
.................... #int_TIMER1
.................... void TIMER1_isr(void)
.................... {
.................... // 32.768 kHz krystal pro timer1 oscilátor
.................... anemo = ((timer0_overflow_count * 0xFF) + get_timer0())/(32768.0/0xFFFF); // pocet pulzu za 1s
*
0123: MOVF 2C,W
0124: BSF 03.6
0125: MOVWF 38
0126: BCF 03.6
0127: MOVF 2B,W
0128: BSF 03.6
0129: MOVWF 37
012A: CLRF 3A
012B: MOVLW FF
012C: MOVWF 39
*
0141: MOVF 79,W
0142: MOVWF 38
0143: MOVF 78,W
0144: MOVWF 37
0145: BCF 03.6
0146: MOVF 01,W
0147: BSF 03.6
0148: ADDWF 37,F
0149: BTFSC 03.0
014A: INCF 38,F
014B: MOVF 38,W
014C: MOVWF 45
014D: MOVF 37,W
014E: MOVWF 44
014F: BCF 03.6
0150: CALL 038
0151: MOVF 7A,W
0152: BSF 03.6
0153: MOVWF 59
0154: MOVF 79,W
0155: MOVWF 58
0156: MOVF 78,W
0157: MOVWF 57
0158: MOVF 77,W
0159: MOVWF 56
015A: MOVLW 80
015B: MOVWF 5D
015C: CLRF 5C
015D: CLRF 5B
015E: MOVLW 7E
015F: MOVWF 5A
0160: BCF 03.6
0161: CALL 057
0162: MOVF 7A,W
0163: MOVWF 30
0164: MOVF 79,W
0165: MOVWF 2F
0166: MOVF 78,W
0167: MOVWF 2E
0168: MOVF 77,W
0169: MOVWF 2D
.................... anemo = anemo / 2; //pocet otacek za sekundu
016A: MOVF 30,W
016B: BSF 03.6
016C: MOVWF 59
016D: BCF 03.6
016E: MOVF 2F,W
016F: BSF 03.6
0170: MOVWF 58
0171: BCF 03.6
0172: MOVF 2E,W
0173: BSF 03.6
0174: MOVWF 57
0175: BCF 03.6
0176: MOVF 2D,W
0177: BSF 03.6
0178: MOVWF 56
0179: CLRF 5D
017A: CLRF 5C
017B: CLRF 5B
017C: MOVLW 80
017D: MOVWF 5A
017E: BCF 03.6
017F: CALL 057
0180: MOVF 7A,W
0181: MOVWF 30
0182: MOVF 79,W
0183: MOVWF 2F
0184: MOVF 78,W
0185: MOVWF 2E
0186: MOVF 77,W
0187: MOVWF 2D
....................
.................... timer0_overflow_count=0; //nulovani
0188: CLRF 2C
0189: CLRF 2B
.................... set_timer0(0);
018A: CLRF 01
.................... set_timer1(0);
018B: CLRF 0F
018C: CLRF 0E
....................
.................... }
....................
018D: BCF 0C.0
018E: BCF 0A.3
018F: BCF 0A.4
0190: GOTO 021
.................... #int_TIMER0 //pro preteceni èítaèe pùlzù od anemometru (RA4)
.................... void TIMER0_isr(void)
.................... {
.................... timer0_overflow_count++;
0191: INCF 2B,F
0192: BTFSC 03.2
0193: INCF 2C,F
.................... }
....................
....................
0194: BCF 0B.2
0195: BCF 0A.3
0196: BCF 0A.4
0197: GOTO 021
.................... float azimut (void) //vypocet azimutu smeru vetru
.................... {
.................... signed int16 X,Y,Z;
.................... X= mag_readX();
*
102A: MOVF 79,W
102B: MOVWF 5E
102C: MOVF 78,W
102D: MOVWF 5D
.................... Y= mag_readY();
*
1057: MOVF 79,W
1058: MOVWF 60
1059: MOVF 78,W
105A: MOVWF 5F
.................... Z= mag_readZ();
*
1084: MOVF 79,W
1085: MOVWF 62
1086: MOVF 78,W
1087: MOVWF 61
....................
.................... float a, b;
.................... a=(float)Y/X;
1088: MOVF 60,W
1089: BCF 03.5
108A: BSF 03.6
108B: MOVWF 11
108C: BSF 03.5
108D: BCF 03.6
108E: MOVF 5F,W
108F: BCF 03.5
1090: BSF 03.6
1091: MOVWF 10
1092: BCF 0A.4
1093: BCF 03.6
1094: CALL 7D8
1095: BSF 0A.4
1096: MOVF 77,W
1097: BSF 03.5
1098: MOVWF 6B
1099: MOVF 78,W
109A: MOVWF 6C
109B: MOVF 79,W
109C: MOVWF 6D
109D: MOVF 7A,W
109E: MOVWF 6E
109F: MOVF 5E,W
10A0: BCF 03.5
10A1: BSF 03.6
10A2: MOVWF 11
10A3: BSF 03.5
10A4: BCF 03.6
10A5: MOVF 5D,W
10A6: BCF 03.5
10A7: BSF 03.6
10A8: MOVWF 10
10A9: BCF 0A.4
10AA: BCF 03.6
10AB: CALL 7D8
10AC: BSF 0A.4
10AD: CLRF 27
10AE: BTFSC 0B.7
10AF: BSF 27.7
10B0: BCF 0B.7
10B1: BSF 03.5
10B2: MOVF 6E,W
10B3: BCF 03.5
10B4: BSF 03.6
10B5: MOVWF 59
10B6: BSF 03.5
10B7: BCF 03.6
10B8: MOVF 6D,W
10B9: BCF 03.5
10BA: BSF 03.6
10BB: MOVWF 58
10BC: BSF 03.5
10BD: BCF 03.6
10BE: MOVF 6C,W
10BF: BCF 03.5
10C0: BSF 03.6
10C1: MOVWF 57
10C2: BSF 03.5
10C3: BCF 03.6
10C4: MOVF 6B,W
10C5: BCF 03.5
10C6: BSF 03.6
10C7: MOVWF 56
10C8: MOVF 7A,W
10C9: MOVWF 5D
10CA: MOVF 79,W
10CB: MOVWF 5C
10CC: MOVF 78,W
10CD: MOVWF 5B
10CE: MOVF 77,W
10CF: MOVWF 5A
10D0: BCF 0A.4
10D1: BCF 03.6
10D2: CALL 057
10D3: BSF 0A.4
10D4: BTFSC 27.7
10D5: BSF 0B.7
10D6: MOVF 7A,W
10D7: BSF 03.5
10D8: MOVWF 66
10D9: MOVF 79,W
10DA: MOVWF 65
10DB: MOVF 78,W
10DC: MOVWF 64
10DD: MOVF 77,W
10DE: MOVWF 63
.................... b=atan(a);
10DF: MOVF 66,W
10E0: MOVWF 6E
10E1: MOVF 65,W
10E2: MOVWF 6D
10E3: MOVF 64,W
10E4: MOVWF 6C
10E5: MOVF 63,W
10E6: MOVWF 6B
*
1403: MOVF 7A,W
1404: BSF 03.5
1405: BCF 03.6
1406: MOVWF 6A
1407: MOVF 79,W
1408: MOVWF 69
1409: MOVF 78,W
140A: MOVWF 68
140B: MOVF 77,W
140C: MOVWF 67
140D: BCF 03.5
140E: CLRF 27
140F: BTFSC 0B.7
1410: BSF 27.7
1411: BCF 0B.7
.................... b = (b/3.14)*180;
1412: BSF 03.5
1413: MOVF 6A,W
1414: BCF 03.5
1415: BSF 03.6
1416: MOVWF 59
1417: BSF 03.5
1418: BCF 03.6
1419: MOVF 69,W
141A: BCF 03.5
141B: BSF 03.6
141C: MOVWF 58
141D: BSF 03.5
141E: BCF 03.6
141F: MOVF 68,W
1420: BCF 03.5
1421: BSF 03.6
1422: MOVWF 57
1423: BSF 03.5
1424: BCF 03.6
1425: MOVF 67,W
1426: BCF 03.5
1427: BSF 03.6
1428: MOVWF 56
1429: MOVLW C3
142A: MOVWF 5D
142B: MOVLW F5
142C: MOVWF 5C
142D: MOVLW 48
142E: MOVWF 5B
142F: MOVLW 80
1430: MOVWF 5A
1431: BCF 0A.4
1432: BCF 03.6
1433: CALL 057
1434: BSF 0A.4
1435: BTFSC 27.7
1436: BSF 0B.7
1437: MOVF 77,W
1438: BSF 03.5
1439: MOVWF 6B
143A: MOVF 78,W
143B: MOVWF 6C
143C: MOVF 79,W
143D: MOVWF 6D
143E: MOVF 7A,W
143F: MOVWF 6E
1440: BCF 03.5
1441: BSF 03.6
1442: MOVWF 24
1443: BSF 03.5
1444: BCF 03.6
1445: MOVF 6D,W
1446: BCF 03.5
1447: BSF 03.6
1448: MOVWF 23
1449: BSF 03.5
144A: BCF 03.6
144B: MOVF 6C,W
144C: BCF 03.5
144D: BSF 03.6
144E: MOVWF 22
144F: BSF 03.5
1450: BCF 03.6
1451: MOVF 6B,W
1452: BCF 03.5
1453: BSF 03.6
1454: MOVWF 21
1455: CLRF 28
1456: CLRF 27
1457: MOVLW 34
1458: MOVWF 26
1459: MOVLW 86
145A: MOVWF 25
145B: BCF 0A.4
145C: BSF 0A.3
145D: BCF 03.6
145E: CALL 2AB
145F: BSF 0A.4
1460: BCF 0A.3
1461: MOVF 7A,W
1462: BSF 03.5
1463: MOVWF 6A
1464: MOVF 79,W
1465: MOVWF 69
1466: MOVF 78,W
1467: MOVWF 68
1468: MOVF 77,W
1469: MOVWF 67
.................... b=abs(b);
146A: MOVF 67,W
146B: MOVWF 77
146C: MOVF 68,W
146D: MOVWF 78
146E: MOVF 69,W
146F: MOVWF 79
1470: MOVF 6A,W
1471: MOVWF 7A
1472: BCF 78.7
1473: MOVF 6A,W
1474: MOVWF 6A
1475: MOVF 69,W
1476: MOVWF 69
1477: MOVF 78,W
1478: MOVWF 68
1479: MOVF 67,W
147A: MOVWF 67
....................
.................... if(X==0) //osetreni proti deleni 0
147B: MOVF 5D,F
147C: BTFSS 03.2
147D: GOTO 498
147E: MOVF 5E,F
147F: BTFSS 03.2
1480: GOTO 498
.................... {
.................... if(Y>0)
1481: BTFSC 60.7
1482: GOTO 491
1483: MOVF 60,F
1484: BTFSS 03.2
1485: GOTO 48A
1486: MOVF 5F,W
1487: SUBLW 00
1488: BTFSC 03.0
1489: GOTO 491
.................... {
.................... b=90;
148A: CLRF 6A
148B: CLRF 69
148C: MOVLW 34
148D: MOVWF 68
148E: MOVLW 85
148F: MOVWF 67
.................... }
.................... else
1490: GOTO 497
.................... {
.................... b=270;
1491: CLRF 6A
1492: CLRF 69
1493: MOVLW 07
1494: MOVWF 68
1495: MOVLW 87
1496: MOVWF 67
.................... }
.................... }
.................... else
1497: GOTO 532
.................... {
.................... if(X>0)
1498: BTFSC 5E.7
1499: GOTO 501
149A: MOVF 5E,F
149B: BTFSS 03.2
149C: GOTO 4A1
149D: MOVF 5D,W
149E: SUBLW 00
149F: BTFSC 03.0
14A0: GOTO 501
.................... {
.................... if(Y>=0)
14A1: BTFSC 60.7
14A2: GOTO 4D2
.................... {
.................... b=180+b;
14A3: BCF 03.1
14A4: BCF 03.5
14A5: BSF 03.6
14A6: CLRF 24
14A7: CLRF 23
14A8: MOVLW 34
14A9: MOVWF 22
14AA: MOVLW 86
14AB: MOVWF 21
14AC: BSF 03.5
14AD: BCF 03.6
14AE: MOVF 6A,W
14AF: BCF 03.5
14B0: BSF 03.6
14B1: MOVWF 28
14B2: BSF 03.5
14B3: BCF 03.6
14B4: MOVF 69,W
14B5: BCF 03.5
14B6: BSF 03.6
14B7: MOVWF 27
14B8: BSF 03.5
14B9: BCF 03.6
14BA: MOVF 68,W
14BB: BCF 03.5
14BC: BSF 03.6
14BD: MOVWF 26
14BE: BSF 03.5
14BF: BCF 03.6
14C0: MOVF 67,W
14C1: BCF 03.5
14C2: BSF 03.6
14C3: MOVWF 25
14C4: BCF 0A.4
14C5: BCF 03.6
14C6: CALL 5DC
14C7: BSF 0A.4
14C8: MOVF 7A,W
14C9: BSF 03.5
14CA: MOVWF 6A
14CB: MOVF 79,W
14CC: MOVWF 69
14CD: MOVF 78,W
14CE: MOVWF 68
14CF: MOVF 77,W
14D0: MOVWF 67
....................
.................... }
.................... else
14D1: GOTO 500
.................... {
.................... b=180-b;
14D2: BSF 03.1
14D3: BCF 03.5
14D4: BSF 03.6
14D5: CLRF 24
14D6: CLRF 23
14D7: MOVLW 34
14D8: MOVWF 22
14D9: MOVLW 86
14DA: MOVWF 21
14DB: BSF 03.5
14DC: BCF 03.6
14DD: MOVF 6A,W
14DE: BCF 03.5
14DF: BSF 03.6
14E0: MOVWF 28
14E1: BSF 03.5
14E2: BCF 03.6
14E3: MOVF 69,W
14E4: BCF 03.5
14E5: BSF 03.6
14E6: MOVWF 27
14E7: BSF 03.5
14E8: BCF 03.6
14E9: MOVF 68,W
14EA: BCF 03.5
14EB: BSF 03.6
14EC: MOVWF 26
14ED: BSF 03.5
14EE: BCF 03.6
14EF: MOVF 67,W
14F0: BCF 03.5
14F1: BSF 03.6
14F2: MOVWF 25
14F3: BCF 0A.4
14F4: BCF 03.6
14F5: CALL 5DC
14F6: BSF 0A.4
14F7: MOVF 7A,W
14F8: BSF 03.5
14F9: MOVWF 6A
14FA: MOVF 79,W
14FB: MOVWF 69
14FC: MOVF 78,W
14FD: MOVWF 68
14FE: MOVF 77,W
14FF: MOVWF 67
....................
.................... }
.................... }
.................... else
1500: GOTO 532
.................... {
.................... if(Y>=0)
1501: BTFSC 60.7
1502: GOTO 532
.................... {
.................... b=360-b;
1503: BSF 03.1
1504: BCF 03.5
1505: BSF 03.6
1506: CLRF 24
1507: CLRF 23
1508: MOVLW 34
1509: MOVWF 22
150A: MOVLW 87
150B: MOVWF 21
150C: BSF 03.5
150D: BCF 03.6
150E: MOVF 6A,W
150F: BCF 03.5
1510: BSF 03.6
1511: MOVWF 28
1512: BSF 03.5
1513: BCF 03.6
1514: MOVF 69,W
1515: BCF 03.5
1516: BSF 03.6
1517: MOVWF 27
1518: BSF 03.5
1519: BCF 03.6
151A: MOVF 68,W
151B: BCF 03.5
151C: BSF 03.6
151D: MOVWF 26
151E: BSF 03.5
151F: BCF 03.6
1520: MOVF 67,W
1521: BCF 03.5
1522: BSF 03.6
1523: MOVWF 25
1524: BCF 0A.4
1525: BCF 03.6
1526: CALL 5DC
1527: BSF 0A.4
1528: MOVF 7A,W
1529: BSF 03.5
152A: MOVWF 6A
152B: MOVF 79,W
152C: MOVWF 69
152D: MOVF 78,W
152E: MOVWF 68
152F: MOVF 77,W
1530: MOVWF 67
....................
.................... }
.................... else
1531: GOTO 532
.................... {
.................... b=b;
....................
.................... }
.................... }
....................
.................... }
....................
.................... return b;
1532: MOVF 67,W
1533: MOVWF 77
1534: MOVF 68,W
1535: MOVWF 78
1536: MOVF 69,W
1537: MOVWF 79
1538: MOVF 6A,W
1539: MOVWF 7A
....................
.................... }
153A: BCF 03.5
153B: BCF 0A.3
153C: BSF 0A.4
153D: GOTO 629 (RETURN)
....................
....................
....................
....................
....................
....................
.................... void uvitani(void) // uvodni zprava
.................... {
.................... printf("\r\n\r\n# Meteorologicka stanice %s (C) 2013 www.mlab.cz \r\n",VERSION);
.................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message
.................... printf("# ver poradi ");
.................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] ");
.................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n");
.................... }
....................
.................... void main()
.................... {
153E: CLRF 04
153F: BCF 03.7
1540: MOVLW 1F
1541: ANDWF 03,F
1542: MOVLW 71
1543: BSF 03.5
1544: MOVWF 0F
1545: MOVF 0F,W
1546: BCF 03.5
1547: BCF 28.7
1548: MOVF 28,W
1549: BSF 03.5
154A: MOVWF 07
154B: BCF 03.5
154C: BSF 07.7
154D: CLRF 30
154E: CLRF 2F
154F: CLRF 2E
1550: CLRF 2D
1551: BSF 03.5
1552: BSF 03.6
1553: MOVF 09,W
1554: ANDLW C0
1555: MOVWF 09
1556: BCF 03.6
1557: BCF 1F.4
1558: BCF 1F.5
1559: MOVLW 00
155A: BSF 03.6
155B: MOVWF 08
155C: BCF 03.5
155D: CLRF 07
155E: CLRF 08
155F: CLRF 09
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
*
1567: BSF 03.5
1568: BSF 03.6
1569: MOVF 09,W
156A: ANDLW C0
156B: MOVWF 09
156C: BCF 03.6
156D: BCF 1F.4
156E: BCF 1F.5
156F: MOVLW 00
1570: BSF 03.6
1571: MOVWF 08
.................... setup_adc(ADC_CLOCK_DIV_2);
1572: BCF 03.5
1573: BCF 03.6
1574: BCF 1F.6
1575: BCF 1F.7
1576: BSF 03.5
1577: BCF 1F.7
1578: BCF 03.5
1579: BSF 1F.0
.................... setup_spi(SPI_SS_DISABLED);
157A: BCF 14.5
157B: BCF 28.5
157C: MOVF 28,W
157D: BSF 03.5
157E: MOVWF 07
157F: BCF 03.5
1580: BSF 28.4
1581: MOVF 28,W
1582: BSF 03.5
1583: MOVWF 07
1584: BCF 03.5
1585: BCF 28.3
1586: MOVF 28,W
1587: BSF 03.5
1588: MOVWF 07
1589: MOVLW 01
158A: BCF 03.5
158B: MOVWF 14
158C: MOVLW 00
158D: BSF 03.5
158E: MOVWF 14
.................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
158F: MOVF 01,W
1590: ANDLW C7
1591: IORLW 28
1592: MOVWF 01
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT);
1593: MOVLW 0F
1594: BCF 03.5
1595: MOVWF 10
.................... setup_timer_2(T2_DISABLED,0,1);
1596: MOVLW 00
1597: MOVWF 78
1598: MOVWF 12
1599: MOVLW 00
159A: BSF 03.5
159B: MOVWF 12
.................... setup_ccp1(CCP_OFF);
159C: BCF 03.5
159D: BSF 28.2
159E: MOVF 28,W
159F: BSF 03.5
15A0: MOVWF 07
15A1: BCF 03.5
15A2: CLRF 17
15A3: BSF 03.5
15A4: CLRF 1B
15A5: CLRF 1C
15A6: MOVLW 01
15A7: MOVWF 1D
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
15A8: BCF 03.5
15A9: BSF 03.6
15AA: CLRF 07
15AB: CLRF 08
15AC: CLRF 09
....................
....................
.................... float altimet_t; //teplota z MPL3115
.................... float altimet_p; //tlak z MPL3115
.................... float altimet_a; //vyska z MPL3115
.................... float sht25_t; //teplota z SHT25
.................... float sht25_h; //relativni vlhkost z SHT25
.................... float smer_v; //smer vetru
....................
....................
.................... unsigned int8 sht_config;
....................
....................
....................
.................... //nastaveni SHT25
.................... SHT25_soft_reset();
15AD: BCF 0A.4
15AE: BCF 03.6
15AF: GOTO 27A
15B0: BSF 0A.4
.................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; //vypnuti topeni v SHT25
15B1: CLRF 4B
.................... SHT25_setup(sht_config);
15B2: MOVF 4B,W
15B3: BSF 03.5
15B4: MOVWF 5D
15B5: BCF 0A.4
15B6: BCF 03.5
15B7: GOTO 317
15B8: BSF 0A.4
....................
.................... //nastavení pøeruení pro anemometr
.................... enable_interrupts(INT_TIMER1);
15B9: BSF 03.5
15BA: BSF 0C.0
.................... enable_interrupts(INT_TIMER0);
15BB: BCF 03.5
15BC: BSF 0B.5
.................... enable_interrupts(GLOBAL);
15BD: MOVLW C0
15BE: IORWF 0B,F
....................
....................
.................... //uvitani();
.................... set_mag(); //nastaveni magnetometru pro smer vetru
15BF: BCF 0A.4
15C0: GOTO 3F7
15C1: BSF 0A.4
....................
.................... // vynulovani promenych pro anemometr
.................... set_timer0(0);
15C2: CLRF 01
.................... set_timer1(0);
15C3: CLRF 0F
15C4: CLRF 0E
.................... timer0_overflow_count=0;
15C5: CLRF 2C
15C6: CLRF 2B
.................... anemo=0;
15C7: CLRF 30
15C8: CLRF 2F
15C9: CLRF 2E
15CA: CLRF 2D
....................
....................
....................
.................... while(TRUE)
.................... {
....................
.................... char dataOUT[60];
....................
.................... mpl3115_setP(); //nastaveni pro tlak a teplotu
15CB: BCF 0A.4
15CC: GOTO 4BB
15CD: BSF 0A.4
.................... delay_ms (500);
15CE: MOVLW 02
15CF: MOVWF 4D
15D0: MOVLW FA
15D1: BSF 03.5
15D2: MOVWF 62
15D3: BCF 0A.4
15D4: BCF 03.5
15D5: CALL 303
15D6: BSF 0A.4
15D7: DECFSZ 4D,F
15D8: GOTO 5D0
.................... altimet_t=mpl3115_T();
15D9: BCF 0A.4
15DA: GOTO 722
15DB: BSF 0A.4
15DC: MOVF 7A,W
15DD: MOVWF 36
15DE: MOVF 79,W
15DF: MOVWF 35
15E0: MOVF 78,W
15E1: MOVWF 34
15E2: MOVF 77,W
15E3: MOVWF 33
.................... altimet_p=mpl3115_P();
15E4: BCF 0A.4
15E5: BSF 0A.3
15E6: GOTO 000
15E7: BSF 0A.4
15E8: BCF 0A.3
15E9: MOVF 7A,W
15EA: MOVWF 3A
15EB: MOVF 79,W
15EC: MOVWF 39
15ED: MOVF 78,W
15EE: MOVWF 38
15EF: MOVF 77,W
15F0: MOVWF 37
....................
.................... mpl3115_setA(); //nastaveni pro vysku a teplotu
15F1: BCF 0A.4
15F2: BSF 0A.3
15F3: GOTO 10A
15F4: BSF 0A.4
15F5: BCF 0A.3
.................... delay_ms (500);
15F6: MOVLW 02
15F7: MOVWF 4D
15F8: MOVLW FA
15F9: BSF 03.5
15FA: MOVWF 62
15FB: BCF 0A.4
15FC: BCF 03.5
15FD: CALL 303
15FE: BSF 0A.4
15FF: DECFSZ 4D,F
1600: GOTO 5F8
.................... altimet_a=mpl3115_A();
1601: BCF 0A.4
1602: BSF 0A.3
1603: GOTO 1D9
1604: BSF 0A.4
1605: BCF 0A.3
1606: MOVF 7A,W
1607: MOVWF 3E
1608: MOVF 79,W
1609: MOVWF 3D
160A: MOVF 78,W
160B: MOVWF 3C
160C: MOVF 77,W
160D: MOVWF 3B
....................
.................... sht25_t=SHT25_get_temp(); //mereni hodnot z SHT25
160E: BCF 0A.4
160F: BSF 0A.3
1610: GOTO 322
1611: BSF 0A.4
1612: BCF 0A.3
1613: MOVF 7A,W
1614: MOVWF 42
1615: MOVF 79,W
1616: MOVWF 41
1617: MOVF 78,W
1618: MOVWF 40
1619: MOVF 77,W
161A: MOVWF 3F
.................... sht25_h=SHT25_get_hum();
161B: BCF 0A.4
161C: BSF 0A.3
161D: GOTO 43C
161E: BSF 0A.4
161F: BCF 0A.3
1620: MOVF 7A,W
1621: MOVWF 46
1622: MOVF 79,W
1623: MOVWF 45
1624: MOVF 78,W
1625: MOVWF 44
1626: MOVF 77,W
1627: MOVWF 43
....................
.................... smer_v=azimut(); //vrati azimut aktualniho smeru vetru
1628: GOTO 000
1629: MOVF 7A,W
162A: MOVWF 4A
162B: MOVF 79,W
162C: MOVWF 49
162D: MOVF 78,W
162E: MOVWF 48
162F: MOVF 77,W
1630: MOVWF 47
....................
.................... sprintf(dataOUT, " %6.2f %7.2f %9.2f %6.2f %6.2f %5.2f %6.2f", altimet_t, altimet_a, altimet_p, sht25_t, sht25_h, smer_v, anemo);
1631: CLRF 32
1632: MOVLW A0
1633: MOVWF 31
1634: MOVLW 20
1635: BSF 03.5
1636: MOVWF 6A
1637: BCF 0A.4
1638: BSF 0A.3
1639: BCF 03.5
163A: CALL 5EA
163B: BSF 0A.4
163C: BCF 0A.3
163D: MOVLW 05
163E: MOVWF 04
163F: MOVF 36,W
1640: BSF 03.5
1641: MOVWF 60
1642: BCF 03.5
1643: MOVF 35,W
1644: BSF 03.5
1645: MOVWF 5F
1646: BCF 03.5
1647: MOVF 34,W
1648: BSF 03.5
1649: MOVWF 5E
164A: BCF 03.5
164B: MOVF 33,W
164C: BSF 03.5
164D: MOVWF 5D
164E: MOVLW 02
164F: MOVWF 61
1650: BCF 0A.4
1651: BSF 0A.3
1652: BCF 03.5
1653: CALL 641
1654: BSF 0A.4
1655: BCF 0A.3
1656: MOVLW 20
1657: BSF 03.5
1658: MOVWF 6A
1659: BCF 0A.4
165A: BSF 0A.3
165B: BCF 03.5
165C: CALL 5EA
165D: BSF 0A.4
165E: BCF 0A.3
165F: MOVLW 06
1660: MOVWF 04
1661: MOVF 3E,W
1662: BSF 03.5
1663: MOVWF 60
1664: BCF 03.5
1665: MOVF 3D,W
1666: BSF 03.5
1667: MOVWF 5F
1668: BCF 03.5
1669: MOVF 3C,W
166A: BSF 03.5
166B: MOVWF 5E
166C: BCF 03.5
166D: MOVF 3B,W
166E: BSF 03.5
166F: MOVWF 5D
1670: MOVLW 02
1671: MOVWF 61
1672: BCF 0A.4
1673: BSF 0A.3
1674: BCF 03.5
1675: CALL 641
1676: BSF 0A.4
1677: BCF 0A.3
1678: MOVLW 20
1679: BSF 03.5
167A: MOVWF 6A
167B: BCF 0A.4
167C: BSF 0A.3
167D: BCF 03.5
167E: CALL 5EA
167F: BSF 0A.4
1680: BCF 0A.3
1681: MOVLW 08
1682: MOVWF 04
1683: MOVF 3A,W
1684: BSF 03.5
1685: MOVWF 60
1686: BCF 03.5
1687: MOVF 39,W
1688: BSF 03.5
1689: MOVWF 5F
168A: BCF 03.5
168B: MOVF 38,W
168C: BSF 03.5
168D: MOVWF 5E
168E: BCF 03.5
168F: MOVF 37,W
1690: BSF 03.5
1691: MOVWF 5D
1692: MOVLW 02
1693: MOVWF 61
1694: BCF 0A.4
1695: BSF 0A.3
1696: BCF 03.5
1697: CALL 641
1698: BSF 0A.4
1699: BCF 0A.3
169A: MOVLW 20
169B: BSF 03.5
169C: MOVWF 6A
169D: BCF 0A.4
169E: BSF 0A.3
169F: BCF 03.5
16A0: CALL 5EA
16A1: BSF 0A.4
16A2: BCF 0A.3
16A3: MOVLW 05
16A4: MOVWF 04
16A5: MOVF 42,W
16A6: BSF 03.5
16A7: MOVWF 60
16A8: BCF 03.5
16A9: MOVF 41,W
16AA: BSF 03.5
16AB: MOVWF 5F
16AC: BCF 03.5
16AD: MOVF 40,W
16AE: BSF 03.5
16AF: MOVWF 5E
16B0: BCF 03.5
16B1: MOVF 3F,W
16B2: BSF 03.5
16B3: MOVWF 5D
16B4: MOVLW 02
16B5: MOVWF 61
16B6: BCF 0A.4
16B7: BSF 0A.3
16B8: BCF 03.5
16B9: CALL 641
16BA: BSF 0A.4
16BB: BCF 0A.3
16BC: MOVLW 20
16BD: BSF 03.5
16BE: MOVWF 6A
16BF: BCF 0A.4
16C0: BSF 0A.3
16C1: BCF 03.5
16C2: CALL 5EA
16C3: BSF 0A.4
16C4: BCF 0A.3
16C5: MOVLW 05
16C6: MOVWF 04
16C7: MOVF 46,W
16C8: BSF 03.5
16C9: MOVWF 60
16CA: BCF 03.5
16CB: MOVF 45,W
16CC: BSF 03.5
16CD: MOVWF 5F
16CE: BCF 03.5
16CF: MOVF 44,W
16D0: BSF 03.5
16D1: MOVWF 5E
16D2: BCF 03.5
16D3: MOVF 43,W
16D4: BSF 03.5
16D5: MOVWF 5D
16D6: MOVLW 02
16D7: MOVWF 61
16D8: BCF 0A.4
16D9: BSF 0A.3
16DA: BCF 03.5
16DB: CALL 641
16DC: BSF 0A.4
16DD: BCF 0A.3
16DE: MOVLW 20
16DF: BSF 03.5
16E0: MOVWF 6A
16E1: BCF 0A.4
16E2: BSF 0A.3
16E3: BCF 03.5
16E4: CALL 5EA
16E5: BSF 0A.4
16E6: BCF 0A.3
16E7: MOVLW 04
16E8: MOVWF 04
16E9: MOVF 4A,W
16EA: BSF 03.5
16EB: MOVWF 60
16EC: BCF 03.5
16ED: MOVF 49,W
16EE: BSF 03.5
16EF: MOVWF 5F
16F0: BCF 03.5
16F1: MOVF 48,W
16F2: BSF 03.5
16F3: MOVWF 5E
16F4: BCF 03.5
16F5: MOVF 47,W
16F6: BSF 03.5
16F7: MOVWF 5D
16F8: MOVLW 02
16F9: MOVWF 61
16FA: BCF 0A.4
16FB: BSF 0A.3
16FC: BCF 03.5
16FD: CALL 641
16FE: BSF 0A.4
16FF: BCF 0A.3
1700: MOVLW 20
1701: BSF 03.5
1702: MOVWF 6A
1703: BCF 0A.4
1704: BSF 0A.3
1705: BCF 03.5
1706: CALL 5EA
1707: BSF 0A.4
1708: BCF 0A.3
1709: MOVLW 05
170A: MOVWF 04
170B: MOVF 30,W
170C: BSF 03.5
170D: MOVWF 60
170E: BCF 03.5
170F: MOVF 2F,W
1710: BSF 03.5
1711: MOVWF 5F
1712: BCF 03.5
1713: MOVF 2E,W
1714: BSF 03.5
1715: MOVWF 5E
1716: BCF 03.5
1717: MOVF 2D,W
1718: BSF 03.5
1719: MOVWF 5D
171A: MOVLW 02
171B: MOVWF 61
171C: BCF 0A.4
171D: BSF 0A.3
171E: BCF 03.5
171F: CALL 641
1720: BSF 0A.4
1721: BCF 0A.3
....................
.................... printf(dataOUT);
1722: MOVLW A0
1723: MOVWF 04
1724: BCF 03.7
1725: BCF 0A.4
1726: BSF 0A.3
1727: GOTO 756
1728: BSF 0A.4
1729: BCF 0A.3
.................... int i=0;
172A: CLRF 4C
.................... for(i=0;i<40;i++)
172B: CLRF 4C
172C: MOVF 4C,W
172D: SUBLW 27
172E: BTFSS 03.0
172F: GOTO 73D
.................... {
.................... delay_ms(1000);
1730: MOVLW 04
1731: MOVWF 4D
1732: MOVLW FA
1733: BSF 03.5
1734: MOVWF 62
1735: BCF 0A.4
1736: BCF 03.5
1737: CALL 303
1738: BSF 0A.4
1739: DECFSZ 4D,F
173A: GOTO 732
.................... }
173B: INCF 4C,F
173C: GOTO 72C
.................... }
173D: GOTO 5CB
....................
.................... }
....................
173E: SLEEP
Configuration Fuses:
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40