CCS PCM C Compiler, Version 4.106, 47914 20-4-13 20:07
Filename: C:\Users\Honza\Documents\pic\meteo_stanice\Nová sloka\main.lst
ROM used: 6167 words (75%)
Largest free fragment is 1185
RAM used: 29 (8%) at main() level
144 (39%) worst case
Stack: 5 worst case (3 in main + 2 for interrupts)
*
0000: MOVLW 18
0001: MOVWF 0A
0002: GOTO 000
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)
*
02F5: MOVLW 65
02F6: MOVWF 04
02F7: BCF 03.7
02F8: MOVF 00,W
02F9: BTFSC 03.2
02FA: GOTO 308
02FB: MOVLW 02
02FC: MOVWF 78
02FD: CLRF 77
02FE: DECFSZ 77,F
02FF: GOTO 2FE
0300: DECFSZ 78,F
0301: GOTO 2FD
0302: MOVLW 97
0303: MOVWF 77
0304: DECFSZ 77,F
0305: GOTO 304
0306: DECFSZ 00,F
0307: GOTO 2FB
0308: RETURN
....................
.................... //set I2C
.................... #define PIN_SDA PIN_C4
.................... #define PIN_SCL PIN_C3
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL)
*
022E: MOVLW 08
022F: MOVWF 78
0230: NOP
0231: BCF 07.3
0232: BCF 28.3
0233: MOVF 28,W
0234: BSF 03.5
0235: MOVWF 07
0236: NOP
0237: RLF 73,F
0238: BCF 03.5
0239: BCF 07.4
023A: BTFSS 03.0
023B: GOTO 242
023C: BSF 28.4
023D: MOVF 28,W
023E: BSF 03.5
023F: MOVWF 07
0240: GOTO 246
0241: BCF 03.5
0242: BCF 28.4
0243: MOVF 28,W
0244: BSF 03.5
0245: MOVWF 07
0246: NOP
0247: BCF 03.5
0248: BSF 28.3
0249: MOVF 28,W
024A: BSF 03.5
024B: MOVWF 07
024C: BCF 03.5
024D: BTFSS 07.3
024E: GOTO 24D
024F: DECFSZ 78,F
0250: GOTO 230
0251: NOP
0252: BCF 07.3
0253: BCF 28.3
0254: MOVF 28,W
0255: BSF 03.5
0256: MOVWF 07
0257: NOP
0258: BCF 03.5
0259: BSF 28.4
025A: MOVF 28,W
025B: BSF 03.5
025C: MOVWF 07
025D: NOP
025E: NOP
025F: BCF 03.5
0260: BSF 28.3
0261: MOVF 28,W
0262: BSF 03.5
0263: MOVWF 07
0264: BCF 03.5
0265: BTFSS 07.3
0266: GOTO 265
0267: CLRF 78
0268: NOP
0269: BTFSC 07.4
026A: BSF 78.0
026B: BCF 07.3
026C: BCF 28.3
026D: MOVF 28,W
026E: BSF 03.5
026F: MOVWF 07
0270: BCF 03.5
0271: BCF 07.4
0272: BCF 28.4
0273: MOVF 28,W
0274: BSF 03.5
0275: MOVWF 07
0276: BCF 03.5
0277: RETURN
*
02B0: MOVLW 08
02B1: MOVWF 74
02B2: MOVF 77,W
02B3: MOVWF 75
02B4: BSF 28.4
02B5: MOVF 28,W
02B6: BSF 03.5
02B7: MOVWF 07
02B8: NOP
02B9: BCF 03.5
02BA: BSF 28.3
02BB: MOVF 28,W
02BC: BSF 03.5
02BD: MOVWF 07
02BE: BCF 03.5
02BF: BTFSS 07.3
02C0: GOTO 2BF
02C1: BTFSC 07.4
02C2: BSF 03.0
02C3: BTFSS 07.4
02C4: BCF 03.0
02C5: RLF 78,F
02C6: NOP
02C7: BCF 28.3
02C8: MOVF 28,W
02C9: BSF 03.5
02CA: MOVWF 07
02CB: BCF 03.5
02CC: BCF 07.3
02CD: DECFSZ 74,F
02CE: GOTO 2B4
02CF: BSF 28.4
02D0: MOVF 28,W
02D1: BSF 03.5
02D2: MOVWF 07
02D3: NOP
02D4: BCF 03.5
02D5: BCF 07.4
02D6: MOVF 75,W
02D7: BTFSC 03.2
02D8: GOTO 2DE
02D9: BCF 28.4
02DA: MOVF 28,W
02DB: BSF 03.5
02DC: MOVWF 07
02DD: BCF 03.5
02DE: NOP
02DF: BSF 28.3
02E0: MOVF 28,W
02E1: BSF 03.5
02E2: MOVWF 07
02E3: BCF 03.5
02E4: BTFSS 07.3
02E5: GOTO 2E4
02E6: NOP
02E7: BCF 07.3
02E8: BCF 28.3
02E9: MOVF 28,W
02EA: BSF 03.5
02EB: MOVWF 07
02EC: NOP
02ED: BCF 03.5
02EE: BCF 07.4
02EF: BCF 28.4
02F0: MOVF 28,W
02F1: BSF 03.5
02F2: MOVWF 07
02F3: BCF 03.5
02F4: RETURN
.................... //set RS232
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
*
03D1: BCF 28.7
03D2: MOVF 28,W
03D3: BSF 03.5
03D4: MOVWF 07
03D5: BCF 03.5
03D6: BCF 07.7
03D7: MOVLW 08
03D8: MOVWF 78
03D9: GOTO 3DA
03DA: NOP
03DB: BSF 78.7
03DC: GOTO 3EB
03DD: BCF 78.7
03DE: RRF 64,F
03DF: BTFSC 03.0
03E0: BSF 07.7
03E1: BTFSS 03.0
03E2: BCF 07.7
03E3: BSF 78.6
03E4: GOTO 3EB
03E5: BCF 78.6
03E6: DECFSZ 78,F
03E7: GOTO 3DE
03E8: GOTO 3E9
03E9: NOP
03EA: BSF 07.7
03EB: MOVLW 3F
03EC: MOVWF 04
03ED: DECFSZ 04,F
03EE: GOTO 3ED
03EF: NOP
03F0: BTFSC 78.7
03F1: GOTO 3DD
03F2: BTFSC 78.6
03F3: GOTO 3E5
03F4: RETURN
....................
.................... #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;
*
10B8: BCF 76.0
.................... flag = 0;
10B9: BCF 76.1
.................... y = x;
10BA: MOVF 71,W
10BB: MOVWF 75
10BC: MOVF 70,W
10BD: MOVWF 74
10BE: MOVF 6F,W
10BF: MOVWF 73
10C0: MOVF 6E,W
10C1: MOVWF 72
....................
.................... if (x < 0)
10C2: MOVF 71,W
10C3: BSF 03.5
10C4: MOVWF 28
10C5: MOVF 70,W
10C6: MOVWF 27
10C7: BCF 03.5
10C8: MOVF 6F,W
10C9: BSF 03.5
10CA: MOVWF 26
10CB: BCF 03.5
10CC: MOVF 6E,W
10CD: BSF 03.5
10CE: MOVWF 25
10CF: CLRF 2C
10D0: CLRF 2B
10D1: CLRF 2A
10D2: CLRF 29
10D3: BCF 0A.4
10D4: BSF 0A.3
10D5: BCF 03.5
10D6: CALL 5F1
10D7: BSF 0A.4
10D8: BCF 0A.3
10D9: BTFSS 03.0
10DA: GOTO 0DF
.................... {
.................... s = 1;
10DB: BSF 76.0
.................... y = -y;
10DC: MOVF 73,W
10DD: XORLW 80
10DE: MOVWF 73
.................... }
....................
.................... if (y > 1.0)
10DF: BSF 03.5
10E0: CLRF 28
10E1: CLRF 27
10E2: CLRF 26
10E3: MOVLW 7F
10E4: MOVWF 25
10E5: MOVF 75,W
10E6: MOVWF 2C
10E7: MOVF 74,W
10E8: MOVWF 2B
10E9: MOVF 73,W
10EA: MOVWF 2A
10EB: MOVF 72,W
10EC: MOVWF 29
10ED: BCF 0A.4
10EE: BSF 0A.3
10EF: BCF 03.5
10F0: CALL 5F1
10F1: BSF 0A.4
10F2: BCF 0A.3
10F3: BTFSS 03.0
10F4: GOTO 116
10F5: CLRF 27
10F6: BTFSC 0B.7
10F7: BSF 27.7
10F8: BCF 0B.7
.................... {
.................... y = 1.0/y;
10F9: BSF 03.5
10FA: CLRF 45
10FB: CLRF 44
10FC: CLRF 43
10FD: MOVLW 7F
10FE: MOVWF 42
10FF: MOVF 75,W
1100: MOVWF 49
1101: MOVF 74,W
1102: MOVWF 48
1103: MOVF 73,W
1104: MOVWF 47
1105: MOVF 72,W
1106: MOVWF 46
1107: BCF 0A.4
1108: BCF 03.5
1109: CALL 057
110A: BSF 0A.4
110B: BTFSC 27.7
110C: BSF 0B.7
110D: MOVF 7A,W
110E: MOVWF 75
110F: MOVF 79,W
1110: MOVWF 74
1111: MOVF 78,W
1112: MOVWF 73
1113: MOVF 77,W
1114: MOVWF 72
.................... flag = 1;
1115: BSF 76.1
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
1116: MOVLW 0A
1117: BSF 03.5
1118: MOVWF 2C
1119: MOVLW 89
111A: MOVWF 2B
111B: MOVLW 34
111C: MOVWF 2A
111D: MOVLW 7C
111E: MOVWF 29
111F: MOVF 75,W
1120: MOVWF 30
1121: MOVF 74,W
1122: MOVWF 2F
1123: MOVF 73,W
1124: MOVWF 2E
1125: MOVF 72,W
1126: MOVWF 2D
1127: BCF 0A.4
1128: BCF 03.5
1129: CALL 76E
112A: BSF 0A.4
112B: MOVF 77,W
112C: BSF 03.5
112D: MOVWF 24
112E: MOVF 78,W
112F: MOVWF 25
1130: MOVF 79,W
1131: MOVWF 26
1132: MOVF 7A,W
1133: MOVWF 27
1134: MOVWF 2C
1135: MOVF 26,W
1136: MOVWF 2B
1137: MOVF 25,W
1138: MOVWF 2A
1139: MOVF 24,W
113A: MOVWF 29
113B: MOVF 75,W
113C: MOVWF 30
113D: MOVF 74,W
113E: MOVWF 2F
113F: MOVF 73,W
1140: MOVWF 2E
1141: MOVF 72,W
1142: MOVWF 2D
1143: BCF 0A.4
1144: BCF 03.5
1145: CALL 76E
1146: BSF 0A.4
1147: MOVF 77,W
1148: BSF 03.5
1149: MOVWF 24
114A: MOVF 78,W
114B: MOVWF 25
114C: MOVF 79,W
114D: MOVWF 26
114E: MOVF 7A,W
114F: MOVWF 27
1150: BCF 03.1
1151: MOVF 27,W
1152: MOVWF 2C
1153: MOVF 26,W
1154: MOVWF 2B
1155: MOVF 25,W
1156: MOVWF 2A
1157: MOVF 24,W
1158: MOVWF 29
1159: MOVLW 7C
115A: MOVWF 30
115B: MOVLW 79
115C: MOVWF 2F
115D: MOVLW 35
115E: MOVWF 2E
115F: MOVLW 81
1160: MOVWF 2D
1161: BCF 0A.4
1162: BSF 0A.3
1163: BCF 03.5
1164: CALL 000
1165: BSF 0A.4
1166: BCF 0A.3
1167: MOVF 7A,W
1168: MOVWF 7E
1169: MOVF 79,W
116A: MOVWF 7D
116B: MOVF 78,W
116C: MOVWF 7C
116D: MOVF 77,W
116E: MOVWF 7B
.................... res = res*y*y + pat[2];
116F: MOVF 7E,W
1170: BSF 03.5
1171: MOVWF 2C
1172: MOVF 7D,W
1173: MOVWF 2B
1174: MOVF 7C,W
1175: MOVWF 2A
1176: MOVF 7B,W
1177: MOVWF 29
1178: MOVF 75,W
1179: MOVWF 30
117A: MOVF 74,W
117B: MOVWF 2F
117C: MOVF 73,W
117D: MOVWF 2E
117E: MOVF 72,W
117F: MOVWF 2D
1180: BCF 0A.4
1181: BCF 03.5
1182: CALL 76E
1183: BSF 0A.4
1184: MOVF 77,W
1185: BSF 03.5
1186: MOVWF 24
1187: MOVF 78,W
1188: MOVWF 25
1189: MOVF 79,W
118A: MOVWF 26
118B: MOVF 7A,W
118C: MOVWF 27
118D: MOVWF 2C
118E: MOVF 26,W
118F: MOVWF 2B
1190: MOVF 25,W
1191: MOVWF 2A
1192: MOVF 24,W
1193: MOVWF 29
1194: MOVF 75,W
1195: MOVWF 30
1196: MOVF 74,W
1197: MOVWF 2F
1198: MOVF 73,W
1199: MOVWF 2E
119A: MOVF 72,W
119B: MOVWF 2D
119C: BCF 0A.4
119D: BCF 03.5
119E: CALL 76E
119F: BSF 0A.4
11A0: MOVF 77,W
11A1: BSF 03.5
11A2: MOVWF 24
11A3: MOVF 78,W
11A4: MOVWF 25
11A5: MOVF 79,W
11A6: MOVWF 26
11A7: MOVF 7A,W
11A8: MOVWF 27
11A9: BCF 03.1
11AA: MOVF 27,W
11AB: MOVWF 2C
11AC: MOVF 26,W
11AD: MOVWF 2B
11AE: MOVF 25,W
11AF: MOVWF 2A
11B0: MOVF 24,W
11B1: MOVWF 29
11B2: MOVLW 3F
11B3: MOVWF 30
11B4: MOVLW 02
11B5: MOVWF 2F
11B6: MOVLW 33
11B7: MOVWF 2E
11B8: MOVLW 83
11B9: MOVWF 2D
11BA: BCF 0A.4
11BB: BSF 0A.3
11BC: BCF 03.5
11BD: CALL 000
11BE: BSF 0A.4
11BF: BCF 0A.3
11C0: MOVF 7A,W
11C1: MOVWF 7E
11C2: MOVF 79,W
11C3: MOVWF 7D
11C4: MOVF 78,W
11C5: MOVWF 7C
11C6: MOVF 77,W
11C7: MOVWF 7B
.................... res = res*y*y + pat[3];
11C8: MOVF 7E,W
11C9: BSF 03.5
11CA: MOVWF 2C
11CB: MOVF 7D,W
11CC: MOVWF 2B
11CD: MOVF 7C,W
11CE: MOVWF 2A
11CF: MOVF 7B,W
11D0: MOVWF 29
11D1: MOVF 75,W
11D2: MOVWF 30
11D3: MOVF 74,W
11D4: MOVWF 2F
11D5: MOVF 73,W
11D6: MOVWF 2E
11D7: MOVF 72,W
11D8: MOVWF 2D
11D9: BCF 0A.4
11DA: BCF 03.5
11DB: CALL 76E
11DC: BSF 0A.4
11DD: MOVF 77,W
11DE: BSF 03.5
11DF: MOVWF 24
11E0: MOVF 78,W
11E1: MOVWF 25
11E2: MOVF 79,W
11E3: MOVWF 26
11E4: MOVF 7A,W
11E5: MOVWF 27
11E6: MOVWF 2C
11E7: MOVF 26,W
11E8: MOVWF 2B
11E9: MOVF 25,W
11EA: MOVWF 2A
11EB: MOVF 24,W
11EC: MOVWF 29
11ED: MOVF 75,W
11EE: MOVWF 30
11EF: MOVF 74,W
11F0: MOVWF 2F
11F1: MOVF 73,W
11F2: MOVWF 2E
11F3: MOVF 72,W
11F4: MOVWF 2D
11F5: BCF 0A.4
11F6: BCF 03.5
11F7: CALL 76E
11F8: BSF 0A.4
11F9: MOVF 77,W
11FA: BSF 03.5
11FB: MOVWF 24
11FC: MOVF 78,W
11FD: MOVWF 25
11FE: MOVF 79,W
11FF: MOVWF 26
1200: MOVF 7A,W
1201: MOVWF 27
1202: BCF 03.1
1203: MOVF 27,W
1204: MOVWF 2C
1205: MOVF 26,W
1206: MOVWF 2B
1207: MOVF 25,W
1208: MOVWF 2A
1209: MOVF 24,W
120A: MOVWF 29
120B: MOVLW 33
120C: MOVWF 30
120D: MOVLW 8C
120E: MOVWF 2F
120F: MOVLW 1E
1210: MOVWF 2E
1211: MOVLW 83
1212: MOVWF 2D
1213: BCF 0A.4
1214: BSF 0A.3
1215: BCF 03.5
1216: CALL 000
1217: BSF 0A.4
1218: BCF 0A.3
1219: MOVF 7A,W
121A: MOVWF 7E
121B: MOVF 79,W
121C: MOVWF 7D
121D: MOVF 78,W
121E: MOVWF 7C
121F: MOVF 77,W
1220: MOVWF 7B
....................
.................... r = qat[0]*y*y + qat[1];
1221: BSF 03.5
1222: CLRF 2C
1223: CLRF 2B
1224: CLRF 2A
1225: MOVLW 7F
1226: MOVWF 29
1227: MOVF 75,W
1228: MOVWF 30
1229: MOVF 74,W
122A: MOVWF 2F
122B: MOVF 73,W
122C: MOVWF 2E
122D: MOVF 72,W
122E: MOVWF 2D
122F: BCF 0A.4
1230: BCF 03.5
1231: CALL 76E
1232: BSF 0A.4
1233: MOVF 77,W
1234: BSF 03.5
1235: MOVWF 24
1236: MOVF 78,W
1237: MOVWF 25
1238: MOVF 79,W
1239: MOVWF 26
123A: MOVF 7A,W
123B: MOVWF 27
123C: MOVWF 2C
123D: MOVF 26,W
123E: MOVWF 2B
123F: MOVF 25,W
1240: MOVWF 2A
1241: MOVF 24,W
1242: MOVWF 29
1243: MOVF 75,W
1244: MOVWF 30
1245: MOVF 74,W
1246: MOVWF 2F
1247: MOVF 73,W
1248: MOVWF 2E
1249: MOVF 72,W
124A: MOVWF 2D
124B: BCF 0A.4
124C: BCF 03.5
124D: CALL 76E
124E: BSF 0A.4
124F: MOVF 77,W
1250: BSF 03.5
1251: MOVWF 24
1252: MOVF 78,W
1253: MOVWF 25
1254: MOVF 79,W
1255: MOVWF 26
1256: MOVF 7A,W
1257: MOVWF 27
1258: BCF 03.1
1259: MOVF 27,W
125A: MOVWF 2C
125B: MOVF 26,W
125C: MOVWF 2B
125D: MOVF 25,W
125E: MOVWF 2A
125F: MOVF 24,W
1260: MOVWF 29
1261: MOVLW 1B
1262: MOVWF 30
1263: MOVLW E4
1264: MOVWF 2F
1265: MOVLW 35
1266: MOVWF 2E
1267: MOVLW 82
1268: MOVWF 2D
1269: BCF 0A.4
126A: BSF 0A.3
126B: BCF 03.5
126C: CALL 000
126D: BSF 0A.4
126E: BCF 0A.3
126F: MOVF 7A,W
1270: BSF 03.5
1271: MOVWF 23
1272: MOVF 79,W
1273: MOVWF 22
1274: MOVF 78,W
1275: MOVWF 21
1276: MOVF 77,W
1277: MOVWF 20
.................... r = r*y*y + qat[2];
1278: MOVF 23,W
1279: MOVWF 2C
127A: MOVF 22,W
127B: MOVWF 2B
127C: MOVF 21,W
127D: MOVWF 2A
127E: MOVF 20,W
127F: MOVWF 29
1280: MOVF 75,W
1281: MOVWF 30
1282: MOVF 74,W
1283: MOVWF 2F
1284: MOVF 73,W
1285: MOVWF 2E
1286: MOVF 72,W
1287: MOVWF 2D
1288: BCF 0A.4
1289: BCF 03.5
128A: CALL 76E
128B: BSF 0A.4
128C: MOVF 77,W
128D: BSF 03.5
128E: MOVWF 24
128F: MOVF 78,W
1290: MOVWF 25
1291: MOVF 79,W
1292: MOVWF 26
1293: MOVF 7A,W
1294: MOVWF 27
1295: MOVWF 2C
1296: MOVF 26,W
1297: MOVWF 2B
1298: MOVF 25,W
1299: MOVWF 2A
129A: MOVF 24,W
129B: MOVWF 29
129C: MOVF 75,W
129D: MOVWF 30
129E: MOVF 74,W
129F: MOVWF 2F
12A0: MOVF 73,W
12A1: MOVWF 2E
12A2: MOVF 72,W
12A3: MOVWF 2D
12A4: BCF 0A.4
12A5: BCF 03.5
12A6: CALL 76E
12A7: BSF 0A.4
12A8: MOVF 77,W
12A9: BSF 03.5
12AA: MOVWF 24
12AB: MOVF 78,W
12AC: MOVWF 25
12AD: MOVF 79,W
12AE: MOVWF 26
12AF: MOVF 7A,W
12B0: MOVWF 27
12B1: BCF 03.1
12B2: MOVF 27,W
12B3: MOVWF 2C
12B4: MOVF 26,W
12B5: MOVWF 2B
12B6: MOVF 25,W
12B7: MOVWF 2A
12B8: MOVF 24,W
12B9: MOVWF 29
12BA: MOVLW A4
12BB: MOVWF 30
12BC: MOVLW DB
12BD: MOVWF 2F
12BE: MOVLW 67
12BF: MOVWF 2E
12C0: MOVLW 83
12C1: MOVWF 2D
12C2: BCF 0A.4
12C3: BSF 0A.3
12C4: BCF 03.5
12C5: CALL 000
12C6: BSF 0A.4
12C7: BCF 0A.3
12C8: MOVF 7A,W
12C9: BSF 03.5
12CA: MOVWF 23
12CB: MOVF 79,W
12CC: MOVWF 22
12CD: MOVF 78,W
12CE: MOVWF 21
12CF: MOVF 77,W
12D0: MOVWF 20
.................... r = r*y*y + qat[3];
12D1: MOVF 23,W
12D2: MOVWF 2C
12D3: MOVF 22,W
12D4: MOVWF 2B
12D5: MOVF 21,W
12D6: MOVWF 2A
12D7: MOVF 20,W
12D8: MOVWF 29
12D9: MOVF 75,W
12DA: MOVWF 30
12DB: MOVF 74,W
12DC: MOVWF 2F
12DD: MOVF 73,W
12DE: MOVWF 2E
12DF: MOVF 72,W
12E0: MOVWF 2D
12E1: BCF 0A.4
12E2: BCF 03.5
12E3: CALL 76E
12E4: BSF 0A.4
12E5: MOVF 77,W
12E6: BSF 03.5
12E7: MOVWF 24
12E8: MOVF 78,W
12E9: MOVWF 25
12EA: MOVF 79,W
12EB: MOVWF 26
12EC: MOVF 7A,W
12ED: MOVWF 27
12EE: MOVWF 2C
12EF: MOVF 26,W
12F0: MOVWF 2B
12F1: MOVF 25,W
12F2: MOVWF 2A
12F3: MOVF 24,W
12F4: MOVWF 29
12F5: MOVF 75,W
12F6: MOVWF 30
12F7: MOVF 74,W
12F8: MOVWF 2F
12F9: MOVF 73,W
12FA: MOVWF 2E
12FB: MOVF 72,W
12FC: MOVWF 2D
12FD: BCF 0A.4
12FE: BCF 03.5
12FF: CALL 76E
1300: BSF 0A.4
1301: MOVF 77,W
1302: BSF 03.5
1303: MOVWF 24
1304: MOVF 78,W
1305: MOVWF 25
1306: MOVF 79,W
1307: MOVWF 26
1308: MOVF 7A,W
1309: MOVWF 27
130A: BCF 03.1
130B: MOVF 27,W
130C: MOVWF 2C
130D: MOVF 26,W
130E: MOVWF 2B
130F: MOVF 25,W
1310: MOVWF 2A
1311: MOVF 24,W
1312: MOVWF 29
1313: MOVLW 33
1314: MOVWF 30
1315: MOVLW 8C
1316: MOVWF 2F
1317: MOVLW 1E
1318: MOVWF 2E
1319: MOVLW 83
131A: MOVWF 2D
131B: BCF 0A.4
131C: BSF 0A.3
131D: BCF 03.5
131E: CALL 000
131F: BSF 0A.4
1320: BCF 0A.3
1321: MOVF 7A,W
1322: BSF 03.5
1323: MOVWF 23
1324: MOVF 79,W
1325: MOVWF 22
1326: MOVF 78,W
1327: MOVWF 21
1328: MOVF 77,W
1329: MOVWF 20
....................
.................... res = y*res/r;
132A: MOVF 75,W
132B: MOVWF 2C
132C: MOVF 74,W
132D: MOVWF 2B
132E: MOVF 73,W
132F: MOVWF 2A
1330: MOVF 72,W
1331: MOVWF 29
1332: MOVF 7E,W
1333: MOVWF 30
1334: MOVF 7D,W
1335: MOVWF 2F
1336: MOVF 7C,W
1337: MOVWF 2E
1338: MOVF 7B,W
1339: MOVWF 2D
133A: BCF 0A.4
133B: BCF 03.5
133C: CALL 76E
133D: BSF 0A.4
133E: MOVF 77,W
133F: BSF 03.5
1340: MOVWF 24
1341: MOVF 78,W
1342: MOVWF 25
1343: MOVF 79,W
1344: MOVWF 26
1345: MOVF 7A,W
1346: MOVWF 27
1347: BCF 03.5
1348: CLRF 27
1349: BTFSC 0B.7
134A: BSF 27.7
134B: BCF 0B.7
134C: BSF 03.5
134D: MOVF 27,W
134E: MOVWF 45
134F: MOVF 26,W
1350: MOVWF 44
1351: MOVF 25,W
1352: MOVWF 43
1353: MOVF 24,W
1354: MOVWF 42
1355: MOVF 23,W
1356: MOVWF 49
1357: MOVF 22,W
1358: MOVWF 48
1359: MOVF 21,W
135A: MOVWF 47
135B: MOVF 20,W
135C: MOVWF 46
135D: BCF 0A.4
135E: BCF 03.5
135F: CALL 057
1360: BSF 0A.4
1361: BTFSC 27.7
1362: BSF 0B.7
1363: MOVF 7A,W
1364: MOVWF 7E
1365: MOVF 79,W
1366: MOVWF 7D
1367: MOVF 78,W
1368: MOVWF 7C
1369: MOVF 77,W
136A: MOVWF 7B
....................
....................
.................... if (flag) // for |x| > 1
136B: BTFSS 76.1
136C: GOTO 38D
.................... res = PI_DIV_BY_TWO - res;
136D: BSF 03.1
136E: MOVLW DB
136F: BSF 03.5
1370: MOVWF 2C
1371: MOVLW 0F
1372: MOVWF 2B
1373: MOVLW 49
1374: MOVWF 2A
1375: MOVLW 7F
1376: MOVWF 29
1377: MOVF 7E,W
1378: MOVWF 30
1379: MOVF 7D,W
137A: MOVWF 2F
137B: MOVF 7C,W
137C: MOVWF 2E
137D: MOVF 7B,W
137E: MOVWF 2D
137F: BCF 0A.4
1380: BSF 0A.3
1381: BCF 03.5
1382: CALL 000
1383: BSF 0A.4
1384: BCF 0A.3
1385: MOVF 7A,W
1386: MOVWF 7E
1387: MOVF 79,W
1388: MOVWF 7D
1389: MOVF 78,W
138A: MOVWF 7C
138B: MOVF 77,W
138C: MOVWF 7B
.................... if (s)
138D: BTFSS 76.0
138E: GOTO 392
.................... res = -res;
138F: MOVF 7C,W
1390: XORLW 80
1391: MOVWF 7C
....................
.................... return(res);
1392: MOVF 7B,W
1393: MOVWF 77
1394: MOVF 7C,W
1395: MOVWF 78
1396: MOVF 7D,W
1397: MOVWF 79
1398: MOVF 7E,W
1399: 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;
*
1825: CLRF 29
1826: 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
*
0278: BSF 28.4
0279: MOVF 28,W
027A: BSF 03.5
027B: MOVWF 07
027C: NOP
027D: BCF 03.5
027E: BSF 28.3
027F: MOVF 28,W
0280: BSF 03.5
0281: MOVWF 07
0282: NOP
0283: BCF 03.5
0284: BCF 07.4
0285: BCF 28.4
0286: MOVF 28,W
0287: BSF 03.5
0288: MOVWF 07
0289: NOP
028A: BCF 03.5
028B: BCF 07.3
028C: BCF 28.3
028D: MOVF 28,W
028E: BSF 03.5
028F: MOVWF 07
.................... i2c_write(0x80); // Device address
0290: MOVLW 80
0291: MOVWF 73
0292: BCF 03.5
0293: CALL 22E
.................... i2c_write(0xFE); // Device command
0294: MOVLW FE
0295: MOVWF 73
0296: CALL 22E
.................... i2c_stop(); // Stop condition
0297: BCF 28.4
0298: MOVF 28,W
0299: BSF 03.5
029A: MOVWF 07
029B: NOP
029C: BCF 03.5
029D: BSF 28.3
029E: MOVF 28,W
029F: BSF 03.5
02A0: MOVWF 07
02A1: BCF 03.5
02A2: BTFSS 07.3
02A3: GOTO 2A2
02A4: NOP
02A5: GOTO 2A6
02A6: NOP
02A7: BSF 28.4
02A8: MOVF 28,W
02A9: BSF 03.5
02AA: MOVWF 07
02AB: NOP
.................... }
02AC: BCF 03.5
02AD: BSF 0A.3
02AE: BSF 0A.4
02AF: GOTO 092 (RETURN)
....................
.................... unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value
.................... {
.................... unsigned int8 reg;
....................
.................... i2c_start(); // Start condition
*
0309: BSF 28.4
030A: MOVF 28,W
030B: BSF 03.5
030C: MOVWF 07
030D: NOP
030E: BCF 03.5
030F: BSF 28.3
0310: MOVF 28,W
0311: BSF 03.5
0312: MOVWF 07
0313: NOP
0314: BCF 03.5
0315: BCF 07.4
0316: BCF 28.4
0317: MOVF 28,W
0318: BSF 03.5
0319: MOVWF 07
031A: NOP
031B: BCF 03.5
031C: BCF 07.3
031D: BCF 28.3
031E: MOVF 28,W
031F: BSF 03.5
0320: MOVWF 07
.................... i2c_write(SHT25_ADDR); // Device address
0321: MOVLW 80
0322: MOVWF 73
0323: BCF 03.5
0324: CALL 22E
.................... i2c_write(0xE7); // Device command
0325: MOVLW E7
0326: MOVWF 73
0327: CALL 22E
....................
.................... i2c_start(); // Start condition
0328: BSF 28.4
0329: MOVF 28,W
032A: BSF 03.5
032B: MOVWF 07
032C: NOP
032D: BCF 03.5
032E: BSF 28.3
032F: MOVF 28,W
0330: BSF 03.5
0331: MOVWF 07
0332: NOP
0333: BCF 03.5
0334: BTFSS 07.3
0335: GOTO 334
0336: BCF 07.4
0337: BCF 28.4
0338: MOVF 28,W
0339: BSF 03.5
033A: MOVWF 07
033B: NOP
033C: BCF 03.5
033D: BCF 07.3
033E: BCF 28.3
033F: MOVF 28,W
0340: BSF 03.5
0341: MOVWF 07
.................... i2c_write(SHT25_ADDR+1); // Device address
0342: MOVLW 81
0343: MOVWF 73
0344: BCF 03.5
0345: CALL 22E
.................... reg=i2c_read(0); // Read status actual status register
0346: CLRF 77
0347: CALL 2B0
0348: MOVF 78,W
0349: MOVWF 61
....................
.................... reg = (reg & 0x3A) | setup_reg;
034A: MOVF 61,W
034B: ANDLW 3A
034C: IORWF 60,W
034D: MOVWF 61
....................
.................... i2c_start(); // Start condition
034E: BSF 28.4
034F: MOVF 28,W
0350: BSF 03.5
0351: MOVWF 07
0352: NOP
0353: BCF 03.5
0354: BSF 28.3
0355: MOVF 28,W
0356: BSF 03.5
0357: MOVWF 07
0358: NOP
0359: BCF 03.5
035A: BTFSS 07.3
035B: GOTO 35A
035C: BCF 07.4
035D: BCF 28.4
035E: MOVF 28,W
035F: BSF 03.5
0360: MOVWF 07
0361: NOP
0362: BCF 03.5
0363: BCF 07.3
0364: BCF 28.3
0365: MOVF 28,W
0366: BSF 03.5
0367: MOVWF 07
.................... i2c_write(SHT25_ADDR); // Device address
0368: MOVLW 80
0369: MOVWF 73
036A: BCF 03.5
036B: CALL 22E
.................... i2c_write(0xE6); // Write to status register
036C: MOVLW E6
036D: MOVWF 73
036E: CALL 22E
.................... i2c_write(reg); // Device command
036F: MOVF 61,W
0370: MOVWF 73
0371: CALL 22E
.................... i2c_stop(); // Stop condition
0372: BCF 28.4
0373: MOVF 28,W
0374: BSF 03.5
0375: MOVWF 07
0376: NOP
0377: BCF 03.5
0378: BSF 28.3
0379: MOVF 28,W
037A: BSF 03.5
037B: MOVWF 07
037C: BCF 03.5
037D: BTFSS 07.3
037E: GOTO 37D
037F: NOP
0380: GOTO 381
0381: NOP
0382: BSF 28.4
0383: MOVF 28,W
0384: BSF 03.5
0385: MOVWF 07
0386: NOP
....................
.................... delay_ms(10);
0387: MOVLW 0A
0388: BCF 03.5
0389: MOVWF 65
038A: CALL 2F5
....................
.................... i2c_start(); // Start condition
038B: BSF 28.4
038C: MOVF 28,W
038D: BSF 03.5
038E: MOVWF 07
038F: NOP
0390: BCF 03.5
0391: BSF 28.3
0392: MOVF 28,W
0393: BSF 03.5
0394: MOVWF 07
0395: NOP
0396: BCF 03.5
0397: BCF 07.4
0398: BCF 28.4
0399: MOVF 28,W
039A: BSF 03.5
039B: MOVWF 07
039C: NOP
039D: BCF 03.5
039E: BCF 07.3
039F: BCF 28.3
03A0: MOVF 28,W
03A1: BSF 03.5
03A2: MOVWF 07
.................... i2c_write(SHT25_ADDR); // Device address
03A3: MOVLW 80
03A4: MOVWF 73
03A5: BCF 03.5
03A6: CALL 22E
.................... i2c_write(0xE7); // Device command
03A7: MOVLW E7
03A8: MOVWF 73
03A9: CALL 22E
....................
.................... i2c_start(); // Start condition
03AA: BSF 28.4
03AB: MOVF 28,W
03AC: BSF 03.5
03AD: MOVWF 07
03AE: NOP
03AF: BCF 03.5
03B0: BSF 28.3
03B1: MOVF 28,W
03B2: BSF 03.5
03B3: MOVWF 07
03B4: NOP
03B5: BCF 03.5
03B6: BTFSS 07.3
03B7: GOTO 3B6
03B8: BCF 07.4
03B9: BCF 28.4
03BA: MOVF 28,W
03BB: BSF 03.5
03BC: MOVWF 07
03BD: NOP
03BE: BCF 03.5
03BF: BCF 07.3
03C0: BCF 28.3
03C1: MOVF 28,W
03C2: BSF 03.5
03C3: MOVWF 07
.................... i2c_write(SHT25_ADDR+1); // Device address
03C4: MOVLW 81
03C5: MOVWF 73
03C6: BCF 03.5
03C7: CALL 22E
.................... reg=i2c_read(0); // Read status actual status register
03C8: CLRF 77
03C9: CALL 2B0
03CA: MOVF 78,W
03CB: MOVWF 61
....................
.................... return (reg);
03CC: MOVF 61,W
03CD: MOVWF 78
.................... }
03CE: BSF 0A.3
03CF: BSF 0A.4
03D0: GOTO 09A (RETURN)
....................
....................
.................... float SHT25_get_temp()
.................... {
.................... unsigned int8 MSB, LSB, Check;
.................... unsigned int16 data;
....................
.................... i2c_start();
*
0B85: BSF 28.4
0B86: MOVF 28,W
0B87: BSF 03.5
0B88: MOVWF 07
0B89: NOP
0B8A: BCF 03.5
0B8B: BSF 28.3
0B8C: MOVF 28,W
0B8D: BSF 03.5
0B8E: MOVWF 07
0B8F: NOP
0B90: BCF 03.5
0B91: BTFSS 07.3
0B92: GOTO 391
0B93: BCF 07.4
0B94: BCF 28.4
0B95: MOVF 28,W
0B96: BSF 03.5
0B97: MOVWF 07
0B98: NOP
0B99: BCF 03.5
0B9A: BCF 07.3
0B9B: BCF 28.3
0B9C: MOVF 28,W
0B9D: BSF 03.5
0B9E: MOVWF 07
.................... I2C_Write(SHT25_ADDR);
0B9F: MOVLW 80
0BA0: MOVWF 73
0BA1: BCF 0A.3
0BA2: BCF 03.5
0BA3: CALL 22E
0BA4: BSF 0A.3
.................... I2C_write(0xE3);
0BA5: MOVLW E3
0BA6: MOVWF 73
0BA7: BCF 0A.3
0BA8: CALL 22E
0BA9: BSF 0A.3
.................... i2c_stop();
0BAA: BCF 28.4
0BAB: MOVF 28,W
0BAC: BSF 03.5
0BAD: MOVWF 07
0BAE: NOP
0BAF: BCF 03.5
0BB0: BSF 28.3
0BB1: MOVF 28,W
0BB2: BSF 03.5
0BB3: MOVWF 07
0BB4: BCF 03.5
0BB5: BTFSS 07.3
0BB6: GOTO 3B5
0BB7: NOP
0BB8: GOTO 3B9
0BB9: NOP
0BBA: BSF 28.4
0BBB: MOVF 28,W
0BBC: BSF 03.5
0BBD: MOVWF 07
0BBE: NOP
....................
.................... delay_ms(100);
0BBF: MOVLW 64
0BC0: BCF 03.5
0BC1: MOVWF 65
0BC2: BCF 0A.3
0BC3: CALL 2F5
0BC4: BSF 0A.3
....................
.................... i2c_start();
0BC5: BSF 28.4
0BC6: MOVF 28,W
0BC7: BSF 03.5
0BC8: MOVWF 07
0BC9: NOP
0BCA: BCF 03.5
0BCB: BSF 28.3
0BCC: MOVF 28,W
0BCD: BSF 03.5
0BCE: MOVWF 07
0BCF: NOP
0BD0: BCF 03.5
0BD1: BCF 07.4
0BD2: BCF 28.4
0BD3: MOVF 28,W
0BD4: BSF 03.5
0BD5: MOVWF 07
0BD6: NOP
0BD7: BCF 03.5
0BD8: BCF 07.3
0BD9: BCF 28.3
0BDA: MOVF 28,W
0BDB: BSF 03.5
0BDC: MOVWF 07
.................... I2C_Write(SHT25_ADDR+1);
0BDD: MOVLW 81
0BDE: MOVWF 73
0BDF: BCF 0A.3
0BE0: BCF 03.5
0BE1: CALL 22E
0BE2: BSF 0A.3
.................... MSB=i2c_read(1);
0BE3: MOVLW 01
0BE4: MOVWF 77
0BE5: BCF 0A.3
0BE6: CALL 2B0
0BE7: BSF 0A.3
0BE8: MOVF 78,W
0BE9: MOVWF 60
.................... LSB=i2c_read(1);
0BEA: MOVLW 01
0BEB: MOVWF 77
0BEC: BCF 0A.3
0BED: CALL 2B0
0BEE: BSF 0A.3
0BEF: MOVF 78,W
0BF0: MOVWF 61
.................... Check=i2c_read(0);
0BF1: CLRF 77
0BF2: BCF 0A.3
0BF3: CALL 2B0
0BF4: BSF 0A.3
0BF5: MOVF 78,W
0BF6: MOVWF 62
.................... i2c_stop();
0BF7: BCF 28.4
0BF8: MOVF 28,W
0BF9: BSF 03.5
0BFA: MOVWF 07
0BFB: NOP
0BFC: BCF 03.5
0BFD: BSF 28.3
0BFE: MOVF 28,W
0BFF: BSF 03.5
0C00: MOVWF 07
0C01: BCF 03.5
0C02: BTFSS 07.3
0C03: GOTO 402
0C04: NOP
0C05: GOTO 406
0C06: NOP
0C07: BSF 28.4
0C08: MOVF 28,W
0C09: BSF 03.5
0C0A: MOVWF 07
0C0B: NOP
....................
.................... LSB = LSB >> 2; // trow out status bits
0C0C: BCF 03.5
0C0D: RRF 61,F
0C0E: RRF 61,F
0C0F: MOVLW 3F
0C10: ANDWF 61,F
....................
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4));
0C11: CLRF 66
0C12: MOVF 60,W
0C13: MOVWF 65
0C14: MOVWF 66
0C15: CLRF 65
0C16: SWAPF 61,W
0C17: MOVWF 77
0C18: MOVLW F0
0C19: ANDWF 77,F
0C1A: MOVF 77,W
0C1B: ADDWF 65,W
0C1C: MOVWF 63
0C1D: MOVF 66,W
0C1E: MOVWF 64
0C1F: BTFSC 03.0
0C20: INCF 64,F
0C21: CLRF 27
0C22: BTFSC 0B.7
0C23: BSF 27.7
0C24: BCF 0B.7
.................... return(-46.85 + 175.72*((float)data/0xFFFF));
0C25: MOVF 64,W
0C26: BSF 03.5
0C27: MOVWF 43
0C28: BCF 03.5
0C29: MOVF 63,W
0C2A: BSF 03.5
0C2B: MOVWF 42
0C2C: BCF 0A.3
0C2D: BCF 03.5
0C2E: CALL 038
0C2F: BSF 0A.3
0C30: BTFSC 27.7
0C31: BSF 0B.7
0C32: MOVF 77,W
0C33: MOVWF 65
0C34: MOVF 78,W
0C35: MOVWF 66
0C36: MOVF 79,W
0C37: MOVWF 67
0C38: MOVF 7A,W
0C39: MOVWF 68
0C3A: CLRF 27
0C3B: BTFSC 0B.7
0C3C: BSF 27.7
0C3D: BCF 0B.7
0C3E: MOVF 68,W
0C3F: BSF 03.5
0C40: MOVWF 45
0C41: BCF 03.5
0C42: MOVF 67,W
0C43: BSF 03.5
0C44: MOVWF 44
0C45: BCF 03.5
0C46: MOVF 66,W
0C47: BSF 03.5
0C48: MOVWF 43
0C49: BCF 03.5
0C4A: MOVF 65,W
0C4B: BSF 03.5
0C4C: MOVWF 42
0C4D: CLRF 49
0C4E: MOVLW FF
0C4F: MOVWF 48
0C50: MOVLW 7F
0C51: MOVWF 47
0C52: MOVLW 8E
0C53: MOVWF 46
0C54: BCF 0A.3
0C55: BCF 03.5
0C56: CALL 057
0C57: BSF 0A.3
0C58: BTFSC 27.7
0C59: BSF 0B.7
0C5A: MOVLW 52
0C5B: BSF 03.5
0C5C: MOVWF 2C
0C5D: MOVLW B8
0C5E: MOVWF 2B
0C5F: MOVLW 2F
0C60: MOVWF 2A
0C61: MOVLW 86
0C62: MOVWF 29
0C63: MOVF 7A,W
0C64: MOVWF 30
0C65: MOVF 79,W
0C66: MOVWF 2F
0C67: MOVF 78,W
0C68: MOVWF 2E
0C69: MOVF 77,W
0C6A: MOVWF 2D
0C6B: BCF 0A.3
0C6C: BCF 03.5
0C6D: CALL 76E
0C6E: BSF 0A.3
0C6F: BCF 03.1
0C70: MOVLW 66
0C71: BSF 03.5
0C72: MOVWF 2C
0C73: MOVWF 2B
0C74: MOVLW BB
0C75: MOVWF 2A
0C76: MOVLW 84
0C77: MOVWF 29
0C78: MOVF 7A,W
0C79: MOVWF 30
0C7A: MOVF 79,W
0C7B: MOVWF 2F
0C7C: MOVF 78,W
0C7D: MOVWF 2E
0C7E: MOVF 77,W
0C7F: MOVWF 2D
0C80: BCF 03.5
0C81: CALL 000
.................... }
0C82: BSF 0A.3
0C83: BSF 0A.4
0C84: GOTO 0FB (RETURN)
....................
.................... float SHT25_get_hum()
.................... {
.................... unsigned int8 MSB, LSB, Check;
.................... unsigned int16 data;
....................
.................... i2c_start(); //RH
0C85: BSF 28.4
0C86: MOVF 28,W
0C87: BSF 03.5
0C88: MOVWF 07
0C89: NOP
0C8A: BCF 03.5
0C8B: BSF 28.3
0C8C: MOVF 28,W
0C8D: BSF 03.5
0C8E: MOVWF 07
0C8F: NOP
0C90: BCF 03.5
0C91: BCF 07.4
0C92: BCF 28.4
0C93: MOVF 28,W
0C94: BSF 03.5
0C95: MOVWF 07
0C96: NOP
0C97: BCF 03.5
0C98: BCF 07.3
0C99: BCF 28.3
0C9A: MOVF 28,W
0C9B: BSF 03.5
0C9C: MOVWF 07
.................... I2C_Write(SHT25_ADDR);
0C9D: MOVLW 80
0C9E: MOVWF 73
0C9F: BCF 0A.3
0CA0: BCF 03.5
0CA1: CALL 22E
0CA2: BSF 0A.3
.................... I2C_write(0xE5);
0CA3: MOVLW E5
0CA4: MOVWF 73
0CA5: BCF 0A.3
0CA6: CALL 22E
0CA7: BSF 0A.3
....................
.................... delay_ms(100);
0CA8: MOVLW 64
0CA9: MOVWF 65
0CAA: BCF 0A.3
0CAB: CALL 2F5
0CAC: BSF 0A.3
....................
.................... i2c_start();
0CAD: BSF 28.4
0CAE: MOVF 28,W
0CAF: BSF 03.5
0CB0: MOVWF 07
0CB1: NOP
0CB2: BCF 03.5
0CB3: BSF 28.3
0CB4: MOVF 28,W
0CB5: BSF 03.5
0CB6: MOVWF 07
0CB7: NOP
0CB8: BCF 03.5
0CB9: BTFSS 07.3
0CBA: GOTO 4B9
0CBB: BCF 07.4
0CBC: BCF 28.4
0CBD: MOVF 28,W
0CBE: BSF 03.5
0CBF: MOVWF 07
0CC0: NOP
0CC1: BCF 03.5
0CC2: BCF 07.3
0CC3: BCF 28.3
0CC4: MOVF 28,W
0CC5: BSF 03.5
0CC6: MOVWF 07
.................... I2C_Write(SHT25_ADDR+1);
0CC7: MOVLW 81
0CC8: MOVWF 73
0CC9: BCF 0A.3
0CCA: BCF 03.5
0CCB: CALL 22E
0CCC: BSF 0A.3
.................... MSB=i2c_read(1);
0CCD: MOVLW 01
0CCE: MOVWF 77
0CCF: BCF 0A.3
0CD0: CALL 2B0
0CD1: BSF 0A.3
0CD2: MOVF 78,W
0CD3: MOVWF 60
.................... LSB=i2c_read(1);
0CD4: MOVLW 01
0CD5: MOVWF 77
0CD6: BCF 0A.3
0CD7: CALL 2B0
0CD8: BSF 0A.3
0CD9: MOVF 78,W
0CDA: MOVWF 61
.................... Check=i2c_read(0);
0CDB: CLRF 77
0CDC: BCF 0A.3
0CDD: CALL 2B0
0CDE: BSF 0A.3
0CDF: MOVF 78,W
0CE0: MOVWF 62
.................... i2c_stop();
0CE1: BCF 28.4
0CE2: MOVF 28,W
0CE3: BSF 03.5
0CE4: MOVWF 07
0CE5: NOP
0CE6: BCF 03.5
0CE7: BSF 28.3
0CE8: MOVF 28,W
0CE9: BSF 03.5
0CEA: MOVWF 07
0CEB: BCF 03.5
0CEC: BTFSS 07.3
0CED: GOTO 4EC
0CEE: NOP
0CEF: GOTO 4F0
0CF0: NOP
0CF1: BSF 28.4
0CF2: MOVF 28,W
0CF3: BSF 03.5
0CF4: MOVWF 07
0CF5: NOP
....................
.................... LSB = LSB >> 2; // trow out status bits
0CF6: BCF 03.5
0CF7: RRF 61,F
0CF8: RRF 61,F
0CF9: MOVLW 3F
0CFA: ANDWF 61,F
....................
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) );
0CFB: CLRF 66
0CFC: MOVF 60,W
0CFD: MOVWF 65
0CFE: MOVWF 66
0CFF: CLRF 65
0D00: SWAPF 61,W
0D01: MOVWF 77
0D02: MOVLW F0
0D03: ANDWF 77,F
0D04: MOVF 77,W
0D05: ADDWF 65,W
0D06: MOVWF 63
0D07: MOVF 66,W
0D08: MOVWF 64
0D09: BTFSC 03.0
0D0A: INCF 64,F
0D0B: CLRF 27
0D0C: BTFSC 0B.7
0D0D: BSF 27.7
0D0E: BCF 0B.7
.................... return( -6.0 + 125.0*((float)data/0xFFFF));
0D0F: MOVF 64,W
0D10: BSF 03.5
0D11: MOVWF 43
0D12: BCF 03.5
0D13: MOVF 63,W
0D14: BSF 03.5
0D15: MOVWF 42
0D16: BCF 0A.3
0D17: BCF 03.5
0D18: CALL 038
0D19: BSF 0A.3
0D1A: BTFSC 27.7
0D1B: BSF 0B.7
0D1C: MOVF 77,W
0D1D: MOVWF 65
0D1E: MOVF 78,W
0D1F: MOVWF 66
0D20: MOVF 79,W
0D21: MOVWF 67
0D22: MOVF 7A,W
0D23: MOVWF 68
0D24: CLRF 27
0D25: BTFSC 0B.7
0D26: BSF 27.7
0D27: BCF 0B.7
0D28: MOVF 7A,W
0D29: BSF 03.5
0D2A: MOVWF 45
0D2B: BCF 03.5
0D2C: MOVF 79,W
0D2D: BSF 03.5
0D2E: MOVWF 44
0D2F: BCF 03.5
0D30: MOVF 78,W
0D31: BSF 03.5
0D32: MOVWF 43
0D33: BCF 03.5
0D34: MOVF 77,W
0D35: BSF 03.5
0D36: MOVWF 42
0D37: CLRF 49
0D38: MOVLW FF
0D39: MOVWF 48
0D3A: MOVLW 7F
0D3B: MOVWF 47
0D3C: MOVLW 8E
0D3D: MOVWF 46
0D3E: BCF 0A.3
0D3F: BCF 03.5
0D40: CALL 057
0D41: BSF 0A.3
0D42: BTFSC 27.7
0D43: BSF 0B.7
0D44: BSF 03.5
0D45: CLRF 2C
0D46: CLRF 2B
0D47: MOVLW 7A
0D48: MOVWF 2A
0D49: MOVLW 85
0D4A: MOVWF 29
0D4B: MOVF 7A,W
0D4C: MOVWF 30
0D4D: MOVF 79,W
0D4E: MOVWF 2F
0D4F: MOVF 78,W
0D50: MOVWF 2E
0D51: MOVF 77,W
0D52: MOVWF 2D
0D53: BCF 0A.3
0D54: BCF 03.5
0D55: CALL 76E
0D56: BSF 0A.3
0D57: BCF 03.1
0D58: BSF 03.5
0D59: CLRF 2C
0D5A: CLRF 2B
0D5B: MOVLW C0
0D5C: MOVWF 2A
0D5D: MOVLW 81
0D5E: MOVWF 29
0D5F: MOVF 7A,W
0D60: MOVWF 30
0D61: MOVF 79,W
0D62: MOVWF 2F
0D63: MOVF 78,W
0D64: MOVWF 2E
0D65: MOVF 77,W
0D66: MOVWF 2D
0D67: BCF 03.5
0D68: CALL 000
.................... }
0D69: BSF 0A.3
0D6A: BSF 0A.4
0D6B: GOTO 106 (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
*
0A20: BSF 28.4
0A21: MOVF 28,W
0A22: BSF 03.5
0A23: MOVWF 07
0A24: NOP
0A25: BCF 03.5
0A26: BSF 28.3
0A27: MOVF 28,W
0A28: BSF 03.5
0A29: MOVWF 07
0A2A: NOP
0A2B: BCF 03.5
0A2C: BCF 07.4
0A2D: BCF 28.4
0A2E: MOVF 28,W
0A2F: BSF 03.5
0A30: MOVWF 07
0A31: NOP
0A32: BCF 03.5
0A33: BCF 07.3
0A34: BCF 28.3
0A35: MOVF 28,W
0A36: BSF 03.5
0A37: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0A38: MOVLW C0
0A39: MOVWF 73
0A3A: BCF 0A.3
0A3B: BCF 03.5
0A3C: CALL 22E
0A3D: BSF 0A.3
.................... I2C_write(0x26);
0A3E: MOVLW 26
0A3F: MOVWF 73
0A40: BCF 0A.3
0A41: CALL 22E
0A42: BSF 0A.3
.................... I2C_write(0xB8);
0A43: MOVLW B8
0A44: MOVWF 73
0A45: BCF 0A.3
0A46: CALL 22E
0A47: BSF 0A.3
.................... i2c_stop();
0A48: BCF 28.4
0A49: MOVF 28,W
0A4A: BSF 03.5
0A4B: MOVWF 07
0A4C: NOP
0A4D: BCF 03.5
0A4E: BSF 28.3
0A4F: MOVF 28,W
0A50: BSF 03.5
0A51: MOVWF 07
0A52: BCF 03.5
0A53: BTFSS 07.3
0A54: GOTO 253
0A55: NOP
0A56: GOTO 257
0A57: NOP
0A58: BSF 28.4
0A59: MOVF 28,W
0A5A: BSF 03.5
0A5B: MOVWF 07
0A5C: NOP
....................
.................... i2c_start(); //PT_DATA_CFG set
0A5D: BCF 03.5
0A5E: BSF 28.4
0A5F: MOVF 28,W
0A60: BSF 03.5
0A61: MOVWF 07
0A62: NOP
0A63: BCF 03.5
0A64: BSF 28.3
0A65: MOVF 28,W
0A66: BSF 03.5
0A67: MOVWF 07
0A68: NOP
0A69: BCF 03.5
0A6A: BCF 07.4
0A6B: BCF 28.4
0A6C: MOVF 28,W
0A6D: BSF 03.5
0A6E: MOVWF 07
0A6F: NOP
0A70: BCF 03.5
0A71: BCF 07.3
0A72: BCF 28.3
0A73: MOVF 28,W
0A74: BSF 03.5
0A75: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0A76: MOVLW C0
0A77: MOVWF 73
0A78: BCF 0A.3
0A79: BCF 03.5
0A7A: CALL 22E
0A7B: BSF 0A.3
.................... I2C_write(0x13);
0A7C: MOVLW 13
0A7D: MOVWF 73
0A7E: BCF 0A.3
0A7F: CALL 22E
0A80: BSF 0A.3
.................... I2C_write(0x07); //hodnota
0A81: MOVLW 07
0A82: MOVWF 73
0A83: BCF 0A.3
0A84: CALL 22E
0A85: BSF 0A.3
.................... i2c_stop();
0A86: BCF 28.4
0A87: MOVF 28,W
0A88: BSF 03.5
0A89: MOVWF 07
0A8A: NOP
0A8B: BCF 03.5
0A8C: BSF 28.3
0A8D: MOVF 28,W
0A8E: BSF 03.5
0A8F: MOVWF 07
0A90: BCF 03.5
0A91: BTFSS 07.3
0A92: GOTO 291
0A93: NOP
0A94: GOTO 295
0A95: NOP
0A96: BSF 28.4
0A97: MOVF 28,W
0A98: BSF 03.5
0A99: MOVWF 07
0A9A: NOP
....................
.................... i2c_start(); //ACTIVE mode
0A9B: BCF 03.5
0A9C: BSF 28.4
0A9D: MOVF 28,W
0A9E: BSF 03.5
0A9F: MOVWF 07
0AA0: NOP
0AA1: BCF 03.5
0AA2: BSF 28.3
0AA3: MOVF 28,W
0AA4: BSF 03.5
0AA5: MOVWF 07
0AA6: NOP
0AA7: BCF 03.5
0AA8: BCF 07.4
0AA9: BCF 28.4
0AAA: MOVF 28,W
0AAB: BSF 03.5
0AAC: MOVWF 07
0AAD: NOP
0AAE: BCF 03.5
0AAF: BCF 07.3
0AB0: BCF 28.3
0AB1: MOVF 28,W
0AB2: BSF 03.5
0AB3: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0AB4: MOVLW C0
0AB5: MOVWF 73
0AB6: BCF 0A.3
0AB7: BCF 03.5
0AB8: CALL 22E
0AB9: BSF 0A.3
.................... I2C_write(0x26);
0ABA: MOVLW 26
0ABB: MOVWF 73
0ABC: BCF 0A.3
0ABD: CALL 22E
0ABE: BSF 0A.3
.................... I2C_write(0xB9);
0ABF: MOVLW B9
0AC0: MOVWF 73
0AC1: BCF 0A.3
0AC2: CALL 22E
0AC3: BSF 0A.3
.................... i2c_stop();
0AC4: BCF 28.4
0AC5: MOVF 28,W
0AC6: BSF 03.5
0AC7: MOVWF 07
0AC8: NOP
0AC9: BCF 03.5
0ACA: BSF 28.3
0ACB: MOVF 28,W
0ACC: BSF 03.5
0ACD: MOVWF 07
0ACE: BCF 03.5
0ACF: BTFSS 07.3
0AD0: GOTO 2CF
0AD1: NOP
0AD2: GOTO 2D3
0AD3: NOP
0AD4: BSF 28.4
0AD5: MOVF 28,W
0AD6: BSF 03.5
0AD7: MOVWF 07
0AD8: NOP
.................... }
0AD9: BCF 03.5
0ADA: BSF 0A.3
0ADB: BSF 0A.4
0ADC: GOTO 0E2 (RETURN)
....................
.................... void mpl3115_setP (void) //nastavení pro tlak
.................... {
....................
....................
.................... i2c_start(); //STANDBY mode
*
05E6: BSF 28.4
05E7: MOVF 28,W
05E8: BSF 03.5
05E9: MOVWF 07
05EA: NOP
05EB: BCF 03.5
05EC: BSF 28.3
05ED: MOVF 28,W
05EE: BSF 03.5
05EF: MOVWF 07
05F0: NOP
05F1: BCF 03.5
05F2: BCF 07.4
05F3: BCF 28.4
05F4: MOVF 28,W
05F5: BSF 03.5
05F6: MOVWF 07
05F7: NOP
05F8: BCF 03.5
05F9: BCF 07.3
05FA: BCF 28.3
05FB: MOVF 28,W
05FC: BSF 03.5
05FD: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
05FE: MOVLW C0
05FF: MOVWF 73
0600: BCF 03.5
0601: CALL 22E
.................... I2C_write(0x26);
0602: MOVLW 26
0603: MOVWF 73
0604: CALL 22E
.................... I2C_write(0xB8);
0605: MOVLW B8
0606: MOVWF 73
0607: CALL 22E
.................... i2c_stop();
0608: BCF 28.4
0609: MOVF 28,W
060A: BSF 03.5
060B: MOVWF 07
060C: NOP
060D: BCF 03.5
060E: BSF 28.3
060F: MOVF 28,W
0610: BSF 03.5
0611: MOVWF 07
0612: BCF 03.5
0613: BTFSS 07.3
0614: GOTO 613
0615: NOP
0616: GOTO 617
0617: NOP
0618: BSF 28.4
0619: MOVF 28,W
061A: BSF 03.5
061B: MOVWF 07
061C: NOP
....................
.................... i2c_start(); //PT_DATA_CFG set
061D: BCF 03.5
061E: BSF 28.4
061F: MOVF 28,W
0620: BSF 03.5
0621: MOVWF 07
0622: NOP
0623: BCF 03.5
0624: BSF 28.3
0625: MOVF 28,W
0626: BSF 03.5
0627: MOVWF 07
0628: NOP
0629: BCF 03.5
062A: BCF 07.4
062B: BCF 28.4
062C: MOVF 28,W
062D: BSF 03.5
062E: MOVWF 07
062F: NOP
0630: BCF 03.5
0631: BCF 07.3
0632: BCF 28.3
0633: MOVF 28,W
0634: BSF 03.5
0635: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
0636: MOVLW C0
0637: MOVWF 73
0638: BCF 03.5
0639: CALL 22E
.................... I2C_write(0x13);
063A: MOVLW 13
063B: MOVWF 73
063C: CALL 22E
.................... I2C_write(0x07); //hodnota
063D: MOVLW 07
063E: MOVWF 73
063F: CALL 22E
.................... i2c_stop();
0640: BCF 28.4
0641: MOVF 28,W
0642: BSF 03.5
0643: MOVWF 07
0644: NOP
0645: BCF 03.5
0646: BSF 28.3
0647: MOVF 28,W
0648: BSF 03.5
0649: MOVWF 07
064A: BCF 03.5
064B: BTFSS 07.3
064C: GOTO 64B
064D: NOP
064E: GOTO 64F
064F: NOP
0650: BSF 28.4
0651: MOVF 28,W
0652: BSF 03.5
0653: MOVWF 07
0654: NOP
....................
.................... i2c_start(); //ACTIVE mode
0655: BCF 03.5
0656: BSF 28.4
0657: MOVF 28,W
0658: BSF 03.5
0659: MOVWF 07
065A: NOP
065B: BCF 03.5
065C: BSF 28.3
065D: MOVF 28,W
065E: BSF 03.5
065F: MOVWF 07
0660: NOP
0661: BCF 03.5
0662: BCF 07.4
0663: BCF 28.4
0664: MOVF 28,W
0665: BSF 03.5
0666: MOVWF 07
0667: NOP
0668: BCF 03.5
0669: BCF 07.3
066A: BCF 28.3
066B: MOVF 28,W
066C: BSF 03.5
066D: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
066E: MOVLW C0
066F: MOVWF 73
0670: BCF 03.5
0671: CALL 22E
.................... I2C_write(0x26);
0672: MOVLW 26
0673: MOVWF 73
0674: CALL 22E
.................... I2C_write(0x39);
0675: MOVLW 39
0676: MOVWF 73
0677: CALL 22E
.................... i2c_stop();
0678: BCF 28.4
0679: MOVF 28,W
067A: BSF 03.5
067B: MOVWF 07
067C: NOP
067D: BCF 03.5
067E: BSF 28.3
067F: MOVF 28,W
0680: BSF 03.5
0681: MOVWF 07
0682: BCF 03.5
0683: BTFSS 07.3
0684: GOTO 683
0685: NOP
0686: GOTO 687
0687: NOP
0688: BSF 28.4
0689: MOVF 28,W
068A: BSF 03.5
068B: MOVWF 07
068C: NOP
.................... }
068D: BCF 03.5
068E: BSF 0A.3
068F: BSF 0A.4
0690: GOTO 0BB (RETURN)
....................
....................
.................... byte mpl3115_read (byte reg)
.................... {
.................... byte i;
....................
.................... i2c_start();
0691: BSF 28.4
0692: MOVF 28,W
0693: BSF 03.5
0694: MOVWF 07
0695: NOP
0696: BCF 03.5
0697: BSF 28.3
0698: MOVF 28,W
0699: BSF 03.5
069A: MOVWF 07
069B: NOP
069C: BCF 03.5
069D: BCF 07.4
069E: BCF 28.4
069F: MOVF 28,W
06A0: BSF 03.5
06A1: MOVWF 07
06A2: NOP
06A3: BCF 03.5
06A4: BCF 07.3
06A5: BCF 28.3
06A6: MOVF 28,W
06A7: BSF 03.5
06A8: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_W);
06A9: MOVLW C0
06AA: MOVWF 73
06AB: BCF 03.5
06AC: CALL 22E
.................... I2C_write(reg);
06AD: MOVF 70,W
06AE: MOVWF 73
06AF: CALL 22E
.................... i2c_start();
06B0: BSF 28.4
06B1: MOVF 28,W
06B2: BSF 03.5
06B3: MOVWF 07
06B4: NOP
06B5: BCF 03.5
06B6: BSF 28.3
06B7: MOVF 28,W
06B8: BSF 03.5
06B9: MOVWF 07
06BA: NOP
06BB: BCF 03.5
06BC: BTFSS 07.3
06BD: GOTO 6BC
06BE: BCF 07.4
06BF: BCF 28.4
06C0: MOVF 28,W
06C1: BSF 03.5
06C2: MOVWF 07
06C3: NOP
06C4: BCF 03.5
06C5: BCF 07.3
06C6: BCF 28.3
06C7: MOVF 28,W
06C8: BSF 03.5
06C9: MOVWF 07
.................... I2C_Write(MPL3115_ADDR_R);
06CA: MOVLW C1
06CB: MOVWF 73
06CC: BCF 03.5
06CD: CALL 22E
.................... i=i2c_read(0);
06CE: CLRF 77
06CF: CALL 2B0
06D0: MOVF 78,W
06D1: MOVWF 71
.................... i2c_stop();
06D2: BCF 28.4
06D3: MOVF 28,W
06D4: BSF 03.5
06D5: MOVWF 07
06D6: NOP
06D7: BCF 03.5
06D8: BSF 28.3
06D9: MOVF 28,W
06DA: BSF 03.5
06DB: MOVWF 07
06DC: BCF 03.5
06DD: BTFSS 07.3
06DE: GOTO 6DD
06DF: NOP
06E0: GOTO 6E1
06E1: NOP
06E2: BSF 28.4
06E3: MOVF 28,W
06E4: BSF 03.5
06E5: MOVWF 07
06E6: NOP
....................
.................... return i;
06E7: MOVF 71,W
06E8: MOVWF 78
.................... }
06E9: BCF 03.5
06EA: RETURN
....................
....................
.................... float mpl3115_T (void) //teplota ve stupnich
.................... {
.................... int m;
.................... float l, t;
....................
.................... m= mpl3115_read (0x04);
06EB: MOVLW 04
06EC: MOVWF 70
06ED: CALL 691
06EE: MOVF 78,W
06EF: MOVWF 60
.................... l= (float)(mpl3115_read(0x05)>>4)/16.0;
06F0: MOVLW 05
06F1: MOVWF 70
06F2: CALL 691
06F3: SWAPF 78,W
06F4: MOVWF 77
06F5: MOVLW 0F
06F6: ANDWF 77,F
06F7: MOVF 77,W
06F8: CLRF 27
06F9: BTFSC 0B.7
06FA: BSF 27.7
06FB: BCF 0B.7
06FC: BSF 03.5
06FD: CLRF 43
06FE: MOVWF 42
06FF: BCF 03.5
0700: CALL 038
0701: BTFSC 27.7
0702: BSF 0B.7
0703: MOVF 77,W
0704: MOVWF 69
0705: MOVF 78,W
0706: MOVWF 6A
0707: MOVF 79,W
0708: MOVWF 6B
0709: MOVF 7A,W
070A: MOVWF 6C
070B: CLRF 27
070C: BTFSC 0B.7
070D: BSF 27.7
070E: BCF 0B.7
070F: MOVF 6C,W
0710: BSF 03.5
0711: MOVWF 45
0712: BCF 03.5
0713: MOVF 6B,W
0714: BSF 03.5
0715: MOVWF 44
0716: BCF 03.5
0717: MOVF 6A,W
0718: BSF 03.5
0719: MOVWF 43
071A: BCF 03.5
071B: MOVF 69,W
071C: BSF 03.5
071D: MOVWF 42
071E: CLRF 49
071F: CLRF 48
0720: CLRF 47
0721: MOVLW 83
0722: MOVWF 46
0723: BCF 03.5
0724: CALL 057
0725: BTFSC 27.7
0726: BSF 0B.7
0727: MOVF 7A,W
0728: MOVWF 64
0729: MOVF 79,W
072A: MOVWF 63
072B: MOVF 78,W
072C: MOVWF 62
072D: MOVF 77,W
072E: MOVWF 61
072F: CLRF 27
0730: BTFSC 0B.7
0731: BSF 27.7
0732: BCF 0B.7
.................... t = (float)(M + L);
0733: BSF 03.5
0734: CLRF 43
0735: BCF 03.5
0736: MOVF 60,W
0737: BSF 03.5
0738: MOVWF 42
0739: BCF 03.5
073A: CALL 038
073B: BTFSC 27.7
073C: BSF 0B.7
073D: BCF 03.1
073E: MOVF 7A,W
073F: BSF 03.5
0740: MOVWF 2C
0741: MOVF 79,W
0742: MOVWF 2B
0743: MOVF 78,W
0744: MOVWF 2A
0745: MOVF 77,W
0746: MOVWF 29
0747: BCF 03.5
0748: MOVF 64,W
0749: BSF 03.5
074A: MOVWF 30
074B: BCF 03.5
074C: MOVF 63,W
074D: BSF 03.5
074E: MOVWF 2F
074F: BCF 03.5
0750: MOVF 62,W
0751: BSF 03.5
0752: MOVWF 2E
0753: BCF 03.5
0754: MOVF 61,W
0755: BSF 03.5
0756: MOVWF 2D
0757: BSF 0A.3
0758: BCF 03.5
0759: CALL 000
075A: BCF 0A.3
075B: MOVF 7A,W
075C: MOVWF 68
075D: MOVF 79,W
075E: MOVWF 67
075F: MOVF 78,W
0760: MOVWF 66
0761: MOVF 77,W
0762: MOVWF 65
.................... return t;
0763: MOVF 65,W
0764: MOVWF 77
0765: MOVF 66,W
0766: MOVWF 78
0767: MOVF 67,W
0768: MOVWF 79
0769: MOVF 68,W
076A: MOVWF 7A
.................... }
076B: BSF 0A.3
076C: BSF 0A.4
076D: GOTO 0CB (RETURN)
....................
.................... float mpl3115_A (void) //vyska v m
.................... {
....................
.................... int16 m;
.................... unsigned int8 c;
.................... float l, a;
....................
.................... m= mpl3115_read (0x01);
*
0ADD: MOVLW 01
0ADE: MOVWF 70
0ADF: BCF 0A.3
0AE0: CALL 691
0AE1: BSF 0A.3
0AE2: CLRF 61
0AE3: MOVF 78,W
0AE4: MOVWF 60
.................... c= mpl3115_read (0x02);
0AE5: MOVLW 02
0AE6: MOVWF 70
0AE7: BCF 0A.3
0AE8: CALL 691
0AE9: BSF 0A.3
0AEA: MOVF 78,W
0AEB: MOVWF 62
.................... l= (float)(mpl3115_read(0x03)>>4)/16.0;
0AEC: MOVLW 03
0AED: MOVWF 70
0AEE: BCF 0A.3
0AEF: CALL 691
0AF0: BSF 0A.3
0AF1: SWAPF 78,W
0AF2: MOVWF 77
0AF3: MOVLW 0F
0AF4: ANDWF 77,F
0AF5: MOVF 77,W
0AF6: CLRF 27
0AF7: BTFSC 0B.7
0AF8: BSF 27.7
0AF9: BCF 0B.7
0AFA: BSF 03.5
0AFB: CLRF 43
0AFC: MOVWF 42
0AFD: BCF 0A.3
0AFE: BCF 03.5
0AFF: CALL 038
0B00: BSF 0A.3
0B01: BTFSC 27.7
0B02: BSF 0B.7
0B03: MOVF 77,W
0B04: MOVWF 6B
0B05: MOVF 78,W
0B06: MOVWF 6C
0B07: MOVF 79,W
0B08: MOVWF 6D
0B09: MOVF 7A,W
0B0A: MOVWF 6E
0B0B: CLRF 27
0B0C: BTFSC 0B.7
0B0D: BSF 27.7
0B0E: BCF 0B.7
0B0F: MOVF 7A,W
0B10: BSF 03.5
0B11: MOVWF 45
0B12: BCF 03.5
0B13: MOVF 79,W
0B14: BSF 03.5
0B15: MOVWF 44
0B16: BCF 03.5
0B17: MOVF 78,W
0B18: BSF 03.5
0B19: MOVWF 43
0B1A: BCF 03.5
0B1B: MOVF 77,W
0B1C: BSF 03.5
0B1D: MOVWF 42
0B1E: CLRF 49
0B1F: CLRF 48
0B20: CLRF 47
0B21: MOVLW 83
0B22: MOVWF 46
0B23: BCF 0A.3
0B24: BCF 03.5
0B25: CALL 057
0B26: BSF 0A.3
0B27: BTFSC 27.7
0B28: BSF 0B.7
0B29: MOVF 7A,W
0B2A: MOVWF 66
0B2B: MOVF 79,W
0B2C: MOVWF 65
0B2D: MOVF 78,W
0B2E: MOVWF 64
0B2F: MOVF 77,W
0B30: MOVWF 63
.................... a = (float)((m << 8)|c) + l;
0B31: MOVF 60,W
0B32: MOVWF 6D
0B33: CLRF 6C
0B34: MOVF 6C,W
0B35: IORWF 62,W
0B36: MOVWF 77
0B37: MOVF 60,W
0B38: MOVWF 7A
0B39: MOVF 77,W
0B3A: CLRF 27
0B3B: BTFSC 0B.7
0B3C: BSF 27.7
0B3D: BCF 0B.7
0B3E: BSF 03.5
0B3F: MOVWF 42
0B40: MOVF 7A,W
0B41: MOVWF 43
0B42: BCF 0A.3
0B43: BCF 03.5
0B44: CALL 038
0B45: BSF 0A.3
0B46: BTFSC 27.7
0B47: BSF 0B.7
0B48: MOVF 77,W
0B49: MOVWF 6C
0B4A: MOVF 78,W
0B4B: MOVWF 6D
0B4C: MOVF 79,W
0B4D: MOVWF 6E
0B4E: MOVF 7A,W
0B4F: MOVWF 6F
0B50: BCF 03.1
0B51: MOVF 7A,W
0B52: BSF 03.5
0B53: MOVWF 2C
0B54: BCF 03.5
0B55: MOVF 79,W
0B56: BSF 03.5
0B57: MOVWF 2B
0B58: BCF 03.5
0B59: MOVF 78,W
0B5A: BSF 03.5
0B5B: MOVWF 2A
0B5C: BCF 03.5
0B5D: MOVF 77,W
0B5E: BSF 03.5
0B5F: MOVWF 29
0B60: BCF 03.5
0B61: MOVF 66,W
0B62: BSF 03.5
0B63: MOVWF 30
0B64: BCF 03.5
0B65: MOVF 65,W
0B66: BSF 03.5
0B67: MOVWF 2F
0B68: BCF 03.5
0B69: MOVF 64,W
0B6A: BSF 03.5
0B6B: MOVWF 2E
0B6C: BCF 03.5
0B6D: MOVF 63,W
0B6E: BSF 03.5
0B6F: MOVWF 2D
0B70: BCF 03.5
0B71: CALL 000
0B72: MOVF 7A,W
0B73: MOVWF 6A
0B74: MOVF 79,W
0B75: MOVWF 69
0B76: MOVF 78,W
0B77: MOVWF 68
0B78: MOVF 77,W
0B79: MOVWF 67
.................... return a;
0B7A: MOVF 67,W
0B7B: MOVWF 77
0B7C: MOVF 68,W
0B7D: MOVWF 78
0B7E: MOVF 69,W
0B7F: MOVWF 79
0B80: MOVF 6A,W
0B81: MOVWF 7A
.................... }
0B82: BSF 0A.3
0B83: BSF 0A.4
0B84: GOTO 0F0 (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);
*
0946: MOVLW 01
0947: MOVWF 70
0948: BCF 0A.3
0949: CALL 691
094A: BSF 0A.3
094B: CLRF 63
094C: CLRF 62
094D: CLRF 61
094E: MOVF 78,W
094F: MOVWF 60
.................... c= mpl3115_read (0x02);
0950: MOVLW 02
0951: MOVWF 70
0952: BCF 0A.3
0953: CALL 691
0954: BSF 0A.3
0955: CLRF 65
0956: MOVF 78,W
0957: MOVWF 64
.................... l=mpl3115_read(0x03);
0958: MOVLW 03
0959: MOVWF 70
095A: BCF 0A.3
095B: CALL 691
095C: BSF 0A.3
095D: MOVF 78,W
095E: MOVWF 66
.................... l2=l<<2;
095F: RLF 66,W
0960: MOVWF 67
0961: RLF 67,F
0962: MOVLW FC
0963: ANDWF 67,F
.................... l1= (float)(l>>6)/4.0;
0964: SWAPF 66,W
0965: MOVWF 77
0966: RRF 77,F
0967: RRF 77,F
0968: MOVLW 03
0969: ANDWF 77,F
096A: MOVF 77,W
096B: CLRF 27
096C: BTFSC 0B.7
096D: BSF 27.7
096E: BCF 0B.7
096F: BSF 03.5
0970: CLRF 43
0971: MOVWF 42
0972: BCF 0A.3
0973: BCF 03.5
0974: CALL 038
0975: BSF 0A.3
0976: BTFSC 27.7
0977: BSF 0B.7
0978: MOVF 77,W
0979: MOVWF 71
097A: MOVF 78,W
097B: MOVWF 72
097C: MOVF 79,W
097D: MOVWF 73
097E: MOVF 7A,W
097F: MOVWF 74
0980: CLRF 27
0981: BTFSC 0B.7
0982: BSF 27.7
0983: BCF 0B.7
0984: MOVF 74,W
0985: BSF 03.5
0986: MOVWF 45
0987: MOVF 73,W
0988: MOVWF 44
0989: MOVF 72,W
098A: MOVWF 43
098B: MOVF 71,W
098C: MOVWF 42
098D: CLRF 49
098E: CLRF 48
098F: CLRF 47
0990: MOVLW 81
0991: MOVWF 46
0992: BCF 0A.3
0993: BCF 03.5
0994: CALL 057
0995: BSF 0A.3
0996: BTFSC 27.7
0997: BSF 0B.7
0998: MOVF 7A,W
0999: MOVWF 6F
099A: MOVF 79,W
099B: MOVWF 6E
099C: MOVF 78,W
099D: MOVWF 6D
099E: MOVF 77,W
099F: MOVWF 6C
.................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1;
09A0: CLRF 71
09A1: RLF 60,W
09A2: MOVWF 72
09A3: RLF 61,W
09A4: MOVWF 73
09A5: RLF 62,W
09A6: MOVWF 74
09A7: RLF 72,F
09A8: RLF 73,F
09A9: RLF 74,F
09AA: MOVLW FC
09AB: ANDWF 72,F
09AC: RLF 64,W
09AD: MOVWF 79
09AE: RLF 65,W
09AF: MOVWF 7A
09B0: RLF 79,F
09B1: RLF 7A,F
09B2: MOVLW FC
09B3: ANDWF 79,F
09B4: MOVF 79,W
09B5: IORWF 71,F
09B6: MOVF 7A,W
09B7: IORWF 72,F
09B8: SWAPF 66,W
09B9: MOVWF 77
09BA: RRF 77,F
09BB: RRF 77,F
09BC: MOVLW 03
09BD: ANDWF 77,F
09BE: MOVF 77,W
09BF: IORWF 71,W
09C0: MOVWF 77
09C1: MOVF 72,W
09C2: MOVWF 78
09C3: MOVF 73,W
09C4: MOVWF 79
09C5: MOVF 74,W
09C6: MOVWF 7A
09C7: MOVF 7A,W
09C8: MOVWF 7E
09C9: MOVF 79,W
09CA: MOVWF 7D
09CB: MOVF 78,W
09CC: MOVWF 7C
09CD: MOVF 77,W
09CE: MOVWF 7B
*
09E9: MOVF 77,W
09EA: MOVWF 71
09EB: MOVF 78,W
09EC: MOVWF 72
09ED: MOVF 79,W
09EE: MOVWF 73
09EF: MOVF 7A,W
09F0: MOVWF 74
09F1: BCF 03.1
09F2: MOVF 74,W
09F3: BSF 03.5
09F4: MOVWF 2C
09F5: MOVF 73,W
09F6: MOVWF 2B
09F7: MOVF 72,W
09F8: MOVWF 2A
09F9: MOVF 71,W
09FA: MOVWF 29
09FB: BCF 03.5
09FC: MOVF 6F,W
09FD: BSF 03.5
09FE: MOVWF 30
09FF: BCF 03.5
0A00: MOVF 6E,W
0A01: BSF 03.5
0A02: MOVWF 2F
0A03: BCF 03.5
0A04: MOVF 6D,W
0A05: BSF 03.5
0A06: MOVWF 2E
0A07: BCF 03.5
0A08: MOVF 6C,W
0A09: BSF 03.5
0A0A: MOVWF 2D
0A0B: BCF 03.5
0A0C: CALL 000
0A0D: MOVF 7A,W
0A0E: MOVWF 6B
0A0F: MOVF 79,W
0A10: MOVWF 6A
0A11: MOVF 78,W
0A12: MOVWF 69
0A13: MOVF 77,W
0A14: MOVWF 68
....................
.................... return p;
0A15: MOVF 68,W
0A16: MOVWF 77
0A17: MOVF 69,W
0A18: MOVWF 78
0A19: MOVF 6A,W
0A1A: MOVWF 79
0A1B: MOVF 6B,W
0A1C: MOVWF 7A
.................... }
0A1D: BSF 0A.3
0A1E: BSF 0A.4
0A1F: GOTO 0D7 (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
*
0534: BSF 28.4
0535: MOVF 28,W
0536: BSF 03.5
0537: MOVWF 07
0538: NOP
0539: BCF 03.5
053A: BSF 28.3
053B: MOVF 28,W
053C: BSF 03.5
053D: MOVWF 07
053E: NOP
053F: BCF 03.5
0540: BCF 07.4
0541: BCF 28.4
0542: MOVF 28,W
0543: BSF 03.5
0544: MOVWF 07
0545: NOP
0546: BCF 03.5
0547: BCF 07.3
0548: BCF 28.3
0549: MOVF 28,W
054A: BSF 03.5
054B: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
054C: MOVLW 3C
054D: MOVWF 73
054E: BCF 03.5
054F: CALL 22E
.................... I2C_Write(0x00);
0550: CLRF 73
0551: CALL 22E
.................... I2C_Write(0x70);
0552: MOVLW 70
0553: MOVWF 73
0554: CALL 22E
.................... i2c_stop();
0555: BCF 28.4
0556: MOVF 28,W
0557: BSF 03.5
0558: MOVWF 07
0559: NOP
055A: BCF 03.5
055B: BSF 28.3
055C: MOVF 28,W
055D: BSF 03.5
055E: MOVWF 07
055F: BCF 03.5
0560: BTFSS 07.3
0561: GOTO 560
0562: NOP
0563: GOTO 564
0564: NOP
0565: BSF 28.4
0566: MOVF 28,W
0567: BSF 03.5
0568: MOVWF 07
0569: NOP
.................... Delay_ms(6);
056A: MOVLW 06
056B: BCF 03.5
056C: MOVWF 65
056D: CALL 2F5
....................
.................... i2c_start(); //nastavení Configuration Register B
056E: BSF 28.4
056F: MOVF 28,W
0570: BSF 03.5
0571: MOVWF 07
0572: NOP
0573: BCF 03.5
0574: BSF 28.3
0575: MOVF 28,W
0576: BSF 03.5
0577: MOVWF 07
0578: NOP
0579: BCF 03.5
057A: BCF 07.4
057B: BCF 28.4
057C: MOVF 28,W
057D: BSF 03.5
057E: MOVWF 07
057F: NOP
0580: BCF 03.5
0581: BCF 07.3
0582: BCF 28.3
0583: MOVF 28,W
0584: BSF 03.5
0585: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
0586: MOVLW 3C
0587: MOVWF 73
0588: BCF 03.5
0589: CALL 22E
.................... I2C_Write(0x01);
058A: MOVLW 01
058B: MOVWF 73
058C: CALL 22E
.................... I2C_Write(MAG_ROZ810);
058D: MOVLW E0
058E: MOVWF 73
058F: CALL 22E
.................... i2c_stop();
0590: BCF 28.4
0591: MOVF 28,W
0592: BSF 03.5
0593: MOVWF 07
0594: NOP
0595: BCF 03.5
0596: BSF 28.3
0597: MOVF 28,W
0598: BSF 03.5
0599: MOVWF 07
059A: BCF 03.5
059B: BTFSS 07.3
059C: GOTO 59B
059D: NOP
059E: GOTO 59F
059F: NOP
05A0: BSF 28.4
05A1: MOVF 28,W
05A2: BSF 03.5
05A3: MOVWF 07
05A4: NOP
....................
.................... Delay_ms(6);
05A5: MOVLW 06
05A6: BCF 03.5
05A7: MOVWF 65
05A8: CALL 2F5
....................
.................... i2c_start(); //nastveni Mode Register
05A9: BSF 28.4
05AA: MOVF 28,W
05AB: BSF 03.5
05AC: MOVWF 07
05AD: NOP
05AE: BCF 03.5
05AF: BSF 28.3
05B0: MOVF 28,W
05B1: BSF 03.5
05B2: MOVWF 07
05B3: NOP
05B4: BCF 03.5
05B5: BCF 07.4
05B6: BCF 28.4
05B7: MOVF 28,W
05B8: BSF 03.5
05B9: MOVWF 07
05BA: NOP
05BB: BCF 03.5
05BC: BCF 07.3
05BD: BCF 28.3
05BE: MOVF 28,W
05BF: BSF 03.5
05C0: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
05C1: MOVLW 3C
05C2: MOVWF 73
05C3: BCF 03.5
05C4: CALL 22E
.................... I2C_Write(0x02);
05C5: MOVLW 02
05C6: MOVWF 73
05C7: CALL 22E
.................... I2C_Write(0x00);
05C8: CLRF 73
05C9: CALL 22E
.................... i2c_stop();
05CA: BCF 28.4
05CB: MOVF 28,W
05CC: BSF 03.5
05CD: MOVWF 07
05CE: NOP
05CF: BCF 03.5
05D0: BSF 28.3
05D1: MOVF 28,W
05D2: BSF 03.5
05D3: MOVWF 07
05D4: BCF 03.5
05D5: BTFSS 07.3
05D6: GOTO 5D5
05D7: NOP
05D8: GOTO 5D9
05D9: NOP
05DA: BSF 28.4
05DB: MOVF 28,W
05DC: BSF 03.5
05DD: MOVWF 07
05DE: NOP
.................... Delay_ms(6);
05DF: MOVLW 06
05E0: BCF 03.5
05E1: MOVWF 65
05E2: CALL 2F5
.................... }
05E3: BSF 0A.3
05E4: BSF 0A.4
05E5: GOTO 0AB (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();
*
0D6C: BSF 28.4
0D6D: MOVF 28,W
0D6E: BSF 03.5
0D6F: MOVWF 07
0D70: NOP
0D71: BCF 03.5
0D72: BSF 28.3
0D73: MOVF 28,W
0D74: BSF 03.5
0D75: MOVWF 07
0D76: NOP
0D77: BCF 03.5
0D78: BCF 07.4
0D79: BCF 28.4
0D7A: MOVF 28,W
0D7B: BSF 03.5
0D7C: MOVWF 07
0D7D: NOP
0D7E: BCF 03.5
0D7F: BCF 07.3
0D80: BCF 28.3
0D81: MOVF 28,W
0D82: BSF 03.5
0D83: MOVWF 07
.................... I2C_Write(MAG_ADDR_W);
0D84: MOVLW 3C
0D85: MOVWF 73
0D86: BCF 0A.3
0D87: BCF 03.5
0D88: CALL 22E
0D89: BSF 0A.3
.................... I2C_write(reg);
0D8A: MOVF 72,W
0D8B: MOVWF 73
0D8C: BCF 0A.3
0D8D: CALL 22E
0D8E: BSF 0A.3
.................... i2c_stop();
0D8F: BCF 28.4
0D90: MOVF 28,W
0D91: BSF 03.5
0D92: MOVWF 07
0D93: NOP
0D94: BCF 03.5
0D95: BSF 28.3
0D96: MOVF 28,W
0D97: BSF 03.5
0D98: MOVWF 07
0D99: BCF 03.5
0D9A: BTFSS 07.3
0D9B: GOTO 59A
0D9C: NOP
0D9D: GOTO 59E
0D9E: NOP
0D9F: BSF 28.4
0DA0: MOVF 28,W
0DA1: BSF 03.5
0DA2: MOVWF 07
0DA3: NOP
.................... i2c_start();
0DA4: BCF 03.5
0DA5: BSF 28.4
0DA6: MOVF 28,W
0DA7: BSF 03.5
0DA8: MOVWF 07
0DA9: NOP
0DAA: BCF 03.5
0DAB: BSF 28.3
0DAC: MOVF 28,W
0DAD: BSF 03.5
0DAE: MOVWF 07
0DAF: NOP
0DB0: BCF 03.5
0DB1: BCF 07.4
0DB2: BCF 28.4
0DB3: MOVF 28,W
0DB4: BSF 03.5
0DB5: MOVWF 07
0DB6: NOP
0DB7: BCF 03.5
0DB8: BCF 07.3
0DB9: BCF 28.3
0DBA: MOVF 28,W
0DBB: BSF 03.5
0DBC: MOVWF 07
.................... I2C_Write(MAG_ADDR_R);
0DBD: MOVLW 3D
0DBE: MOVWF 73
0DBF: BCF 0A.3
0DC0: BCF 03.5
0DC1: CALL 22E
0DC2: BSF 0A.3
.................... reg=i2c_read(0);
0DC3: CLRF 77
0DC4: BCF 0A.3
0DC5: CALL 2B0
0DC6: BSF 0A.3
0DC7: MOVF 78,W
0DC8: MOVWF 72
.................... return reg;
0DC9: MOVF 72,W
0DCA: MOVWF 78
.................... }
0DCB: RETURN
....................
....................
.................... signed int16 mag_vypocet(unsigned int8 h, unsigned int8 l) //prepocet na 16bit cislo
.................... {
.................... signed int16 x;
.................... x = (((unsigned int16) h << 8) + l );
*
07E5: CLRF 7C
07E6: MOVF 72,W
07E7: MOVWF 7B
07E8: MOVWF 7C
07E9: CLRF 7B
07EA: MOVF 73,W
07EB: ADDWF 7B,W
07EC: MOVWF 74
07ED: MOVF 7C,W
07EE: MOVWF 75
07EF: BTFSC 03.0
07F0: INCF 75,F
.................... return x;
07F1: MOVF 74,W
07F2: MOVWF 78
07F3: MOVF 75,W
07F4: MOVWF 79
.................... }
07F5: RETURN
....................
....................
.................... signed int16 mag_readX(void) //nacteni osy x
.................... {
.................... unsigned int8 h,l;
.................... signed int16 x;
.................... h=mag_read(0x03);
*
1000: MOVLW 03
1001: MOVWF 72
1002: BCF 0A.4
1003: BSF 0A.3
1004: CALL 56C
1005: BSF 0A.4
1006: BCF 0A.3
1007: MOVF 78,W
1008: MOVWF 6E
.................... l=mag_read(0x04);
1009: MOVLW 04
100A: MOVWF 72
100B: BCF 0A.4
100C: BSF 0A.3
100D: CALL 56C
100E: BSF 0A.4
100F: BCF 0A.3
1010: MOVF 78,W
1011: MOVWF 6F
.................... x=mag_vypocet(h,l);
1012: MOVF 6E,W
1013: MOVWF 72
1014: MOVF 6F,W
1015: MOVWF 73
1016: BCF 0A.4
1017: CALL 7E5
1018: BSF 0A.4
1019: MOVF 79,W
101A: MOVWF 71
101B: MOVF 78,W
101C: MOVWF 70
.................... return x;
101D: MOVF 70,W
101E: MOVWF 78
101F: MOVF 71,W
1020: MOVWF 79
....................
.................... }
....................
....................
.................... signed int16 mag_readY(void) //nacteni osy x
.................... {
.................... unsigned int8 h,l;
.................... signed int16 x;
.................... h=mag_read(0x07);
*
1025: MOVLW 07
1026: MOVWF 72
1027: BCF 0A.4
1028: BSF 0A.3
1029: CALL 56C
102A: BSF 0A.4
102B: BCF 0A.3
102C: MOVF 78,W
102D: MOVWF 6E
.................... l=mag_read(0x08);
102E: MOVLW 08
102F: MOVWF 72
1030: BCF 0A.4
1031: BSF 0A.3
1032: CALL 56C
1033: BSF 0A.4
1034: BCF 0A.3
1035: MOVF 78,W
1036: MOVWF 6F
.................... x=mag_vypocet(h,l);
1037: MOVF 6E,W
1038: MOVWF 72
1039: MOVF 6F,W
103A: MOVWF 73
103B: BCF 0A.4
103C: CALL 7E5
103D: BSF 0A.4
103E: MOVF 79,W
103F: MOVWF 71
1040: MOVF 78,W
1041: MOVWF 70
.................... return x;
1042: MOVF 70,W
1043: MOVWF 78
1044: MOVF 71,W
1045: MOVWF 79
....................
.................... }
....................
....................
.................... signed int16 mag_readZ(void) //nacteni osy x
.................... {
.................... unsigned int8 h,l;
.................... signed int16 x;
.................... h=mag_read(0x05);
*
104A: MOVLW 05
104B: MOVWF 72
104C: BCF 0A.4
104D: BSF 0A.3
104E: CALL 56C
104F: BSF 0A.4
1050: BCF 0A.3
1051: MOVF 78,W
1052: MOVWF 6E
.................... l=mag_read(0x06);
1053: MOVLW 06
1054: MOVWF 72
1055: BCF 0A.4
1056: BSF 0A.3
1057: CALL 56C
1058: BSF 0A.4
1059: BCF 0A.3
105A: MOVF 78,W
105B: MOVWF 6F
.................... x=mag_vypocet(h,l);
105C: MOVF 6E,W
105D: MOVWF 72
105E: MOVF 6F,W
105F: MOVWF 73
1060: BCF 0A.4
1061: CALL 7E5
1062: BSF 0A.4
1063: MOVF 79,W
1064: MOVWF 71
1065: MOVF 78,W
1066: MOVWF 70
.................... return x;
1067: MOVF 70,W
1068: MOVWF 78
1069: MOVF 71,W
106A: MOVWF 79
....................
.................... }
....................
....................
....................
....................
....................
....................
.................... #define SEND_DELAY 50 // Cas mezi dvema znaky na RS232
....................
.................... char VER[4]=VERSION;
*
1827: MOVLW 30
1828: MOVWF 2B
1829: MOVLW 2E
182A: MOVWF 2C
182B: MOVLW 31
182C: MOVWF 2D
182D: CLRF 2E
....................
.................... 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 30,W
0124: BSF 03.5
0125: MOVWF 41
0126: BCF 03.5
0127: MOVF 2F,W
0128: BSF 03.5
0129: MOVWF 40
012A: CLRF 43
012B: MOVLW FF
012C: MOVWF 42
*
0141: MOVF 79,W
0142: MOVWF 41
0143: MOVF 78,W
0144: MOVWF 40
0145: BCF 03.5
0146: MOVF 01,W
0147: BSF 03.5
0148: ADDWF 40,F
0149: BTFSC 03.0
014A: INCF 41,F
014B: MOVF 41,W
014C: MOVWF 43
014D: MOVF 40,W
014E: MOVWF 42
014F: BCF 03.5
0150: CALL 038
0151: MOVF 7A,W
0152: BSF 03.5
0153: MOVWF 45
0154: MOVF 79,W
0155: MOVWF 44
0156: MOVF 78,W
0157: MOVWF 43
0158: MOVF 77,W
0159: MOVWF 42
015A: MOVLW 80
015B: MOVWF 49
015C: CLRF 48
015D: CLRF 47
015E: MOVLW 7E
015F: MOVWF 46
0160: BCF 03.5
0161: CALL 057
0162: MOVF 7A,W
0163: MOVWF 34
0164: MOVF 79,W
0165: MOVWF 33
0166: MOVF 78,W
0167: MOVWF 32
0168: MOVF 77,W
0169: MOVWF 31
.................... anemo = anemo / 2; //pocet otacek za sekundu
016A: MOVF 34,W
016B: BSF 03.5
016C: MOVWF 45
016D: BCF 03.5
016E: MOVF 33,W
016F: BSF 03.5
0170: MOVWF 44
0171: BCF 03.5
0172: MOVF 32,W
0173: BSF 03.5
0174: MOVWF 43
0175: BCF 03.5
0176: MOVF 31,W
0177: BSF 03.5
0178: MOVWF 42
0179: CLRF 49
017A: CLRF 48
017B: CLRF 47
017C: MOVLW 80
017D: MOVWF 46
017E: BCF 03.5
017F: CALL 057
0180: MOVF 7A,W
0181: MOVWF 34
0182: MOVF 79,W
0183: MOVWF 33
0184: MOVF 78,W
0185: MOVWF 32
0186: MOVF 77,W
0187: MOVWF 31
....................
.................... timer0_overflow_count=0; //nulovani
0188: CLRF 30
0189: CLRF 2F
.................... 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 2F,F
0192: BTFSC 03.2
0193: INCF 30,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();
*
1021: MOVF 79,W
1022: MOVWF 61
1023: MOVF 78,W
1024: MOVWF 60
.................... Y= mag_readY();
*
1046: MOVF 79,W
1047: MOVWF 63
1048: MOVF 78,W
1049: MOVWF 62
.................... Z= mag_readZ();
*
106B: MOVF 79,W
106C: MOVWF 65
106D: MOVF 78,W
106E: MOVWF 64
....................
.................... float a, b;
.................... a=(float)Y/X;
106F: MOVF 63,W
1070: MOVWF 73
1071: MOVF 62,W
1072: MOVWF 72
1073: BCF 0A.4
1074: BSF 0A.3
1075: CALL 5CC
1076: BSF 0A.4
1077: BCF 0A.3
1078: MOVF 77,W
1079: MOVWF 6E
107A: MOVF 78,W
107B: MOVWF 6F
107C: MOVF 79,W
107D: MOVWF 70
107E: MOVF 7A,W
107F: MOVWF 71
1080: MOVF 61,W
1081: MOVWF 73
1082: MOVF 60,W
1083: MOVWF 72
1084: BCF 0A.4
1085: BSF 0A.3
1086: CALL 5CC
1087: BSF 0A.4
1088: BCF 0A.3
1089: CLRF 27
108A: BTFSC 0B.7
108B: BSF 27.7
108C: BCF 0B.7
108D: MOVF 71,W
108E: BSF 03.5
108F: MOVWF 45
1090: MOVF 70,W
1091: MOVWF 44
1092: BCF 03.5
1093: MOVF 6F,W
1094: BSF 03.5
1095: MOVWF 43
1096: BCF 03.5
1097: MOVF 6E,W
1098: BSF 03.5
1099: MOVWF 42
109A: MOVF 7A,W
109B: MOVWF 49
109C: MOVF 79,W
109D: MOVWF 48
109E: MOVF 78,W
109F: MOVWF 47
10A0: MOVF 77,W
10A1: MOVWF 46
10A2: BCF 0A.4
10A3: BCF 03.5
10A4: CALL 057
10A5: BSF 0A.4
10A6: BTFSC 27.7
10A7: BSF 0B.7
10A8: MOVF 7A,W
10A9: MOVWF 69
10AA: MOVF 79,W
10AB: MOVWF 68
10AC: MOVF 78,W
10AD: MOVWF 67
10AE: MOVF 77,W
10AF: MOVWF 66
.................... b=atan(a);
10B0: MOVF 69,W
10B1: MOVWF 71
10B2: MOVF 68,W
10B3: MOVWF 70
10B4: MOVF 67,W
10B5: MOVWF 6F
10B6: MOVF 66,W
10B7: MOVWF 6E
*
139A: MOVF 7A,W
139B: MOVWF 6D
139C: MOVF 79,W
139D: MOVWF 6C
139E: MOVF 78,W
139F: MOVWF 6B
13A0: MOVF 77,W
13A1: MOVWF 6A
13A2: CLRF 27
13A3: BTFSC 0B.7
13A4: BSF 27.7
13A5: BCF 0B.7
.................... b = (b/3.14)*180;
13A6: MOVF 6D,W
13A7: BSF 03.5
13A8: MOVWF 45
13A9: BCF 03.5
13AA: MOVF 6C,W
13AB: BSF 03.5
13AC: MOVWF 44
13AD: BCF 03.5
13AE: MOVF 6B,W
13AF: BSF 03.5
13B0: MOVWF 43
13B1: BCF 03.5
13B2: MOVF 6A,W
13B3: BSF 03.5
13B4: MOVWF 42
13B5: MOVLW C3
13B6: MOVWF 49
13B7: MOVLW F5
13B8: MOVWF 48
13B9: MOVLW 48
13BA: MOVWF 47
13BB: MOVLW 80
13BC: MOVWF 46
13BD: BCF 0A.4
13BE: BCF 03.5
13BF: CALL 057
13C0: BSF 0A.4
13C1: BTFSC 27.7
13C2: BSF 0B.7
13C3: MOVF 77,W
13C4: MOVWF 6E
13C5: MOVF 78,W
13C6: MOVWF 6F
13C7: MOVF 79,W
13C8: MOVWF 70
13C9: MOVF 7A,W
13CA: MOVWF 71
13CB: BSF 03.5
13CC: MOVWF 2C
13CD: MOVF 70,W
13CE: MOVWF 2B
13CF: BCF 03.5
13D0: MOVF 6F,W
13D1: BSF 03.5
13D2: MOVWF 2A
13D3: BCF 03.5
13D4: MOVF 6E,W
13D5: BSF 03.5
13D6: MOVWF 29
13D7: CLRF 30
13D8: CLRF 2F
13D9: MOVLW 34
13DA: MOVWF 2E
13DB: MOVLW 86
13DC: MOVWF 2D
13DD: BCF 0A.4
13DE: BCF 03.5
13DF: CALL 76E
13E0: BSF 0A.4
13E1: MOVF 7A,W
13E2: MOVWF 6D
13E3: MOVF 79,W
13E4: MOVWF 6C
13E5: MOVF 78,W
13E6: MOVWF 6B
13E7: MOVF 77,W
13E8: MOVWF 6A
.................... b=abs(b);
13E9: MOVF 6A,W
13EA: MOVWF 77
13EB: MOVF 6B,W
13EC: MOVWF 78
13ED: MOVF 6C,W
13EE: MOVWF 79
13EF: MOVF 6D,W
13F0: MOVWF 7A
13F1: BCF 78.7
13F2: MOVF 6D,W
13F3: MOVWF 6D
13F4: MOVF 6C,W
13F5: MOVWF 6C
13F6: MOVF 78,W
13F7: MOVWF 6B
13F8: MOVF 6A,W
13F9: MOVWF 6A
....................
.................... if(X==0) //osetreni proti deleni 0
13FA: MOVF 60,F
13FB: BTFSS 03.2
13FC: GOTO 417
13FD: MOVF 61,F
13FE: BTFSS 03.2
13FF: GOTO 417
.................... {
.................... if(Y>0)
1400: BTFSC 63.7
1401: GOTO 410
1402: MOVF 63,F
1403: BTFSS 03.2
1404: GOTO 409
1405: MOVF 62,W
1406: SUBLW 00
1407: BTFSC 03.0
1408: GOTO 410
.................... {
.................... b=90;
1409: CLRF 6D
140A: CLRF 6C
140B: MOVLW 34
140C: MOVWF 6B
140D: MOVLW 85
140E: MOVWF 6A
.................... }
.................... else
140F: GOTO 416
.................... {
.................... b=270;
1410: CLRF 6D
1411: CLRF 6C
1412: MOVLW 07
1413: MOVWF 6B
1414: MOVLW 87
1415: MOVWF 6A
.................... }
.................... }
.................... else
1416: GOTO 499
.................... {
.................... if(X>0)
1417: BTFSC 61.7
1418: GOTO 470
1419: MOVF 61,F
141A: BTFSS 03.2
141B: GOTO 420
141C: MOVF 60,W
141D: SUBLW 00
141E: BTFSC 03.0
141F: GOTO 470
.................... {
.................... if(Y>=0)
1420: BTFSC 63.7
1421: GOTO 449
.................... {
.................... b=180+b;
1422: BCF 03.1
1423: BSF 03.5
1424: CLRF 2C
1425: CLRF 2B
1426: MOVLW 34
1427: MOVWF 2A
1428: MOVLW 86
1429: MOVWF 29
142A: BCF 03.5
142B: MOVF 6D,W
142C: BSF 03.5
142D: MOVWF 30
142E: BCF 03.5
142F: MOVF 6C,W
1430: BSF 03.5
1431: MOVWF 2F
1432: BCF 03.5
1433: MOVF 6B,W
1434: BSF 03.5
1435: MOVWF 2E
1436: BCF 03.5
1437: MOVF 6A,W
1438: BSF 03.5
1439: MOVWF 2D
143A: BCF 0A.4
143B: BSF 0A.3
143C: BCF 03.5
143D: CALL 000
143E: BSF 0A.4
143F: BCF 0A.3
1440: MOVF 7A,W
1441: MOVWF 6D
1442: MOVF 79,W
1443: MOVWF 6C
1444: MOVF 78,W
1445: MOVWF 6B
1446: MOVF 77,W
1447: MOVWF 6A
....................
.................... }
.................... else
1448: GOTO 46F
.................... {
.................... b=180-b;
1449: BSF 03.1
144A: BSF 03.5
144B: CLRF 2C
144C: CLRF 2B
144D: MOVLW 34
144E: MOVWF 2A
144F: MOVLW 86
1450: MOVWF 29
1451: BCF 03.5
1452: MOVF 6D,W
1453: BSF 03.5
1454: MOVWF 30
1455: BCF 03.5
1456: MOVF 6C,W
1457: BSF 03.5
1458: MOVWF 2F
1459: BCF 03.5
145A: MOVF 6B,W
145B: BSF 03.5
145C: MOVWF 2E
145D: BCF 03.5
145E: MOVF 6A,W
145F: BSF 03.5
1460: MOVWF 2D
1461: BCF 0A.4
1462: BSF 0A.3
1463: BCF 03.5
1464: CALL 000
1465: BSF 0A.4
1466: BCF 0A.3
1467: MOVF 7A,W
1468: MOVWF 6D
1469: MOVF 79,W
146A: MOVWF 6C
146B: MOVF 78,W
146C: MOVWF 6B
146D: MOVF 77,W
146E: MOVWF 6A
....................
.................... }
.................... }
.................... else
146F: GOTO 499
.................... {
.................... if(Y>=0)
1470: BTFSC 63.7
1471: GOTO 499
.................... {
.................... b=360-b;
1472: BSF 03.1
1473: BSF 03.5
1474: CLRF 2C
1475: CLRF 2B
1476: MOVLW 34
1477: MOVWF 2A
1478: MOVLW 87
1479: MOVWF 29
147A: BCF 03.5
147B: MOVF 6D,W
147C: BSF 03.5
147D: MOVWF 30
147E: BCF 03.5
147F: MOVF 6C,W
1480: BSF 03.5
1481: MOVWF 2F
1482: BCF 03.5
1483: MOVF 6B,W
1484: BSF 03.5
1485: MOVWF 2E
1486: BCF 03.5
1487: MOVF 6A,W
1488: BSF 03.5
1489: MOVWF 2D
148A: BCF 0A.4
148B: BSF 0A.3
148C: BCF 03.5
148D: CALL 000
148E: BSF 0A.4
148F: BCF 0A.3
1490: MOVF 7A,W
1491: MOVWF 6D
1492: MOVF 79,W
1493: MOVWF 6C
1494: MOVF 78,W
1495: MOVWF 6B
1496: MOVF 77,W
1497: MOVWF 6A
....................
.................... }
.................... else
1498: GOTO 499
.................... {
.................... b=b;
....................
.................... }
.................... }
....................
.................... }
....................
.................... return b;
1499: MOVF 6A,W
149A: MOVWF 77
149B: MOVF 6B,W
149C: MOVWF 78
149D: MOVF 6C,W
149E: MOVWF 79
149F: MOVF 6D,W
14A0: MOVWF 7A
....................
.................... }
14A1: BSF 0A.3
14A2: BSF 0A.4
14A3: GOTO 111 (RETURN)
....................
....................
....................
....................
....................
....................
.................... void uvitani(void) // uvodni zprava
.................... {
.................... printf("\r\n\r\n# Meteorologicka stanice %s (C) 2013 www.mlab.cz \r\n",VERSION);
*
04AB: MOVLW 98
04AC: BSF 03.6
04AD: MOVWF 0D
04AE: MOVLW 01
04AF: MOVWF 0F
04B0: BCF 03.0
04B1: MOVLW 1D
04B2: BCF 03.6
04B3: MOVWF 60
04B4: CALL 3F5
04B5: MOVLW B4
04B6: BSF 03.6
04B7: MOVWF 0D
04B8: MOVLW 01
04B9: MOVWF 0F
04BA: BCF 03.6
04BB: CALL 444
04BC: MOVLW A7
04BD: BSF 03.6
04BE: MOVWF 0D
04BF: MOVLW 01
04C0: MOVWF 0F
04C1: BSF 03.0
04C2: MOVLW 18
04C3: BCF 03.6
04C4: MOVWF 60
04C5: CALL 3F5
.................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message
04C6: MOVLW B6
04C7: BSF 03.6
04C8: MOVWF 0D
04C9: MOVLW 01
04CA: MOVWF 0F
04CB: BCF 03.0
04CC: MOVLW 0B
04CD: BCF 03.6
04CE: MOVWF 60
04CF: CALL 3F5
04D0: MOVLW C9
04D1: BSF 03.6
04D2: MOVWF 0D
04D3: MOVLW 01
04D4: MOVWF 0F
04D5: BCF 03.6
04D6: CALL 444
04D7: MOVLW BC
04D8: BSF 03.6
04D9: MOVWF 0D
04DA: MOVLW 01
04DB: MOVWF 0F
04DC: BSF 03.0
04DD: MOVLW 12
04DE: BCF 03.6
04DF: MOVWF 60
04E0: CALL 3F5
04E1: MOVLW CF
04E2: BSF 03.6
04E3: MOVWF 0D
04E4: MOVLW 01
04E5: MOVWF 0F
04E6: BCF 03.6
04E7: CALL 444
04E8: MOVLW 20
04E9: MOVWF 64
04EA: CALL 3D1
04EB: MOVLW 0D
04EC: MOVWF 64
04ED: CALL 3D1
04EE: MOVLW 0A
04EF: MOVWF 64
04F0: CALL 3D1
.................... printf("# ver poradi ");
04F1: MOVLW D4
04F2: BSF 03.6
04F3: MOVWF 0D
04F4: MOVLW 01
04F5: MOVWF 0F
04F6: BCF 03.6
04F7: CALL 444
.................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] ");
04F8: MOVLW DB
04F9: BSF 03.6
04FA: MOVWF 0D
04FB: MOVLW 01
04FC: MOVWF 0F
.................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n");
*
051D: MOVLW 05
051E: MOVWF 0D
051F: MOVLW 02
0520: MOVWF 0F
0521: MOVLW 10
0522: BCF 03.6
0523: MOVWF 60
0524: CALL 48A
0525: MOVLW 25
0526: MOVWF 64
0527: CALL 3D1
0528: MOVLW 17
0529: BSF 03.6
052A: MOVWF 0D
052B: MOVLW 02
052C: MOVWF 0F
052D: MOVLW 16
052E: BCF 03.6
052F: MOVWF 60
0530: CALL 48A
.................... }
0531: BSF 0A.3
0532: BSF 0A.4
0533: GOTO 0A6 (RETURN)
....................
.................... void main()
.................... {
*
1800: CLRF 04
1801: BCF 03.7
1802: MOVLW 1F
1803: ANDWF 03,F
1804: MOVLW 71
1805: BSF 03.5
1806: MOVWF 0F
1807: MOVF 0F,W
1808: BCF 03.5
1809: BCF 28.7
180A: MOVF 28,W
180B: BSF 03.5
180C: MOVWF 07
180D: BCF 03.5
180E: BSF 07.7
180F: CLRF 34
1810: CLRF 33
1811: CLRF 32
1812: CLRF 31
1813: BSF 03.5
1814: BSF 03.6
1815: MOVF 09,W
1816: ANDLW C0
1817: MOVWF 09
1818: BCF 03.6
1819: BCF 1F.4
181A: BCF 1F.5
181B: MOVLW 00
181C: BSF 03.6
181D: MOVWF 08
181E: BCF 03.5
181F: CLRF 07
1820: CLRF 08
1821: CLRF 09
.................... setup_wdt(WDT_2304MS); //nastavení resetu pokud nedojde v cas k jeho vynulovani
*
1830: MOVLW 09
1831: BSF 03.6
1832: MOVWF 05
1833: MOVLW 0F
1834: MOVWF 77
1835: BCF 03.6
1836: CLRF 01
1837: MOVLW 81
1838: MOVWF 04
1839: BCF 03.7
183A: MOVF 00,W
183B: ANDLW F0
183C: IORLW 07
183D: MOVWF 00
183E: CLRWDT
183F: MOVF 00,W
1840: ANDLW F7
1841: BTFSC 77.3
1842: ANDLW F0
1843: IORWF 77,W
1844: MOVWF 00
.................... restart_wdt(); //---WDT
1845: CLRWDT
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
1846: BSF 03.5
1847: BSF 03.6
1848: MOVF 09,W
1849: ANDLW C0
184A: MOVWF 09
184B: BCF 03.6
184C: BCF 1F.4
184D: BCF 1F.5
184E: MOVLW 00
184F: BSF 03.6
1850: MOVWF 08
.................... setup_adc(ADC_CLOCK_DIV_2);
1851: BCF 03.5
1852: BCF 03.6
1853: BCF 1F.6
1854: BCF 1F.7
1855: BSF 03.5
1856: BCF 1F.7
1857: BCF 03.5
1858: BSF 1F.0
.................... setup_spi(SPI_SS_DISABLED);
1859: BCF 14.5
185A: BCF 28.5
185B: MOVF 28,W
185C: BSF 03.5
185D: MOVWF 07
185E: BCF 03.5
185F: BSF 28.4
1860: MOVF 28,W
1861: BSF 03.5
1862: MOVWF 07
1863: BCF 03.5
1864: BCF 28.3
1865: MOVF 28,W
1866: BSF 03.5
1867: MOVWF 07
1868: MOVLW 01
1869: BCF 03.5
186A: MOVWF 14
186B: MOVLW 00
186C: BSF 03.5
186D: MOVWF 14
.................... setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
186E: MOVF 01,W
186F: ANDLW C7
1870: IORLW 28
1871: MOVWF 01
.................... setup_timer_1(T1_EXTERNAL|T1_DIV_BY_1|T1_CLK_OUT);
1872: MOVLW 0F
1873: BCF 03.5
1874: MOVWF 10
.................... setup_timer_2(T2_DISABLED,0,1);
1875: MOVLW 00
1876: MOVWF 78
1877: MOVWF 12
1878: MOVLW 00
1879: BSF 03.5
187A: MOVWF 12
.................... setup_ccp1(CCP_OFF);
187B: BCF 03.5
187C: BSF 28.2
187D: MOVF 28,W
187E: BSF 03.5
187F: MOVWF 07
1880: BCF 03.5
1881: CLRF 17
1882: BSF 03.5
1883: CLRF 1B
1884: CLRF 1C
1885: MOVLW 01
1886: MOVWF 1D
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
1887: BCF 03.5
1888: BSF 03.6
1889: CLRF 07
188A: CLRF 08
188B: 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 int16 poradi=0; //cislo vzorku
.................... unsigned int8 sht_config;
188C: BCF 03.6
188D: CLRF 50
188E: CLRF 4F
....................
.................... //nastaveni SHT25
.................... SHT25_soft_reset();
188F: BCF 0A.4
1890: BCF 0A.3
1891: GOTO 278
1892: BSF 0A.4
1893: BSF 0A.3
.................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; //vypnuti topeni v SHT25
1894: CLRF 51
.................... SHT25_setup(sht_config);
1895: MOVF 51,W
1896: MOVWF 60
1897: BCF 0A.4
1898: BCF 0A.3
1899: GOTO 309
189A: BSF 0A.4
189B: BSF 0A.3
....................
.................... //nastavení pøeruení pro anemometr
.................... enable_interrupts(INT_TIMER1);
189C: BSF 03.5
189D: BSF 0C.0
.................... enable_interrupts(INT_TIMER0);
189E: BCF 03.5
189F: BSF 0B.5
.................... enable_interrupts(GLOBAL);
18A0: MOVLW C0
18A1: IORWF 0B,F
.................... restart_wdt(); //---WDT
18A2: CLRWDT
....................
.................... uvitani();
18A3: BCF 0A.4
18A4: BCF 0A.3
18A5: GOTO 4AB
18A6: BSF 0A.4
18A7: BSF 0A.3
.................... set_mag(); //nastaveni magnetometru pro smer vetru
18A8: BCF 0A.4
18A9: BCF 0A.3
18AA: GOTO 534
18AB: BSF 0A.4
18AC: BSF 0A.3
....................
.................... // vynulovani promenych pro anemometr
.................... set_timer0(0);
18AD: CLRF 01
.................... set_timer1(0);
18AE: CLRF 0F
18AF: CLRF 0E
.................... timer0_overflow_count=0;
18B0: CLRF 30
18B1: CLRF 2F
.................... anemo=0;
18B2: CLRF 34
18B3: CLRF 33
18B4: CLRF 32
18B5: CLRF 31
....................
.................... restart_wdt(); //---WDT
18B6: CLRWDT
....................
.................... while(TRUE)
.................... {
.................... char output[12]; // vystupni zasobnik
.................... int8 j; // ukazatel na retezec
.................... int8 check=0; // Checksum is calculated between '$' and '*'
18B7: CLRF 5F
....................
....................
.................... mpl3115_setP(); //nastaveni pro tlak a teplotu
18B8: BCF 0A.4
18B9: BCF 0A.3
18BA: GOTO 5E6
18BB: BSF 0A.4
18BC: BSF 0A.3
.................... delay_ms (500);
18BD: MOVLW 02
18BE: MOVWF 60
18BF: MOVLW FA
18C0: MOVWF 65
18C1: BCF 0A.4
18C2: BCF 0A.3
18C3: CALL 2F5
18C4: BSF 0A.4
18C5: BSF 0A.3
18C6: DECFSZ 60,F
18C7: GOTO 0BF
.................... altimet_t=mpl3115_T();
18C8: BCF 0A.4
18C9: BCF 0A.3
18CA: GOTO 6EB
18CB: BSF 0A.4
18CC: BSF 0A.3
18CD: MOVF 7A,W
18CE: MOVWF 3A
18CF: MOVF 79,W
18D0: MOVWF 39
18D1: MOVF 78,W
18D2: MOVWF 38
18D3: MOVF 77,W
18D4: MOVWF 37
.................... altimet_p=mpl3115_P();
18D5: BCF 0A.4
18D6: GOTO 146
18D7: BSF 0A.4
18D8: MOVF 7A,W
18D9: MOVWF 3E
18DA: MOVF 79,W
18DB: MOVWF 3D
18DC: MOVF 78,W
18DD: MOVWF 3C
18DE: MOVF 77,W
18DF: MOVWF 3B
....................
.................... mpl3115_setA(); //nastaveni pro vysku a teplotu
18E0: BCF 0A.4
18E1: GOTO 220
18E2: BSF 0A.4
.................... delay_ms (500);
18E3: MOVLW 02
18E4: MOVWF 60
18E5: MOVLW FA
18E6: MOVWF 65
18E7: BCF 0A.4
18E8: BCF 0A.3
18E9: CALL 2F5
18EA: BSF 0A.4
18EB: BSF 0A.3
18EC: DECFSZ 60,F
18ED: GOTO 0E5
.................... altimet_a=mpl3115_A();
18EE: BCF 0A.4
18EF: GOTO 2DD
18F0: BSF 0A.4
18F1: MOVF 7A,W
18F2: MOVWF 42
18F3: MOVF 79,W
18F4: MOVWF 41
18F5: MOVF 78,W
18F6: MOVWF 40
18F7: MOVF 77,W
18F8: MOVWF 3F
....................
.................... sht25_t=SHT25_get_temp(); //mereni hodnot z SHT25
18F9: BCF 0A.4
18FA: GOTO 385
18FB: BSF 0A.4
18FC: MOVF 7A,W
18FD: MOVWF 46
18FE: MOVF 79,W
18FF: MOVWF 45
1900: MOVF 78,W
1901: MOVWF 44
1902: MOVF 77,W
1903: MOVWF 43
.................... sht25_h=SHT25_get_hum();
1904: BCF 0A.4
1905: GOTO 485
1906: BSF 0A.4
1907: MOVF 7A,W
1908: MOVWF 4A
1909: MOVF 79,W
190A: MOVWF 49
190B: MOVF 78,W
190C: MOVWF 48
190D: MOVF 77,W
190E: MOVWF 47
....................
.................... smer_v=azimut(); //vrati azimut aktualniho smeru vetru
190F: BCF 0A.3
1910: GOTO 000
1911: BSF 0A.3
1912: MOVF 7A,W
1913: MOVWF 4E
1914: MOVF 79,W
1915: MOVWF 4D
1916: MOVF 78,W
1917: MOVWF 4C
1918: MOVF 77,W
1919: MOVWF 4B
....................
....................
.................... delay_us(SEND_DELAY);
191A: MOVLW 21
191B: MOVWF 77
191C: DECFSZ 77,F
191D: GOTO 11C
.................... putc('$');
191E: MOVLW 24
191F: MOVWF 64
1920: BCF 0A.4
1921: BCF 0A.3
1922: CALL 3D1
1923: BSF 0A.4
1924: BSF 0A.3
.................... delay_us(SEND_DELAY);
1925: MOVLW 21
1926: MOVWF 77
1927: DECFSZ 77,F
1928: GOTO 127
.................... sprintf(output,"MST%s \0",VER);
1929: CLRF 36
192A: MOVLW 52
192B: MOVWF 35
192C: MOVLW 4D
192D: MOVWF 6D
192E: BCF 0A.4
192F: CALL 632
1930: BSF 0A.4
1931: MOVLW 53
1932: MOVWF 6D
1933: BCF 0A.4
1934: CALL 632
1935: BSF 0A.4
1936: MOVLW 54
1937: MOVWF 6D
1938: BCF 0A.4
1939: CALL 632
193A: BSF 0A.4
193B: MOVLW 2B
193C: MOVWF 04
193D: BCF 03.7
193E: BCF 0A.4
193F: GOTO 63F
1940: BSF 0A.4
1941: MOVLW 20
1942: MOVWF 6D
1943: BCF 0A.4
1944: CALL 632
1945: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1946: CLRF 5E
1947: MOVLW 52
1948: ADDWF 5E,W
1949: MOVWF 04
194A: BCF 03.7
194B: MOVF 00,F
194C: BTFSC 03.2
194D: GOTO 167
194E: MOVLW 21
194F: MOVWF 77
1950: DECFSZ 77,F
1951: GOTO 150
1952: MOVLW 52
1953: ADDWF 5E,W
1954: MOVWF 04
1955: BCF 03.7
1956: MOVF 00,W
1957: MOVWF 60
1958: MOVF 60,W
1959: MOVWF 64
195A: BCF 0A.4
195B: BCF 0A.3
195C: CALL 3D1
195D: BSF 0A.4
195E: BSF 0A.3
195F: MOVF 5E,W
1960: INCF 5E,F
1961: ADDLW 52
1962: MOVWF 04
1963: BCF 03.7
1964: MOVF 00,W
1965: XORWF 5F,F
1966: GOTO 147
.................... sprintf(output,"%4.0Lu \0", poradi);
1967: CLRF 36
1968: MOVLW 52
1969: MOVWF 35
196A: MOVLW 01
196B: MOVWF 04
196C: MOVF 50,W
196D: MOVWF 61
196E: MOVF 4F,W
196F: MOVWF 60
1970: BCF 0A.4
1971: GOTO 657
1972: BSF 0A.4
1973: MOVLW 20
1974: MOVWF 6D
1975: BCF 0A.4
1976: CALL 632
1977: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1978: CLRF 5E
1979: MOVLW 52
197A: ADDWF 5E,W
197B: MOVWF 04
197C: BCF 03.7
197D: MOVF 00,F
197E: BTFSC 03.2
197F: GOTO 199
1980: MOVLW 21
1981: MOVWF 77
1982: DECFSZ 77,F
1983: GOTO 182
1984: MOVLW 52
1985: ADDWF 5E,W
1986: MOVWF 04
1987: BCF 03.7
1988: MOVF 00,W
1989: MOVWF 60
198A: MOVF 60,W
198B: MOVWF 64
198C: BCF 0A.4
198D: BCF 0A.3
198E: CALL 3D1
198F: BSF 0A.4
1990: BSF 0A.3
1991: MOVF 5E,W
1992: INCF 5E,F
1993: ADDLW 52
1994: MOVWF 04
1995: BCF 03.7
1996: MOVF 00,W
1997: XORWF 5F,F
1998: GOTO 179
.................... sprintf(output,"%6.2f \0", altimet_t );
1999: CLRF 36
199A: MOVLW 52
199B: MOVWF 35
199C: MOVLW 05
199D: MOVWF 04
199E: MOVF 3A,W
199F: MOVWF 63
19A0: MOVF 39,W
19A1: MOVWF 62
19A2: MOVF 38,W
19A3: MOVWF 61
19A4: MOVF 37,W
19A5: MOVWF 60
19A6: MOVLW 02
19A7: MOVWF 64
19A8: BCF 0A.4
19A9: CALL 702
19AA: BSF 0A.4
19AB: MOVLW 20
19AC: MOVWF 6D
19AD: BCF 0A.4
19AE: CALL 632
19AF: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
19B0: CLRF 5E
19B1: MOVLW 52
19B2: ADDWF 5E,W
19B3: MOVWF 04
19B4: BCF 03.7
19B5: MOVF 00,F
19B6: BTFSC 03.2
19B7: GOTO 1D1
19B8: MOVLW 21
19B9: MOVWF 77
19BA: DECFSZ 77,F
19BB: GOTO 1BA
19BC: MOVLW 52
19BD: ADDWF 5E,W
19BE: MOVWF 04
19BF: BCF 03.7
19C0: MOVF 00,W
19C1: MOVWF 60
19C2: MOVF 60,W
19C3: MOVWF 64
19C4: BCF 0A.4
19C5: BCF 0A.3
19C6: CALL 3D1
19C7: BSF 0A.4
19C8: BSF 0A.3
19C9: MOVF 5E,W
19CA: INCF 5E,F
19CB: ADDLW 52
19CC: MOVWF 04
19CD: BCF 03.7
19CE: MOVF 00,W
19CF: XORWF 5F,F
19D0: GOTO 1B1
.................... sprintf(output,"%7.2f \0", altimet_a);
19D1: CLRF 36
19D2: MOVLW 52
19D3: MOVWF 35
19D4: MOVLW 06
19D5: MOVWF 04
19D6: MOVF 42,W
19D7: MOVWF 63
19D8: MOVF 41,W
19D9: MOVWF 62
19DA: MOVF 40,W
19DB: MOVWF 61
19DC: MOVF 3F,W
19DD: MOVWF 60
19DE: MOVLW 02
19DF: MOVWF 64
19E0: BCF 0A.4
19E1: CALL 702
19E2: BSF 0A.4
19E3: MOVLW 20
19E4: MOVWF 6D
19E5: BCF 0A.4
19E6: CALL 632
19E7: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
19E8: CLRF 5E
19E9: MOVLW 52
19EA: ADDWF 5E,W
19EB: MOVWF 04
19EC: BCF 03.7
19ED: MOVF 00,F
19EE: BTFSC 03.2
19EF: GOTO 209
19F0: MOVLW 21
19F1: MOVWF 77
19F2: DECFSZ 77,F
19F3: GOTO 1F2
19F4: MOVLW 52
19F5: ADDWF 5E,W
19F6: MOVWF 04
19F7: BCF 03.7
19F8: MOVF 00,W
19F9: MOVWF 60
19FA: MOVF 60,W
19FB: MOVWF 64
19FC: BCF 0A.4
19FD: BCF 0A.3
19FE: CALL 3D1
19FF: BSF 0A.4
1A00: BSF 0A.3
1A01: MOVF 5E,W
1A02: INCF 5E,F
1A03: ADDLW 52
1A04: MOVWF 04
1A05: BCF 03.7
1A06: MOVF 00,W
1A07: XORWF 5F,F
1A08: GOTO 1E9
.................... sprintf(output,"%9.2f \0", altimet_p);
1A09: CLRF 36
1A0A: MOVLW 52
1A0B: MOVWF 35
1A0C: MOVLW 08
1A0D: MOVWF 04
1A0E: MOVF 3E,W
1A0F: MOVWF 63
1A10: MOVF 3D,W
1A11: MOVWF 62
1A12: MOVF 3C,W
1A13: MOVWF 61
1A14: MOVF 3B,W
1A15: MOVWF 60
1A16: MOVLW 02
1A17: MOVWF 64
1A18: BCF 0A.4
1A19: CALL 702
1A1A: BSF 0A.4
1A1B: MOVLW 20
1A1C: MOVWF 6D
1A1D: BCF 0A.4
1A1E: CALL 632
1A1F: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1A20: CLRF 5E
1A21: MOVLW 52
1A22: ADDWF 5E,W
1A23: MOVWF 04
1A24: BCF 03.7
1A25: MOVF 00,F
1A26: BTFSC 03.2
1A27: GOTO 241
1A28: MOVLW 21
1A29: MOVWF 77
1A2A: DECFSZ 77,F
1A2B: GOTO 22A
1A2C: MOVLW 52
1A2D: ADDWF 5E,W
1A2E: MOVWF 04
1A2F: BCF 03.7
1A30: MOVF 00,W
1A31: MOVWF 60
1A32: MOVF 60,W
1A33: MOVWF 64
1A34: BCF 0A.4
1A35: BCF 0A.3
1A36: CALL 3D1
1A37: BSF 0A.4
1A38: BSF 0A.3
1A39: MOVF 5E,W
1A3A: INCF 5E,F
1A3B: ADDLW 52
1A3C: MOVWF 04
1A3D: BCF 03.7
1A3E: MOVF 00,W
1A3F: XORWF 5F,F
1A40: GOTO 221
.................... sprintf(output,"%6.2f \0", sht25_t);
1A41: CLRF 36
1A42: MOVLW 52
1A43: MOVWF 35
1A44: MOVLW 05
1A45: MOVWF 04
1A46: MOVF 46,W
1A47: MOVWF 63
1A48: MOVF 45,W
1A49: MOVWF 62
1A4A: MOVF 44,W
1A4B: MOVWF 61
1A4C: MOVF 43,W
1A4D: MOVWF 60
1A4E: MOVLW 02
1A4F: MOVWF 64
1A50: BCF 0A.4
1A51: CALL 702
1A52: BSF 0A.4
1A53: MOVLW 20
1A54: MOVWF 6D
1A55: BCF 0A.4
1A56: CALL 632
1A57: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1A58: CLRF 5E
1A59: MOVLW 52
1A5A: ADDWF 5E,W
1A5B: MOVWF 04
1A5C: BCF 03.7
1A5D: MOVF 00,F
1A5E: BTFSC 03.2
1A5F: GOTO 279
1A60: MOVLW 21
1A61: MOVWF 77
1A62: DECFSZ 77,F
1A63: GOTO 262
1A64: MOVLW 52
1A65: ADDWF 5E,W
1A66: MOVWF 04
1A67: BCF 03.7
1A68: MOVF 00,W
1A69: MOVWF 60
1A6A: MOVF 60,W
1A6B: MOVWF 64
1A6C: BCF 0A.4
1A6D: BCF 0A.3
1A6E: CALL 3D1
1A6F: BSF 0A.4
1A70: BSF 0A.3
1A71: MOVF 5E,W
1A72: INCF 5E,F
1A73: ADDLW 52
1A74: MOVWF 04
1A75: BCF 03.7
1A76: MOVF 00,W
1A77: XORWF 5F,F
1A78: GOTO 259
.................... sprintf(output,"%6.2f \0", sht25_h);
1A79: CLRF 36
1A7A: MOVLW 52
1A7B: MOVWF 35
1A7C: MOVLW 05
1A7D: MOVWF 04
1A7E: MOVF 4A,W
1A7F: MOVWF 63
1A80: MOVF 49,W
1A81: MOVWF 62
1A82: MOVF 48,W
1A83: MOVWF 61
1A84: MOVF 47,W
1A85: MOVWF 60
1A86: MOVLW 02
1A87: MOVWF 64
1A88: BCF 0A.4
1A89: CALL 702
1A8A: BSF 0A.4
1A8B: MOVLW 20
1A8C: MOVWF 6D
1A8D: BCF 0A.4
1A8E: CALL 632
1A8F: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1A90: CLRF 5E
1A91: MOVLW 52
1A92: ADDWF 5E,W
1A93: MOVWF 04
1A94: BCF 03.7
1A95: MOVF 00,F
1A96: BTFSC 03.2
1A97: GOTO 2B1
1A98: MOVLW 21
1A99: MOVWF 77
1A9A: DECFSZ 77,F
1A9B: GOTO 29A
1A9C: MOVLW 52
1A9D: ADDWF 5E,W
1A9E: MOVWF 04
1A9F: BCF 03.7
1AA0: MOVF 00,W
1AA1: MOVWF 60
1AA2: MOVF 60,W
1AA3: MOVWF 64
1AA4: BCF 0A.4
1AA5: BCF 0A.3
1AA6: CALL 3D1
1AA7: BSF 0A.4
1AA8: BSF 0A.3
1AA9: MOVF 5E,W
1AAA: INCF 5E,F
1AAB: ADDLW 52
1AAC: MOVWF 04
1AAD: BCF 03.7
1AAE: MOVF 00,W
1AAF: XORWF 5F,F
1AB0: GOTO 291
.................... sprintf(output,"%6.2f \0", smer_v);
1AB1: CLRF 36
1AB2: MOVLW 52
1AB3: MOVWF 35
1AB4: MOVLW 05
1AB5: MOVWF 04
1AB6: MOVF 4E,W
1AB7: MOVWF 63
1AB8: MOVF 4D,W
1AB9: MOVWF 62
1ABA: MOVF 4C,W
1ABB: MOVWF 61
1ABC: MOVF 4B,W
1ABD: MOVWF 60
1ABE: MOVLW 02
1ABF: MOVWF 64
1AC0: BCF 0A.4
1AC1: CALL 702
1AC2: BSF 0A.4
1AC3: MOVLW 20
1AC4: MOVWF 6D
1AC5: BCF 0A.4
1AC6: CALL 632
1AC7: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1AC8: CLRF 5E
1AC9: MOVLW 52
1ACA: ADDWF 5E,W
1ACB: MOVWF 04
1ACC: BCF 03.7
1ACD: MOVF 00,F
1ACE: BTFSC 03.2
1ACF: GOTO 2E9
1AD0: MOVLW 21
1AD1: MOVWF 77
1AD2: DECFSZ 77,F
1AD3: GOTO 2D2
1AD4: MOVLW 52
1AD5: ADDWF 5E,W
1AD6: MOVWF 04
1AD7: BCF 03.7
1AD8: MOVF 00,W
1AD9: MOVWF 60
1ADA: MOVF 60,W
1ADB: MOVWF 64
1ADC: BCF 0A.4
1ADD: BCF 0A.3
1ADE: CALL 3D1
1ADF: BSF 0A.4
1AE0: BSF 0A.3
1AE1: MOVF 5E,W
1AE2: INCF 5E,F
1AE3: ADDLW 52
1AE4: MOVWF 04
1AE5: BCF 03.7
1AE6: MOVF 00,W
1AE7: XORWF 5F,F
1AE8: GOTO 2C9
.................... sprintf(output,"%5.2f \0", anemo);
1AE9: CLRF 36
1AEA: MOVLW 52
1AEB: MOVWF 35
1AEC: MOVLW 04
1AED: MOVWF 04
1AEE: MOVF 34,W
1AEF: MOVWF 63
1AF0: MOVF 33,W
1AF1: MOVWF 62
1AF2: MOVF 32,W
1AF3: MOVWF 61
1AF4: MOVF 31,W
1AF5: MOVWF 60
1AF6: MOVLW 02
1AF7: MOVWF 64
1AF8: BCF 0A.4
1AF9: CALL 702
1AFA: BSF 0A.4
1AFB: MOVLW 20
1AFC: MOVWF 6D
1AFD: BCF 0A.4
1AFE: CALL 632
1AFF: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
1B00: CLRF 5E
1B01: MOVLW 52
1B02: ADDWF 5E,W
1B03: MOVWF 04
1B04: BCF 03.7
1B05: MOVF 00,F
1B06: BTFSC 03.2
1B07: GOTO 321
1B08: MOVLW 21
1B09: MOVWF 77
1B0A: DECFSZ 77,F
1B0B: GOTO 30A
1B0C: MOVLW 52
1B0D: ADDWF 5E,W
1B0E: MOVWF 04
1B0F: BCF 03.7
1B10: MOVF 00,W
1B11: MOVWF 60
1B12: MOVF 60,W
1B13: MOVWF 64
1B14: BCF 0A.4
1B15: BCF 0A.3
1B16: CALL 3D1
1B17: BSF 0A.4
1B18: BSF 0A.3
1B19: MOVF 5E,W
1B1A: INCF 5E,F
1B1B: ADDLW 52
1B1C: MOVWF 04
1B1D: BCF 03.7
1B1E: MOVF 00,W
1B1F: XORWF 5F,F
1B20: GOTO 301
.................... sprintf(output,"*%X\r\n\0", check);
1B21: CLRF 36
1B22: MOVLW 52
1B23: MOVWF 35
1B24: MOVLW 2A
1B25: MOVWF 6D
1B26: BCF 0A.4
1B27: CALL 632
1B28: BSF 0A.4
1B29: MOVF 5F,W
1B2A: MOVWF 60
1B2B: MOVLW 37
1B2C: MOVWF 61
1B2D: BCF 0A.3
1B2E: GOTO 4A4
1B2F: BSF 0A.3
1B30: MOVLW 0D
1B31: MOVWF 6D
1B32: BCF 0A.4
1B33: CALL 632
1B34: BSF 0A.4
1B35: MOVLW 0A
1B36: MOVWF 6D
1B37: BCF 0A.4
1B38: CALL 632
1B39: BSF 0A.4
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); }
1B3A: CLRF 5E
1B3B: MOVLW 52
1B3C: ADDWF 5E,W
1B3D: MOVWF 04
1B3E: BCF 03.7
1B3F: MOVF 00,F
1B40: BTFSC 03.2
1B41: GOTO 355
1B42: MOVLW 21
1B43: MOVWF 77
1B44: DECFSZ 77,F
1B45: GOTO 344
1B46: MOVF 5E,W
1B47: INCF 5E,F
1B48: ADDLW 52
1B49: MOVWF 04
1B4A: BCF 03.7
1B4B: MOVF 00,W
1B4C: MOVWF 60
1B4D: MOVF 60,W
1B4E: MOVWF 64
1B4F: BCF 0A.4
1B50: BCF 0A.3
1B51: CALL 3D1
1B52: BSF 0A.4
1B53: BSF 0A.3
1B54: GOTO 33B
.................... delay_us(SEND_DELAY);
1B55: MOVLW 21
1B56: MOVWF 77
1B57: DECFSZ 77,F
1B58: GOTO 357
....................
.................... poradi++;
1B59: INCF 4F,F
1B5A: BTFSC 03.2
1B5B: INCF 50,F
.................... restart_wdt();
1B5C: CLRWDT
.................... }
1B5D: GOTO 0B7
....................
.................... }
....................
....................
....................
1B5E: SLEEP
Configuration Fuses:
Word 1: 2CFD INTRC WDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40