CCS PCM C Compiler, Version 4.106, 47914 23-4-13 11:23
Filename: C:\Users\Honza\Documents\pic\I2C_akcelerometr\main.lst
ROM used: 4183 words (51%)
Largest free fragment is 2048
RAM used: 10 (3%) at main() level
70 (19%) worst case
Stack: 2 locations
*
0000: MOVLW 10
0001: MOVWF 0A
0002: GOTO 000
0003: NOP
.................... //For AKCE
.................... //ADRESA pro èteni 0x39
.................... //pro zápis 0x38
....................
....................
....................
.................... #include "C:\Users\Honza\Documents\pic\I2C_akcelerometr\main.h"
.................... #include <16F887.h>
.................... //////// Standard Header file for the PIC16F887 device ////////////////
.................... #device PIC16F887
.................... #list
....................
.................... #device adc=8
....................
.................... #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)
*
075E: MOVLW 3D
075F: MOVWF 04
0760: BCF 03.7
0761: MOVF 00,W
0762: BTFSC 03.2
0763: GOTO 771
0764: MOVLW 02
0765: MOVWF 78
0766: CLRF 77
0767: DECFSZ 77,F
0768: GOTO 767
0769: DECFSZ 78,F
076A: GOTO 766
076B: MOVLW 97
076C: MOVWF 77
076D: DECFSZ 77,F
076E: GOTO 76D
076F: DECFSZ 00,F
0770: GOTO 764
0771: BCF 0A.3
0772: BSF 0A.4
0773: GOTO 64E (RETURN)
....................
....................
.................... #define EEPROM_SDA PIN_C4
.................... #define EEPROM_SCL PIN_C3
.................... #use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)
*
0104: MOVLW 08
0105: MOVWF 78
0106: NOP
0107: BCF 07.3
0108: BCF 20.3
0109: MOVF 20,W
010A: BSF 03.5
010B: MOVWF 07
010C: NOP
010D: BCF 03.5
010E: RLF 3C,F
010F: BCF 07.4
0110: BTFSS 03.0
0111: GOTO 118
0112: BSF 20.4
0113: MOVF 20,W
0114: BSF 03.5
0115: MOVWF 07
0116: GOTO 11C
0117: BCF 03.5
0118: BCF 20.4
0119: MOVF 20,W
011A: BSF 03.5
011B: MOVWF 07
011C: NOP
011D: BCF 03.5
011E: BSF 20.3
011F: MOVF 20,W
0120: BSF 03.5
0121: MOVWF 07
0122: BCF 03.5
0123: BTFSS 07.3
0124: GOTO 123
0125: DECFSZ 78,F
0126: GOTO 106
0127: NOP
0128: BCF 07.3
0129: BCF 20.3
012A: MOVF 20,W
012B: BSF 03.5
012C: MOVWF 07
012D: NOP
012E: BCF 03.5
012F: BSF 20.4
0130: MOVF 20,W
0131: BSF 03.5
0132: MOVWF 07
0133: NOP
0134: NOP
0135: BCF 03.5
0136: BSF 20.3
0137: MOVF 20,W
0138: BSF 03.5
0139: MOVWF 07
013A: BCF 03.5
013B: BTFSS 07.3
013C: GOTO 13B
013D: CLRF 78
013E: NOP
013F: BTFSC 07.4
0140: BSF 78.0
0141: BCF 07.3
0142: BCF 20.3
0143: MOVF 20,W
0144: BSF 03.5
0145: MOVWF 07
0146: BCF 03.5
0147: BCF 07.4
0148: BCF 20.4
0149: MOVF 20,W
014A: BSF 03.5
014B: MOVWF 07
014C: BCF 03.5
014D: RETURN
014E: MOVLW 08
014F: MOVWF 3D
0150: MOVF 77,W
0151: MOVWF 3E
0152: BSF 20.4
0153: MOVF 20,W
0154: BSF 03.5
0155: MOVWF 07
0156: NOP
0157: BCF 03.5
0158: BSF 20.3
0159: MOVF 20,W
015A: BSF 03.5
015B: MOVWF 07
015C: BCF 03.5
015D: BTFSS 07.3
015E: GOTO 15D
015F: BTFSC 07.4
0160: BSF 03.0
0161: BTFSS 07.4
0162: BCF 03.0
0163: RLF 78,F
0164: NOP
0165: BCF 20.3
0166: MOVF 20,W
0167: BSF 03.5
0168: MOVWF 07
0169: BCF 03.5
016A: BCF 07.3
016B: DECFSZ 3D,F
016C: GOTO 152
016D: BSF 20.4
016E: MOVF 20,W
016F: BSF 03.5
0170: MOVWF 07
0171: NOP
0172: BCF 03.5
0173: BCF 07.4
0174: MOVF 3E,W
0175: BTFSC 03.2
0176: GOTO 17C
0177: BCF 20.4
0178: MOVF 20,W
0179: BSF 03.5
017A: MOVWF 07
017B: BCF 03.5
017C: NOP
017D: BSF 20.3
017E: MOVF 20,W
017F: BSF 03.5
0180: MOVWF 07
0181: BCF 03.5
0182: BTFSS 07.3
0183: GOTO 182
0184: NOP
0185: BCF 07.3
0186: BCF 20.3
0187: MOVF 20,W
0188: BSF 03.5
0189: MOVWF 07
018A: NOP
018B: BCF 03.5
018C: BCF 07.4
018D: BCF 20.4
018E: MOVF 20,W
018F: BSF 03.5
0190: MOVWF 07
0191: BCF 03.5
0192: RETURN
.................... #use rs232(baud=9600,parity=N,xmit=PIN_C7,rcv=PIN_C6,bits=8) //rcv TXD xmit RXD
*
0098: BCF 20.7
0099: MOVF 20,W
009A: BSF 03.5
009B: MOVWF 07
009C: BCF 03.5
009D: BCF 07.7
009E: MOVLW 08
009F: MOVWF 78
00A0: GOTO 0A1
00A1: NOP
00A2: BSF 78.7
00A3: GOTO 0B2
00A4: BCF 78.7
00A5: RRF 49,F
00A6: BTFSC 03.0
00A7: BSF 07.7
00A8: BTFSS 03.0
00A9: BCF 07.7
00AA: BSF 78.6
00AB: GOTO 0B2
00AC: BCF 78.6
00AD: DECFSZ 78,F
00AE: GOTO 0A5
00AF: GOTO 0B0
00B0: NOP
00B1: BSF 07.7
00B2: MOVLW 3F
00B3: MOVWF 04
00B4: DECFSZ 04,F
00B5: GOTO 0B4
00B6: NOP
00B7: BTFSC 78.7
00B8: GOTO 0A4
00B9: BTFSC 78.6
00BA: GOTO 0AC
00BB: 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;
*
0800: BCF 4C.0
.................... flag = 0;
0801: BCF 4C.1
.................... y = x;
0802: MOVF 3F,W
0803: MOVWF 43
0804: MOVF 3E,W
0805: MOVWF 42
0806: MOVF 3D,W
0807: MOVWF 41
0808: MOVF 3C,W
0809: MOVWF 40
....................
.................... if (x < 0)
080A: MOVF 3F,W
080B: MOVWF 50
080C: MOVF 3E,W
080D: MOVWF 4F
080E: MOVF 3D,W
080F: MOVWF 4E
0810: MOVF 3C,W
0811: MOVWF 4D
0812: CLRF 54
0813: CLRF 53
0814: CLRF 52
0815: CLRF 51
0816: BCF 0A.3
0817: CALL 5DE
0818: BSF 0A.3
0819: BTFSS 03.0
081A: GOTO 01F
.................... {
.................... s = 1;
081B: BSF 4C.0
.................... y = -y;
081C: MOVF 41,W
081D: XORLW 80
081E: MOVWF 41
.................... }
....................
.................... if (y > 1.0)
081F: CLRF 50
0820: CLRF 4F
0821: CLRF 4E
0822: MOVLW 7F
0823: MOVWF 4D
0824: MOVF 43,W
0825: MOVWF 54
0826: MOVF 42,W
0827: MOVWF 53
0828: MOVF 41,W
0829: MOVWF 52
082A: MOVF 40,W
082B: MOVWF 51
082C: BCF 0A.3
082D: CALL 5DE
082E: BSF 0A.3
082F: BTFSS 03.0
0830: GOTO 04A
.................... {
.................... y = 1.0/y;
0831: CLRF 54
0832: CLRF 53
0833: CLRF 52
0834: MOVLW 7F
0835: MOVWF 51
0836: MOVF 43,W
0837: MOVWF 58
0838: MOVF 42,W
0839: MOVWF 57
083A: MOVF 41,W
083B: MOVWF 56
083C: MOVF 40,W
083D: MOVWF 55
083E: BCF 0A.3
083F: CALL 376
0840: BSF 0A.3
0841: MOVF 7A,W
0842: MOVWF 43
0843: MOVF 79,W
0844: MOVWF 42
0845: MOVF 78,W
0846: MOVWF 41
0847: MOVF 77,W
0848: MOVWF 40
.................... flag = 1;
0849: BSF 4C.1
.................... }
....................
.................... res = pat[0]*y*y + pat[1];
084A: MOVLW 0A
084B: MOVWF 54
084C: MOVLW 89
084D: MOVWF 53
084E: MOVLW 34
084F: MOVWF 52
0850: MOVLW 7C
0851: MOVWF 51
0852: MOVF 43,W
0853: MOVWF 58
0854: MOVF 42,W
0855: MOVWF 57
0856: MOVF 41,W
0857: MOVWF 56
0858: MOVF 40,W
0859: MOVWF 55
085A: BCF 0A.3
085B: CALL 440
085C: BSF 0A.3
085D: MOVF 77,W
085E: MOVWF 4D
085F: MOVF 78,W
0860: MOVWF 4E
0861: MOVF 79,W
0862: MOVWF 4F
0863: MOVF 7A,W
0864: MOVWF 50
0865: MOVWF 54
0866: MOVF 4F,W
0867: MOVWF 53
0868: MOVF 4E,W
0869: MOVWF 52
086A: MOVF 4D,W
086B: MOVWF 51
086C: MOVF 43,W
086D: MOVWF 58
086E: MOVF 42,W
086F: MOVWF 57
0870: MOVF 41,W
0871: MOVWF 56
0872: MOVF 40,W
0873: MOVWF 55
0874: BCF 0A.3
0875: CALL 440
0876: BSF 0A.3
0877: MOVF 77,W
0878: MOVWF 4D
0879: MOVF 78,W
087A: MOVWF 4E
087B: MOVF 79,W
087C: MOVWF 4F
087D: MOVF 7A,W
087E: MOVWF 50
087F: BCF 03.1
0880: MOVF 50,W
0881: MOVWF 54
0882: MOVF 4F,W
0883: MOVWF 53
0884: MOVF 4E,W
0885: MOVWF 52
0886: MOVF 4D,W
0887: MOVWF 51
0888: MOVLW 7C
0889: MOVWF 58
088A: MOVLW 79
088B: MOVWF 57
088C: MOVLW 35
088D: MOVWF 56
088E: MOVLW 81
088F: MOVWF 55
0890: BCF 0A.3
0891: CALL 61D
0892: BSF 0A.3
0893: MOVF 7A,W
0894: MOVWF 47
0895: MOVF 79,W
0896: MOVWF 46
0897: MOVF 78,W
0898: MOVWF 45
0899: MOVF 77,W
089A: MOVWF 44
.................... res = res*y*y + pat[2];
089B: MOVF 47,W
089C: MOVWF 54
089D: MOVF 46,W
089E: MOVWF 53
089F: MOVF 45,W
08A0: MOVWF 52
08A1: MOVF 44,W
08A2: MOVWF 51
08A3: MOVF 43,W
08A4: MOVWF 58
08A5: MOVF 42,W
08A6: MOVWF 57
08A7: MOVF 41,W
08A8: MOVWF 56
08A9: MOVF 40,W
08AA: MOVWF 55
08AB: BCF 0A.3
08AC: CALL 440
08AD: BSF 0A.3
08AE: MOVF 77,W
08AF: MOVWF 4D
08B0: MOVF 78,W
08B1: MOVWF 4E
08B2: MOVF 79,W
08B3: MOVWF 4F
08B4: MOVF 7A,W
08B5: MOVWF 50
08B6: MOVWF 54
08B7: MOVF 4F,W
08B8: MOVWF 53
08B9: MOVF 4E,W
08BA: MOVWF 52
08BB: MOVF 4D,W
08BC: MOVWF 51
08BD: MOVF 43,W
08BE: MOVWF 58
08BF: MOVF 42,W
08C0: MOVWF 57
08C1: MOVF 41,W
08C2: MOVWF 56
08C3: MOVF 40,W
08C4: MOVWF 55
08C5: BCF 0A.3
08C6: CALL 440
08C7: BSF 0A.3
08C8: MOVF 77,W
08C9: MOVWF 4D
08CA: MOVF 78,W
08CB: MOVWF 4E
08CC: MOVF 79,W
08CD: MOVWF 4F
08CE: MOVF 7A,W
08CF: MOVWF 50
08D0: BCF 03.1
08D1: MOVF 50,W
08D2: MOVWF 54
08D3: MOVF 4F,W
08D4: MOVWF 53
08D5: MOVF 4E,W
08D6: MOVWF 52
08D7: MOVF 4D,W
08D8: MOVWF 51
08D9: MOVLW 3F
08DA: MOVWF 58
08DB: MOVLW 02
08DC: MOVWF 57
08DD: MOVLW 33
08DE: MOVWF 56
08DF: MOVLW 83
08E0: MOVWF 55
08E1: BCF 0A.3
08E2: CALL 61D
08E3: BSF 0A.3
08E4: MOVF 7A,W
08E5: MOVWF 47
08E6: MOVF 79,W
08E7: MOVWF 46
08E8: MOVF 78,W
08E9: MOVWF 45
08EA: MOVF 77,W
08EB: MOVWF 44
.................... res = res*y*y + pat[3];
08EC: MOVF 47,W
08ED: MOVWF 54
08EE: MOVF 46,W
08EF: MOVWF 53
08F0: MOVF 45,W
08F1: MOVWF 52
08F2: MOVF 44,W
08F3: MOVWF 51
08F4: MOVF 43,W
08F5: MOVWF 58
08F6: MOVF 42,W
08F7: MOVWF 57
08F8: MOVF 41,W
08F9: MOVWF 56
08FA: MOVF 40,W
08FB: MOVWF 55
08FC: BCF 0A.3
08FD: CALL 440
08FE: BSF 0A.3
08FF: MOVF 77,W
0900: MOVWF 4D
0901: MOVF 78,W
0902: MOVWF 4E
0903: MOVF 79,W
0904: MOVWF 4F
0905: MOVF 7A,W
0906: MOVWF 50
0907: MOVWF 54
0908: MOVF 4F,W
0909: MOVWF 53
090A: MOVF 4E,W
090B: MOVWF 52
090C: MOVF 4D,W
090D: MOVWF 51
090E: MOVF 43,W
090F: MOVWF 58
0910: MOVF 42,W
0911: MOVWF 57
0912: MOVF 41,W
0913: MOVWF 56
0914: MOVF 40,W
0915: MOVWF 55
0916: BCF 0A.3
0917: CALL 440
0918: BSF 0A.3
0919: MOVF 77,W
091A: MOVWF 4D
091B: MOVF 78,W
091C: MOVWF 4E
091D: MOVF 79,W
091E: MOVWF 4F
091F: MOVF 7A,W
0920: MOVWF 50
0921: BCF 03.1
0922: MOVF 50,W
0923: MOVWF 54
0924: MOVF 4F,W
0925: MOVWF 53
0926: MOVF 4E,W
0927: MOVWF 52
0928: MOVF 4D,W
0929: MOVWF 51
092A: MOVLW 33
092B: MOVWF 58
092C: MOVLW 8C
092D: MOVWF 57
092E: MOVLW 1E
092F: MOVWF 56
0930: MOVLW 83
0931: MOVWF 55
0932: BCF 0A.3
0933: CALL 61D
0934: BSF 0A.3
0935: MOVF 7A,W
0936: MOVWF 47
0937: MOVF 79,W
0938: MOVWF 46
0939: MOVF 78,W
093A: MOVWF 45
093B: MOVF 77,W
093C: MOVWF 44
....................
.................... r = qat[0]*y*y + qat[1];
093D: CLRF 54
093E: CLRF 53
093F: CLRF 52
0940: MOVLW 7F
0941: MOVWF 51
0942: MOVF 43,W
0943: MOVWF 58
0944: MOVF 42,W
0945: MOVWF 57
0946: MOVF 41,W
0947: MOVWF 56
0948: MOVF 40,W
0949: MOVWF 55
094A: BCF 0A.3
094B: CALL 440
094C: BSF 0A.3
094D: MOVF 77,W
094E: MOVWF 4D
094F: MOVF 78,W
0950: MOVWF 4E
0951: MOVF 79,W
0952: MOVWF 4F
0953: MOVF 7A,W
0954: MOVWF 50
0955: MOVWF 54
0956: MOVF 4F,W
0957: MOVWF 53
0958: MOVF 4E,W
0959: MOVWF 52
095A: MOVF 4D,W
095B: MOVWF 51
095C: MOVF 43,W
095D: MOVWF 58
095E: MOVF 42,W
095F: MOVWF 57
0960: MOVF 41,W
0961: MOVWF 56
0962: MOVF 40,W
0963: MOVWF 55
0964: BCF 0A.3
0965: CALL 440
0966: BSF 0A.3
0967: MOVF 77,W
0968: MOVWF 4D
0969: MOVF 78,W
096A: MOVWF 4E
096B: MOVF 79,W
096C: MOVWF 4F
096D: MOVF 7A,W
096E: MOVWF 50
096F: BCF 03.1
0970: MOVF 50,W
0971: MOVWF 54
0972: MOVF 4F,W
0973: MOVWF 53
0974: MOVF 4E,W
0975: MOVWF 52
0976: MOVF 4D,W
0977: MOVWF 51
0978: MOVLW 1B
0979: MOVWF 58
097A: MOVLW E4
097B: MOVWF 57
097C: MOVLW 35
097D: MOVWF 56
097E: MOVLW 82
097F: MOVWF 55
0980: BCF 0A.3
0981: CALL 61D
0982: BSF 0A.3
0983: MOVF 7A,W
0984: MOVWF 4B
0985: MOVF 79,W
0986: MOVWF 4A
0987: MOVF 78,W
0988: MOVWF 49
0989: MOVF 77,W
098A: MOVWF 48
.................... r = r*y*y + qat[2];
098B: MOVF 4B,W
098C: MOVWF 54
098D: MOVF 4A,W
098E: MOVWF 53
098F: MOVF 49,W
0990: MOVWF 52
0991: MOVF 48,W
0992: MOVWF 51
0993: MOVF 43,W
0994: MOVWF 58
0995: MOVF 42,W
0996: MOVWF 57
0997: MOVF 41,W
0998: MOVWF 56
0999: MOVF 40,W
099A: MOVWF 55
099B: BCF 0A.3
099C: CALL 440
099D: BSF 0A.3
099E: MOVF 77,W
099F: MOVWF 4D
09A0: MOVF 78,W
09A1: MOVWF 4E
09A2: MOVF 79,W
09A3: MOVWF 4F
09A4: MOVF 7A,W
09A5: MOVWF 50
09A6: MOVWF 54
09A7: MOVF 4F,W
09A8: MOVWF 53
09A9: MOVF 4E,W
09AA: MOVWF 52
09AB: MOVF 4D,W
09AC: MOVWF 51
09AD: MOVF 43,W
09AE: MOVWF 58
09AF: MOVF 42,W
09B0: MOVWF 57
09B1: MOVF 41,W
09B2: MOVWF 56
09B3: MOVF 40,W
09B4: MOVWF 55
09B5: BCF 0A.3
09B6: CALL 440
09B7: BSF 0A.3
09B8: MOVF 77,W
09B9: MOVWF 4D
09BA: MOVF 78,W
09BB: MOVWF 4E
09BC: MOVF 79,W
09BD: MOVWF 4F
09BE: MOVF 7A,W
09BF: MOVWF 50
09C0: BCF 03.1
09C1: MOVF 50,W
09C2: MOVWF 54
09C3: MOVF 4F,W
09C4: MOVWF 53
09C5: MOVF 4E,W
09C6: MOVWF 52
09C7: MOVF 4D,W
09C8: MOVWF 51
09C9: MOVLW A4
09CA: MOVWF 58
09CB: MOVLW DB
09CC: MOVWF 57
09CD: MOVLW 67
09CE: MOVWF 56
09CF: MOVLW 83
09D0: MOVWF 55
09D1: BCF 0A.3
09D2: CALL 61D
09D3: BSF 0A.3
09D4: MOVF 7A,W
09D5: MOVWF 4B
09D6: MOVF 79,W
09D7: MOVWF 4A
09D8: MOVF 78,W
09D9: MOVWF 49
09DA: MOVF 77,W
09DB: MOVWF 48
.................... r = r*y*y + qat[3];
09DC: MOVF 4B,W
09DD: MOVWF 54
09DE: MOVF 4A,W
09DF: MOVWF 53
09E0: MOVF 49,W
09E1: MOVWF 52
09E2: MOVF 48,W
09E3: MOVWF 51
09E4: MOVF 43,W
09E5: MOVWF 58
09E6: MOVF 42,W
09E7: MOVWF 57
09E8: MOVF 41,W
09E9: MOVWF 56
09EA: MOVF 40,W
09EB: MOVWF 55
09EC: BCF 0A.3
09ED: CALL 440
09EE: BSF 0A.3
09EF: MOVF 77,W
09F0: MOVWF 4D
09F1: MOVF 78,W
09F2: MOVWF 4E
09F3: MOVF 79,W
09F4: MOVWF 4F
09F5: MOVF 7A,W
09F6: MOVWF 50
09F7: MOVWF 54
09F8: MOVF 4F,W
09F9: MOVWF 53
09FA: MOVF 4E,W
09FB: MOVWF 52
09FC: MOVF 4D,W
09FD: MOVWF 51
09FE: MOVF 43,W
09FF: MOVWF 58
0A00: MOVF 42,W
0A01: MOVWF 57
0A02: MOVF 41,W
0A03: MOVWF 56
0A04: MOVF 40,W
0A05: MOVWF 55
0A06: BCF 0A.3
0A07: CALL 440
0A08: BSF 0A.3
0A09: MOVF 77,W
0A0A: MOVWF 4D
0A0B: MOVF 78,W
0A0C: MOVWF 4E
0A0D: MOVF 79,W
0A0E: MOVWF 4F
0A0F: MOVF 7A,W
0A10: MOVWF 50
0A11: BCF 03.1
0A12: MOVF 50,W
0A13: MOVWF 54
0A14: MOVF 4F,W
0A15: MOVWF 53
0A16: MOVF 4E,W
0A17: MOVWF 52
0A18: MOVF 4D,W
0A19: MOVWF 51
0A1A: MOVLW 33
0A1B: MOVWF 58
0A1C: MOVLW 8C
0A1D: MOVWF 57
0A1E: MOVLW 1E
0A1F: MOVWF 56
0A20: MOVLW 83
0A21: MOVWF 55
0A22: BCF 0A.3
0A23: CALL 61D
0A24: BSF 0A.3
0A25: MOVF 7A,W
0A26: MOVWF 4B
0A27: MOVF 79,W
0A28: MOVWF 4A
0A29: MOVF 78,W
0A2A: MOVWF 49
0A2B: MOVF 77,W
0A2C: MOVWF 48
....................
.................... res = y*res/r;
0A2D: MOVF 43,W
0A2E: MOVWF 54
0A2F: MOVF 42,W
0A30: MOVWF 53
0A31: MOVF 41,W
0A32: MOVWF 52
0A33: MOVF 40,W
0A34: MOVWF 51
0A35: MOVF 47,W
0A36: MOVWF 58
0A37: MOVF 46,W
0A38: MOVWF 57
0A39: MOVF 45,W
0A3A: MOVWF 56
0A3B: MOVF 44,W
0A3C: MOVWF 55
0A3D: BCF 0A.3
0A3E: CALL 440
0A3F: BSF 0A.3
0A40: MOVF 77,W
0A41: MOVWF 4D
0A42: MOVF 78,W
0A43: MOVWF 4E
0A44: MOVF 79,W
0A45: MOVWF 4F
0A46: MOVF 7A,W
0A47: MOVWF 50
0A48: MOVWF 54
0A49: MOVF 4F,W
0A4A: MOVWF 53
0A4B: MOVF 4E,W
0A4C: MOVWF 52
0A4D: MOVF 4D,W
0A4E: MOVWF 51
0A4F: MOVF 4B,W
0A50: MOVWF 58
0A51: MOVF 4A,W
0A52: MOVWF 57
0A53: MOVF 49,W
0A54: MOVWF 56
0A55: MOVF 48,W
0A56: MOVWF 55
0A57: BCF 0A.3
0A58: CALL 376
0A59: BSF 0A.3
0A5A: MOVF 7A,W
0A5B: MOVWF 47
0A5C: MOVF 79,W
0A5D: MOVWF 46
0A5E: MOVF 78,W
0A5F: MOVWF 45
0A60: MOVF 77,W
0A61: MOVWF 44
....................
....................
.................... if (flag) // for |x| > 1
0A62: BTFSS 4C.1
0A63: GOTO 280
.................... res = PI_DIV_BY_TWO - res;
0A64: BSF 03.1
0A65: MOVLW DB
0A66: MOVWF 54
0A67: MOVLW 0F
0A68: MOVWF 53
0A69: MOVLW 49
0A6A: MOVWF 52
0A6B: MOVLW 7F
0A6C: MOVWF 51
0A6D: MOVF 47,W
0A6E: MOVWF 58
0A6F: MOVF 46,W
0A70: MOVWF 57
0A71: MOVF 45,W
0A72: MOVWF 56
0A73: MOVF 44,W
0A74: MOVWF 55
0A75: BCF 0A.3
0A76: CALL 61D
0A77: BSF 0A.3
0A78: MOVF 7A,W
0A79: MOVWF 47
0A7A: MOVF 79,W
0A7B: MOVWF 46
0A7C: MOVF 78,W
0A7D: MOVWF 45
0A7E: MOVF 77,W
0A7F: MOVWF 44
.................... if (s)
0A80: BTFSS 4C.0
0A81: GOTO 285
.................... res = -res;
0A82: MOVF 45,W
0A83: XORLW 80
0A84: MOVWF 45
....................
.................... return(res);
0A85: MOVF 44,W
0A86: MOVWF 77
0A87: MOVF 45,W
0A88: MOVWF 78
0A89: MOVF 46,W
0A8A: MOVWF 79
0A8B: MOVF 47,W
0A8C: MOVWF 7A
.................... }
0A8D: BCF 0A.3
0A8E: BSF 0A.4
0A8F: GOTO 58C (RETURN)
.................... //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
....................
....................
.................... void main()
.................... {
*
0097: DATA 00,00
*
1000: CLRF 04
1001: BCF 03.7
1002: MOVLW 1F
1003: ANDWF 03,F
1004: MOVLW 71
1005: BSF 03.5
1006: MOVWF 0F
1007: MOVF 0F,W
1008: BCF 03.5
1009: BCF 20.7
100A: MOVF 20,W
100B: BSF 03.5
100C: MOVWF 07
100D: BCF 03.5
100E: BSF 07.7
100F: BSF 03.5
1010: BSF 03.6
1011: MOVF 09,W
1012: ANDLW C0
1013: MOVWF 09
1014: BCF 03.6
1015: BCF 1F.4
1016: BCF 1F.5
1017: MOVLW 00
1018: BSF 03.6
1019: MOVWF 08
101A: BCF 03.5
101B: CLRF 07
101C: CLRF 08
101D: CLRF 09
....................
.................... setup_adc_ports(NO_ANALOGS|VSS_VDD);
*
1021: BSF 03.5
1022: BSF 03.6
1023: MOVF 09,W
1024: ANDLW C0
1025: MOVWF 09
1026: BCF 03.6
1027: BCF 1F.4
1028: BCF 1F.5
1029: MOVLW 00
102A: BSF 03.6
102B: MOVWF 08
.................... setup_adc(ADC_CLOCK_DIV_2);
102C: BCF 03.5
102D: BCF 03.6
102E: BCF 1F.6
102F: BCF 1F.7
1030: BSF 03.5
1031: BCF 1F.7
1032: BCF 03.5
1033: BSF 1F.0
.................... setup_spi(SPI_SS_DISABLED);
1034: BCF 14.5
1035: BCF 20.5
1036: MOVF 20,W
1037: BSF 03.5
1038: MOVWF 07
1039: BCF 03.5
103A: BSF 20.4
103B: MOVF 20,W
103C: BSF 03.5
103D: MOVWF 07
103E: BCF 03.5
103F: BCF 20.3
1040: MOVF 20,W
1041: BSF 03.5
1042: MOVWF 07
1043: MOVLW 01
1044: BCF 03.5
1045: MOVWF 14
1046: MOVLW 00
1047: BSF 03.5
1048: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
1049: MOVF 01,W
104A: ANDLW C7
104B: IORLW 08
104C: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
104D: BCF 03.5
104E: CLRF 10
.................... setup_timer_2(T2_DISABLED,0,1);
104F: MOVLW 00
1050: MOVWF 78
1051: MOVWF 12
1052: MOVLW 00
1053: BSF 03.5
1054: MOVWF 12
.................... setup_ccp1(CCP_OFF);
1055: BCF 03.5
1056: BSF 20.2
1057: MOVF 20,W
1058: BSF 03.5
1059: MOVWF 07
105A: BCF 03.5
105B: CLRF 17
105C: BSF 03.5
105D: CLRF 1B
105E: CLRF 1C
105F: MOVLW 01
1060: MOVWF 1D
.................... setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
1061: BCF 03.5
1062: BSF 03.6
1063: CLRF 07
1064: CLRF 08
1065: CLRF 09
....................
.................... printf("Simple Thermomether \r\n",);
1066: MOVLW 04
1067: MOVWF 0D
1068: MOVLW 00
1069: MOVWF 0F
106A: BCF 0A.4
106B: BCF 03.6
106C: GOTO 0BC
106D: BSF 0A.4
....................
.................... int16 data1, data2, data3;
.................... signed int16 X, Y, Z;
.................... float a, b;
....................
.................... unsigned int8 XL,XH,YL,YH,ZL,ZH;
....................
....................
.................... i2c_start();
106E: BSF 20.4
106F: MOVF 20,W
1070: BSF 03.5
1071: MOVWF 07
1072: NOP
1073: BCF 03.5
1074: BSF 20.3
1075: MOVF 20,W
1076: BSF 03.5
1077: MOVWF 07
1078: NOP
1079: BCF 03.5
107A: BCF 07.4
107B: BCF 20.4
107C: MOVF 20,W
107D: BSF 03.5
107E: MOVWF 07
107F: NOP
1080: BCF 03.5
1081: BCF 07.3
1082: BCF 20.3
1083: MOVF 20,W
1084: BSF 03.5
1085: MOVWF 07
.................... I2C_Write(0x38);
1086: MOVLW 38
1087: BCF 03.5
1088: MOVWF 3C
1089: BCF 0A.4
108A: CALL 104
108B: BSF 0A.4
.................... I2C_write(0x2A);
108C: MOVLW 2A
108D: MOVWF 3C
108E: BCF 0A.4
108F: CALL 104
1090: BSF 0A.4
....................
.................... I2C_write(0x01);
1091: MOVLW 01
1092: MOVWF 3C
1093: BCF 0A.4
1094: CALL 104
1095: BSF 0A.4
....................
.................... i2c_stop();
1096: BCF 20.4
1097: MOVF 20,W
1098: BSF 03.5
1099: MOVWF 07
109A: NOP
109B: BCF 03.5
109C: BSF 20.3
109D: MOVF 20,W
109E: BSF 03.5
109F: MOVWF 07
10A0: BCF 03.5
10A1: BTFSS 07.3
10A2: GOTO 0A1
10A3: NOP
10A4: GOTO 0A5
10A5: NOP
10A6: BSF 20.4
10A7: MOVF 20,W
10A8: BSF 03.5
10A9: MOVWF 07
10AA: NOP
....................
....................
....................
.................... while(TRUE)
.................... {
....................
.................... data1=0;
10AB: BCF 03.5
10AC: CLRF 22
10AD: CLRF 21
.................... data2=0 ;
10AE: CLRF 24
10AF: CLRF 23
....................
....................
.................... //akcelerometr
.................... int1 ack;
.................... i2c_start(); // If the write command is acknowledged,
10B0: BSF 20.4
10B1: MOVF 20,W
10B2: BSF 03.5
10B3: MOVWF 07
10B4: NOP
10B5: BCF 03.5
10B6: BSF 20.3
10B7: MOVF 20,W
10B8: BSF 03.5
10B9: MOVWF 07
10BA: NOP
10BB: BCF 03.5
10BC: BCF 07.4
10BD: BCF 20.4
10BE: MOVF 20,W
10BF: BSF 03.5
10C0: MOVWF 07
10C1: NOP
10C2: BCF 03.5
10C3: BCF 07.3
10C4: BCF 20.3
10C5: MOVF 20,W
10C6: BSF 03.5
10C7: MOVWF 07
.................... ack = i2c_write(0x39);//hen the device is ready.
10C8: MOVLW 39
10C9: BCF 03.5
10CA: MOVWF 3C
10CB: BCF 0A.4
10CC: CALL 104
10CD: BSF 0A.4
10CE: MOVF 78,W
10CF: BCF 3B.0
10D0: BTFSC 78.0
10D1: BSF 3B.0
.................... i2c_stop();
10D2: BCF 20.4
10D3: MOVF 20,W
10D4: BSF 03.5
10D5: MOVWF 07
10D6: NOP
10D7: BCF 03.5
10D8: BSF 20.3
10D9: MOVF 20,W
10DA: BSF 03.5
10DB: MOVWF 07
10DC: BCF 03.5
10DD: BTFSS 07.3
10DE: GOTO 0DD
10DF: NOP
10E0: GOTO 0E1
10E1: NOP
10E2: BSF 20.4
10E3: MOVF 20,W
10E4: BSF 03.5
10E5: MOVWF 07
10E6: NOP
.................... ack=!ack;
10E7: MOVLW 01
10E8: BCF 03.5
10E9: XORWF 3B,F
....................
....................
....................
.................... i2c_stop();
10EA: BCF 20.4
10EB: MOVF 20,W
10EC: BSF 03.5
10ED: MOVWF 07
10EE: NOP
10EF: BCF 03.5
10F0: BSF 20.3
10F1: MOVF 20,W
10F2: BSF 03.5
10F3: MOVWF 07
10F4: BCF 03.5
10F5: BTFSS 07.3
10F6: GOTO 0F5
10F7: NOP
10F8: GOTO 0F9
10F9: NOP
10FA: BSF 20.4
10FB: MOVF 20,W
10FC: BSF 03.5
10FD: MOVWF 07
10FE: NOP
....................
.................... i2c_start();
10FF: BCF 03.5
1100: BSF 20.4
1101: MOVF 20,W
1102: BSF 03.5
1103: MOVWF 07
1104: NOP
1105: BCF 03.5
1106: BSF 20.3
1107: MOVF 20,W
1108: BSF 03.5
1109: MOVWF 07
110A: NOP
110B: BCF 03.5
110C: BCF 07.4
110D: BCF 20.4
110E: MOVF 20,W
110F: BSF 03.5
1110: MOVWF 07
1111: NOP
1112: BCF 03.5
1113: BCF 07.3
1114: BCF 20.3
1115: MOVF 20,W
1116: BSF 03.5
1117: MOVWF 07
.................... I2C_Write(0x38);
1118: MOVLW 38
1119: BCF 03.5
111A: MOVWF 3C
111B: BCF 0A.4
111C: CALL 104
111D: BSF 0A.4
.................... I2C_write(0x01);
111E: MOVLW 01
111F: MOVWF 3C
1120: BCF 0A.4
1121: CALL 104
1122: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
1123: BSF 20.4
1124: MOVF 20,W
1125: BSF 03.5
1126: MOVWF 07
1127: NOP
1128: BCF 03.5
1129: BSF 20.3
112A: MOVF 20,W
112B: BSF 03.5
112C: MOVWF 07
112D: NOP
112E: BCF 03.5
112F: BTFSS 07.3
1130: GOTO 12F
1131: BCF 07.4
1132: BCF 20.4
1133: MOVF 20,W
1134: BSF 03.5
1135: MOVWF 07
1136: NOP
1137: BCF 03.5
1138: BCF 07.3
1139: BCF 20.3
113A: MOVF 20,W
113B: BSF 03.5
113C: MOVWF 07
.................... I2C_Write(0x39);
113D: MOVLW 39
113E: BCF 03.5
113F: MOVWF 3C
1140: BCF 0A.4
1141: CALL 104
1142: BSF 0A.4
.................... XH=i2c_read(0);
1143: CLRF 77
1144: BCF 0A.4
1145: CALL 14E
1146: BSF 0A.4
1147: MOVF 78,W
1148: MOVWF 36
.................... i2c_stop();
1149: BCF 20.4
114A: MOVF 20,W
114B: BSF 03.5
114C: MOVWF 07
114D: NOP
114E: BCF 03.5
114F: BSF 20.3
1150: MOVF 20,W
1151: BSF 03.5
1152: MOVWF 07
1153: BCF 03.5
1154: BTFSS 07.3
1155: GOTO 154
1156: NOP
1157: GOTO 158
1158: NOP
1159: BSF 20.4
115A: MOVF 20,W
115B: BSF 03.5
115C: MOVWF 07
115D: NOP
....................
.................... i2c_start();
115E: BCF 03.5
115F: BSF 20.4
1160: MOVF 20,W
1161: BSF 03.5
1162: MOVWF 07
1163: NOP
1164: BCF 03.5
1165: BSF 20.3
1166: MOVF 20,W
1167: BSF 03.5
1168: MOVWF 07
1169: NOP
116A: BCF 03.5
116B: BCF 07.4
116C: BCF 20.4
116D: MOVF 20,W
116E: BSF 03.5
116F: MOVWF 07
1170: NOP
1171: BCF 03.5
1172: BCF 07.3
1173: BCF 20.3
1174: MOVF 20,W
1175: BSF 03.5
1176: MOVWF 07
.................... I2C_Write(0x38);
1177: MOVLW 38
1178: BCF 03.5
1179: MOVWF 3C
117A: BCF 0A.4
117B: CALL 104
117C: BSF 0A.4
.................... I2C_write(0x02);
117D: MOVLW 02
117E: MOVWF 3C
117F: BCF 0A.4
1180: CALL 104
1181: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
1182: BSF 20.4
1183: MOVF 20,W
1184: BSF 03.5
1185: MOVWF 07
1186: NOP
1187: BCF 03.5
1188: BSF 20.3
1189: MOVF 20,W
118A: BSF 03.5
118B: MOVWF 07
118C: NOP
118D: BCF 03.5
118E: BTFSS 07.3
118F: GOTO 18E
1190: BCF 07.4
1191: BCF 20.4
1192: MOVF 20,W
1193: BSF 03.5
1194: MOVWF 07
1195: NOP
1196: BCF 03.5
1197: BCF 07.3
1198: BCF 20.3
1199: MOVF 20,W
119A: BSF 03.5
119B: MOVWF 07
.................... I2C_Write(0x39);
119C: MOVLW 39
119D: BCF 03.5
119E: MOVWF 3C
119F: BCF 0A.4
11A0: CALL 104
11A1: BSF 0A.4
.................... XL=i2c_read(0);
11A2: CLRF 77
11A3: BCF 0A.4
11A4: CALL 14E
11A5: BSF 0A.4
11A6: MOVF 78,W
11A7: MOVWF 35
.................... i2c_stop();
11A8: BCF 20.4
11A9: MOVF 20,W
11AA: BSF 03.5
11AB: MOVWF 07
11AC: NOP
11AD: BCF 03.5
11AE: BSF 20.3
11AF: MOVF 20,W
11B0: BSF 03.5
11B1: MOVWF 07
11B2: BCF 03.5
11B3: BTFSS 07.3
11B4: GOTO 1B3
11B5: NOP
11B6: GOTO 1B7
11B7: NOP
11B8: BSF 20.4
11B9: MOVF 20,W
11BA: BSF 03.5
11BB: MOVWF 07
11BC: NOP
....................
.................... i2c_start();
11BD: BCF 03.5
11BE: BSF 20.4
11BF: MOVF 20,W
11C0: BSF 03.5
11C1: MOVWF 07
11C2: NOP
11C3: BCF 03.5
11C4: BSF 20.3
11C5: MOVF 20,W
11C6: BSF 03.5
11C7: MOVWF 07
11C8: NOP
11C9: BCF 03.5
11CA: BCF 07.4
11CB: BCF 20.4
11CC: MOVF 20,W
11CD: BSF 03.5
11CE: MOVWF 07
11CF: NOP
11D0: BCF 03.5
11D1: BCF 07.3
11D2: BCF 20.3
11D3: MOVF 20,W
11D4: BSF 03.5
11D5: MOVWF 07
.................... I2C_Write(0x38);
11D6: MOVLW 38
11D7: BCF 03.5
11D8: MOVWF 3C
11D9: BCF 0A.4
11DA: CALL 104
11DB: BSF 0A.4
.................... I2C_write(0x03);
11DC: MOVLW 03
11DD: MOVWF 3C
11DE: BCF 0A.4
11DF: CALL 104
11E0: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
11E1: BSF 20.4
11E2: MOVF 20,W
11E3: BSF 03.5
11E4: MOVWF 07
11E5: NOP
11E6: BCF 03.5
11E7: BSF 20.3
11E8: MOVF 20,W
11E9: BSF 03.5
11EA: MOVWF 07
11EB: NOP
11EC: BCF 03.5
11ED: BTFSS 07.3
11EE: GOTO 1ED
11EF: BCF 07.4
11F0: BCF 20.4
11F1: MOVF 20,W
11F2: BSF 03.5
11F3: MOVWF 07
11F4: NOP
11F5: BCF 03.5
11F6: BCF 07.3
11F7: BCF 20.3
11F8: MOVF 20,W
11F9: BSF 03.5
11FA: MOVWF 07
.................... I2C_Write(0x39);
11FB: MOVLW 39
11FC: BCF 03.5
11FD: MOVWF 3C
11FE: BCF 0A.4
11FF: CALL 104
1200: BSF 0A.4
.................... YH=i2c_read(0);
1201: CLRF 77
1202: BCF 0A.4
1203: CALL 14E
1204: BSF 0A.4
1205: MOVF 78,W
1206: MOVWF 38
.................... i2c_stop();
1207: BCF 20.4
1208: MOVF 20,W
1209: BSF 03.5
120A: MOVWF 07
120B: NOP
120C: BCF 03.5
120D: BSF 20.3
120E: MOVF 20,W
120F: BSF 03.5
1210: MOVWF 07
1211: BCF 03.5
1212: BTFSS 07.3
1213: GOTO 212
1214: NOP
1215: GOTO 216
1216: NOP
1217: BSF 20.4
1218: MOVF 20,W
1219: BSF 03.5
121A: MOVWF 07
121B: NOP
....................
.................... i2c_start();
121C: BCF 03.5
121D: BSF 20.4
121E: MOVF 20,W
121F: BSF 03.5
1220: MOVWF 07
1221: NOP
1222: BCF 03.5
1223: BSF 20.3
1224: MOVF 20,W
1225: BSF 03.5
1226: MOVWF 07
1227: NOP
1228: BCF 03.5
1229: BCF 07.4
122A: BCF 20.4
122B: MOVF 20,W
122C: BSF 03.5
122D: MOVWF 07
122E: NOP
122F: BCF 03.5
1230: BCF 07.3
1231: BCF 20.3
1232: MOVF 20,W
1233: BSF 03.5
1234: MOVWF 07
.................... I2C_Write(0x38);
1235: MOVLW 38
1236: BCF 03.5
1237: MOVWF 3C
1238: BCF 0A.4
1239: CALL 104
123A: BSF 0A.4
.................... I2C_write(0x04);
123B: MOVLW 04
123C: MOVWF 3C
123D: BCF 0A.4
123E: CALL 104
123F: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
1240: BSF 20.4
1241: MOVF 20,W
1242: BSF 03.5
1243: MOVWF 07
1244: NOP
1245: BCF 03.5
1246: BSF 20.3
1247: MOVF 20,W
1248: BSF 03.5
1249: MOVWF 07
124A: NOP
124B: BCF 03.5
124C: BTFSS 07.3
124D: GOTO 24C
124E: BCF 07.4
124F: BCF 20.4
1250: MOVF 20,W
1251: BSF 03.5
1252: MOVWF 07
1253: NOP
1254: BCF 03.5
1255: BCF 07.3
1256: BCF 20.3
1257: MOVF 20,W
1258: BSF 03.5
1259: MOVWF 07
.................... I2C_Write(0x39);
125A: MOVLW 39
125B: BCF 03.5
125C: MOVWF 3C
125D: BCF 0A.4
125E: CALL 104
125F: BSF 0A.4
.................... YL=i2c_read(0);
1260: CLRF 77
1261: BCF 0A.4
1262: CALL 14E
1263: BSF 0A.4
1264: MOVF 78,W
1265: MOVWF 37
.................... i2c_stop();
1266: BCF 20.4
1267: MOVF 20,W
1268: BSF 03.5
1269: MOVWF 07
126A: NOP
126B: BCF 03.5
126C: BSF 20.3
126D: MOVF 20,W
126E: BSF 03.5
126F: MOVWF 07
1270: BCF 03.5
1271: BTFSS 07.3
1272: GOTO 271
1273: NOP
1274: GOTO 275
1275: NOP
1276: BSF 20.4
1277: MOVF 20,W
1278: BSF 03.5
1279: MOVWF 07
127A: NOP
....................
.................... i2c_start();
127B: BCF 03.5
127C: BSF 20.4
127D: MOVF 20,W
127E: BSF 03.5
127F: MOVWF 07
1280: NOP
1281: BCF 03.5
1282: BSF 20.3
1283: MOVF 20,W
1284: BSF 03.5
1285: MOVWF 07
1286: NOP
1287: BCF 03.5
1288: BCF 07.4
1289: BCF 20.4
128A: MOVF 20,W
128B: BSF 03.5
128C: MOVWF 07
128D: NOP
128E: BCF 03.5
128F: BCF 07.3
1290: BCF 20.3
1291: MOVF 20,W
1292: BSF 03.5
1293: MOVWF 07
.................... I2C_Write(0x38);
1294: MOVLW 38
1295: BCF 03.5
1296: MOVWF 3C
1297: BCF 0A.4
1298: CALL 104
1299: BSF 0A.4
.................... I2C_write(0x05);
129A: MOVLW 05
129B: MOVWF 3C
129C: BCF 0A.4
129D: CALL 104
129E: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
129F: BSF 20.4
12A0: MOVF 20,W
12A1: BSF 03.5
12A2: MOVWF 07
12A3: NOP
12A4: BCF 03.5
12A5: BSF 20.3
12A6: MOVF 20,W
12A7: BSF 03.5
12A8: MOVWF 07
12A9: NOP
12AA: BCF 03.5
12AB: BTFSS 07.3
12AC: GOTO 2AB
12AD: BCF 07.4
12AE: BCF 20.4
12AF: MOVF 20,W
12B0: BSF 03.5
12B1: MOVWF 07
12B2: NOP
12B3: BCF 03.5
12B4: BCF 07.3
12B5: BCF 20.3
12B6: MOVF 20,W
12B7: BSF 03.5
12B8: MOVWF 07
.................... I2C_Write(0x39);
12B9: MOVLW 39
12BA: BCF 03.5
12BB: MOVWF 3C
12BC: BCF 0A.4
12BD: CALL 104
12BE: BSF 0A.4
.................... ZH=i2c_read(0);
12BF: CLRF 77
12C0: BCF 0A.4
12C1: CALL 14E
12C2: BSF 0A.4
12C3: MOVF 78,W
12C4: MOVWF 3A
.................... i2c_stop();
12C5: BCF 20.4
12C6: MOVF 20,W
12C7: BSF 03.5
12C8: MOVWF 07
12C9: NOP
12CA: BCF 03.5
12CB: BSF 20.3
12CC: MOVF 20,W
12CD: BSF 03.5
12CE: MOVWF 07
12CF: BCF 03.5
12D0: BTFSS 07.3
12D1: GOTO 2D0
12D2: NOP
12D3: GOTO 2D4
12D4: NOP
12D5: BSF 20.4
12D6: MOVF 20,W
12D7: BSF 03.5
12D8: MOVWF 07
12D9: NOP
....................
.................... i2c_start();
12DA: BCF 03.5
12DB: BSF 20.4
12DC: MOVF 20,W
12DD: BSF 03.5
12DE: MOVWF 07
12DF: NOP
12E0: BCF 03.5
12E1: BSF 20.3
12E2: MOVF 20,W
12E3: BSF 03.5
12E4: MOVWF 07
12E5: NOP
12E6: BCF 03.5
12E7: BCF 07.4
12E8: BCF 20.4
12E9: MOVF 20,W
12EA: BSF 03.5
12EB: MOVWF 07
12EC: NOP
12ED: BCF 03.5
12EE: BCF 07.3
12EF: BCF 20.3
12F0: MOVF 20,W
12F1: BSF 03.5
12F2: MOVWF 07
.................... I2C_Write(0x38);
12F3: MOVLW 38
12F4: BCF 03.5
12F5: MOVWF 3C
12F6: BCF 0A.4
12F7: CALL 104
12F8: BSF 0A.4
.................... I2C_write(0x06);
12F9: MOVLW 06
12FA: MOVWF 3C
12FB: BCF 0A.4
12FC: CALL 104
12FD: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
12FE: BSF 20.4
12FF: MOVF 20,W
1300: BSF 03.5
1301: MOVWF 07
1302: NOP
1303: BCF 03.5
1304: BSF 20.3
1305: MOVF 20,W
1306: BSF 03.5
1307: MOVWF 07
1308: NOP
1309: BCF 03.5
130A: BTFSS 07.3
130B: GOTO 30A
130C: BCF 07.4
130D: BCF 20.4
130E: MOVF 20,W
130F: BSF 03.5
1310: MOVWF 07
1311: NOP
1312: BCF 03.5
1313: BCF 07.3
1314: BCF 20.3
1315: MOVF 20,W
1316: BSF 03.5
1317: MOVWF 07
.................... I2C_Write(0x39);
1318: MOVLW 39
1319: BCF 03.5
131A: MOVWF 3C
131B: BCF 0A.4
131C: CALL 104
131D: BSF 0A.4
.................... ZL=i2c_read(0);
131E: CLRF 77
131F: BCF 0A.4
1320: CALL 14E
1321: BSF 0A.4
1322: MOVF 78,W
1323: MOVWF 39
.................... i2c_stop();
1324: BCF 20.4
1325: MOVF 20,W
1326: BSF 03.5
1327: MOVWF 07
1328: NOP
1329: BCF 03.5
132A: BSF 20.3
132B: MOVF 20,W
132C: BSF 03.5
132D: MOVWF 07
132E: BCF 03.5
132F: BTFSS 07.3
1330: GOTO 32F
1331: NOP
1332: GOTO 333
1333: NOP
1334: BSF 20.4
1335: MOVF 20,W
1336: BSF 03.5
1337: MOVWF 07
1338: NOP
....................
.................... i2c_start();
1339: BCF 03.5
133A: BSF 20.4
133B: MOVF 20,W
133C: BSF 03.5
133D: MOVWF 07
133E: NOP
133F: BCF 03.5
1340: BSF 20.3
1341: MOVF 20,W
1342: BSF 03.5
1343: MOVWF 07
1344: NOP
1345: BCF 03.5
1346: BCF 07.4
1347: BCF 20.4
1348: MOVF 20,W
1349: BSF 03.5
134A: MOVWF 07
134B: NOP
134C: BCF 03.5
134D: BCF 07.3
134E: BCF 20.3
134F: MOVF 20,W
1350: BSF 03.5
1351: MOVWF 07
.................... I2C_Write(0x38);
1352: MOVLW 38
1353: BCF 03.5
1354: MOVWF 3C
1355: BCF 0A.4
1356: CALL 104
1357: BSF 0A.4
.................... I2C_write(0x00);
1358: CLRF 3C
1359: BCF 0A.4
135A: CALL 104
135B: BSF 0A.4
.................... // i2c_stop();
.................... i2c_start();
135C: BSF 20.4
135D: MOVF 20,W
135E: BSF 03.5
135F: MOVWF 07
1360: NOP
1361: BCF 03.5
1362: BSF 20.3
1363: MOVF 20,W
1364: BSF 03.5
1365: MOVWF 07
1366: NOP
1367: BCF 03.5
1368: BTFSS 07.3
1369: GOTO 368
136A: BCF 07.4
136B: BCF 20.4
136C: MOVF 20,W
136D: BSF 03.5
136E: MOVWF 07
136F: NOP
1370: BCF 03.5
1371: BCF 07.3
1372: BCF 20.3
1373: MOVF 20,W
1374: BSF 03.5
1375: MOVWF 07
.................... I2C_Write(0x39);
1376: MOVLW 39
1377: BCF 03.5
1378: MOVWF 3C
1379: BCF 0A.4
137A: CALL 104
137B: BSF 0A.4
.................... ZL=i2c_read(0);
137C: CLRF 77
137D: BCF 0A.4
137E: CALL 14E
137F: BSF 0A.4
1380: MOVF 78,W
1381: MOVWF 39
.................... i2c_stop();
1382: BCF 20.4
1383: MOVF 20,W
1384: BSF 03.5
1385: MOVWF 07
1386: NOP
1387: BCF 03.5
1388: BSF 20.3
1389: MOVF 20,W
138A: BSF 03.5
138B: MOVWF 07
138C: BCF 03.5
138D: BTFSS 07.3
138E: GOTO 38D
138F: NOP
1390: GOTO 391
1391: NOP
1392: BSF 20.4
1393: MOVF 20,W
1394: BSF 03.5
1395: MOVWF 07
1396: NOP
....................
.................... printf("Stav: %ud(procenta)\r\n", XL);
1397: MOVLW 10
1398: BCF 03.5
1399: BSF 03.6
139A: MOVWF 0D
139B: MOVLW 00
139C: MOVWF 0F
139D: BCF 03.0
139E: MOVLW 06
139F: BCF 03.6
13A0: MOVWF 3D
13A1: BCF 0A.4
13A2: CALL 193
13A3: BSF 0A.4
13A4: MOVF 35,W
13A5: MOVWF 3C
13A6: MOVLW 1B
13A7: MOVWF 3D
13A8: BCF 0A.4
13A9: CALL 1F7
13AA: BSF 0A.4
13AB: MOVLW 14
13AC: BSF 03.6
13AD: MOVWF 0D
13AE: MOVLW 00
13AF: MOVWF 0F
13B0: BCF 03.0
13B1: MOVLW 0D
13B2: BCF 03.6
13B3: MOVWF 3D
13B4: BCF 0A.4
13B5: CALL 193
13B6: BSF 0A.4
.................... printf("Stav: %ud(procenta)\r\n", XH);
13B7: MOVLW 1B
13B8: BSF 03.6
13B9: MOVWF 0D
13BA: MOVLW 00
13BB: MOVWF 0F
13BC: BCF 03.0
13BD: MOVLW 06
13BE: BCF 03.6
13BF: MOVWF 3D
13C0: BCF 0A.4
13C1: CALL 193
13C2: BSF 0A.4
13C3: MOVF 36,W
13C4: MOVWF 3C
13C5: MOVLW 1B
13C6: MOVWF 3D
13C7: BCF 0A.4
13C8: CALL 1F7
13C9: BSF 0A.4
13CA: MOVLW 1F
13CB: BSF 03.6
13CC: MOVWF 0D
13CD: MOVLW 00
13CE: MOVWF 0F
13CF: BCF 03.0
13D0: MOVLW 0D
13D1: BCF 03.6
13D2: MOVWF 3D
13D3: BCF 0A.4
13D4: CALL 193
13D5: BSF 0A.4
.................... printf("Stav: %ud(procenta)\r\n", YL);
13D6: MOVLW 26
13D7: BSF 03.6
13D8: MOVWF 0D
13D9: MOVLW 00
13DA: MOVWF 0F
13DB: BCF 03.0
13DC: MOVLW 06
13DD: BCF 03.6
13DE: MOVWF 3D
13DF: BCF 0A.4
13E0: CALL 193
13E1: BSF 0A.4
13E2: MOVF 37,W
13E3: MOVWF 3C
13E4: MOVLW 1B
13E5: MOVWF 3D
13E6: BCF 0A.4
13E7: CALL 1F7
13E8: BSF 0A.4
13E9: MOVLW 2A
13EA: BSF 03.6
13EB: MOVWF 0D
13EC: MOVLW 00
13ED: MOVWF 0F
13EE: BCF 03.0
13EF: MOVLW 0D
13F0: BCF 03.6
13F1: MOVWF 3D
13F2: BCF 0A.4
13F3: CALL 193
13F4: BSF 0A.4
.................... printf("Stav: %ud(procenta)\r\n", YH);
13F5: MOVLW 31
13F6: BSF 03.6
13F7: MOVWF 0D
13F8: MOVLW 00
13F9: MOVWF 0F
13FA: BCF 03.0
13FB: MOVLW 06
13FC: BCF 03.6
13FD: MOVWF 3D
13FE: BCF 0A.4
13FF: CALL 193
1400: BSF 0A.4
1401: MOVF 38,W
1402: MOVWF 3C
1403: MOVLW 1B
1404: MOVWF 3D
1405: BCF 0A.4
1406: CALL 1F7
1407: BSF 0A.4
1408: MOVLW 35
1409: BSF 03.6
140A: MOVWF 0D
140B: MOVLW 00
140C: MOVWF 0F
140D: BCF 03.0
140E: MOVLW 0D
140F: BCF 03.6
1410: MOVWF 3D
1411: BCF 0A.4
1412: CALL 193
1413: BSF 0A.4
.................... printf("Stav: %ud(procenta)\r\n", ZL);
1414: MOVLW 3C
1415: BSF 03.6
1416: MOVWF 0D
1417: MOVLW 00
1418: MOVWF 0F
1419: BCF 03.0
141A: MOVLW 06
141B: BCF 03.6
141C: MOVWF 3D
141D: BCF 0A.4
141E: CALL 193
141F: BSF 0A.4
1420: MOVF 39,W
1421: MOVWF 3C
1422: MOVLW 1B
1423: MOVWF 3D
1424: BCF 0A.4
1425: CALL 1F7
1426: BSF 0A.4
1427: MOVLW 40
1428: BSF 03.6
1429: MOVWF 0D
142A: MOVLW 00
142B: MOVWF 0F
142C: BCF 03.0
142D: MOVLW 0D
142E: BCF 03.6
142F: MOVWF 3D
1430: BCF 0A.4
1431: CALL 193
1432: BSF 0A.4
.................... printf("Stav: %ud(procenta)\r\n", ZH);
1433: MOVLW 47
1434: BSF 03.6
1435: MOVWF 0D
1436: MOVLW 00
1437: MOVWF 0F
1438: BCF 03.0
1439: MOVLW 06
143A: BCF 03.6
143B: MOVWF 3D
143C: BCF 0A.4
143D: CALL 193
143E: BSF 0A.4
143F: MOVF 3A,W
1440: MOVWF 3C
1441: MOVLW 1B
1442: MOVWF 3D
1443: BCF 0A.4
1444: CALL 1F7
1445: BSF 0A.4
1446: MOVLW 4B
1447: BSF 03.6
1448: MOVWF 0D
1449: MOVLW 00
144A: MOVWF 0F
144B: BCF 03.0
144C: MOVLW 0D
144D: BCF 03.6
144E: MOVWF 3D
144F: BCF 0A.4
1450: CALL 193
1451: BSF 0A.4
....................
....................
.................... X = (((unsigned int16) XH << 8) + XL );
1452: CLRF 3D
1453: MOVF 36,W
1454: MOVWF 3C
1455: MOVWF 3D
1456: CLRF 3C
1457: MOVF 35,W
1458: ADDWF 3C,W
1459: MOVWF 27
145A: MOVF 3D,W
145B: MOVWF 28
145C: BTFSC 03.0
145D: INCF 28,F
.................... Y = (((unsigned int16) YH << 8) + YL);
145E: CLRF 3D
145F: MOVF 38,W
1460: MOVWF 3C
1461: MOVWF 3D
1462: CLRF 3C
1463: MOVF 37,W
1464: ADDWF 3C,W
1465: MOVWF 29
1466: MOVF 3D,W
1467: MOVWF 2A
1468: BTFSC 03.0
1469: INCF 2A,F
.................... Z = (((unsigned int16) ZH << 8) + ZL);
146A: CLRF 3D
146B: MOVF 3A,W
146C: MOVWF 3C
146D: MOVWF 3D
146E: CLRF 3C
146F: MOVF 39,W
1470: ADDWF 3C,W
1471: MOVWF 2B
1472: MOVF 3D,W
1473: MOVWF 2C
1474: BTFSC 03.0
1475: INCF 2C,F
....................
.................... X=X/4;
1476: MOVF 28,W
1477: MOVWF 3D
1478: MOVF 27,W
1479: MOVWF 3C
147A: CLRF 3F
147B: MOVLW 04
147C: MOVWF 3E
147D: BCF 0A.4
147E: CALL 22C
147F: BSF 0A.4
1480: MOVF 79,W
1481: MOVWF 28
1482: MOVF 78,W
1483: MOVWF 27
.................... Y=Y/4;
1484: MOVF 2A,W
1485: MOVWF 3D
1486: MOVF 29,W
1487: MOVWF 3C
1488: CLRF 3F
1489: MOVLW 04
148A: MOVWF 3E
148B: BCF 0A.4
148C: CALL 22C
148D: BSF 0A.4
148E: MOVF 79,W
148F: MOVWF 2A
1490: MOVF 78,W
1491: MOVWF 29
.................... Z=Z/4;
1492: MOVF 2C,W
1493: MOVWF 3D
1494: MOVF 2B,W
1495: MOVWF 3C
1496: CLRF 3F
1497: MOVLW 04
1498: MOVWF 3E
1499: BCF 0A.4
149A: CALL 22C
149B: BSF 0A.4
149C: MOVF 79,W
149D: MOVWF 2C
149E: MOVF 78,W
149F: MOVWF 2B
.................... //X = X>>2;
.................... //Y = Y>>2;
.................... //Z = Z>>2;
....................
....................
....................
.................... printf("Stav: %d (procenta)\r\n", ack);
14A0: MOVLW 00
14A1: BTFSC 3B.0
14A2: MOVLW 01
14A3: MOVWF 3C
14A4: MOVLW 52
14A5: BSF 03.6
14A6: MOVWF 0D
14A7: MOVLW 00
14A8: MOVWF 0F
14A9: BCF 03.0
14AA: MOVLW 06
14AB: BCF 03.6
14AC: MOVWF 3D
14AD: BCF 0A.4
14AE: CALL 193
14AF: BSF 0A.4
14B0: MOVF 3C,W
14B1: MOVWF 3D
14B2: MOVLW 1F
14B3: MOVWF 3E
14B4: BCF 0A.4
14B5: GOTO 26A
14B6: BSF 0A.4
14B7: MOVLW 56
14B8: BSF 03.6
14B9: MOVWF 0D
14BA: MOVLW 00
14BB: MOVWF 0F
14BC: BCF 03.0
14BD: MOVLW 0D
14BE: BCF 03.6
14BF: MOVWF 3D
14C0: BCF 0A.4
14C1: CALL 193
14C2: BSF 0A.4
....................
.................... printf("Stavx: %Ld(procenta)\r\n", X);
14C3: MOVLW 5D
14C4: BSF 03.6
14C5: MOVWF 0D
14C6: MOVLW 00
14C7: MOVWF 0F
14C8: BCF 03.0
14C9: MOVLW 07
14CA: BCF 03.6
14CB: MOVWF 3D
14CC: BCF 0A.4
14CD: CALL 193
14CE: BSF 0A.4
14CF: MOVLW 10
14D0: MOVWF 04
14D1: MOVF 28,W
14D2: MOVWF 3D
14D3: MOVF 27,W
14D4: MOVWF 3C
14D5: BCF 0A.4
14D6: CALL 2D1
14D7: BSF 0A.4
14D8: MOVLW 62
14D9: BSF 03.6
14DA: MOVWF 0D
14DB: MOVLW 00
14DC: MOVWF 0F
14DD: BCF 03.0
14DE: MOVLW 0C
14DF: BCF 03.6
14E0: MOVWF 3D
14E1: BCF 0A.4
14E2: CALL 193
14E3: BSF 0A.4
.................... printf("Stavy: %Ld(procenta)\r\n", Y);
14E4: MOVLW 69
14E5: BSF 03.6
14E6: MOVWF 0D
14E7: MOVLW 00
14E8: MOVWF 0F
14E9: BCF 03.0
14EA: MOVLW 07
14EB: BCF 03.6
14EC: MOVWF 3D
14ED: BCF 0A.4
14EE: CALL 193
14EF: BSF 0A.4
14F0: MOVLW 10
14F1: MOVWF 04
14F2: MOVF 2A,W
14F3: MOVWF 3D
14F4: MOVF 29,W
14F5: MOVWF 3C
14F6: BCF 0A.4
14F7: CALL 2D1
14F8: BSF 0A.4
14F9: MOVLW 6E
14FA: BSF 03.6
14FB: MOVWF 0D
14FC: MOVLW 00
14FD: MOVWF 0F
14FE: BCF 03.0
14FF: MOVLW 0C
1500: BCF 03.6
1501: MOVWF 3D
1502: BCF 0A.4
1503: CALL 193
1504: BSF 0A.4
.................... printf("Stavz: %Ld(procenta)\r\n", Z);
1505: MOVLW 75
1506: BSF 03.6
1507: MOVWF 0D
1508: MOVLW 00
1509: MOVWF 0F
150A: BCF 03.0
150B: MOVLW 07
150C: BCF 03.6
150D: MOVWF 3D
150E: BCF 0A.4
150F: CALL 193
1510: BSF 0A.4
1511: MOVLW 10
1512: MOVWF 04
1513: MOVF 2C,W
1514: MOVWF 3D
1515: MOVF 2B,W
1516: MOVWF 3C
1517: BCF 0A.4
1518: CALL 2D1
1519: BSF 0A.4
151A: MOVLW 7A
151B: BSF 03.6
151C: MOVWF 0D
151D: MOVLW 00
151E: MOVWF 0F
151F: BCF 03.0
1520: MOVLW 0C
1521: BCF 03.6
1522: MOVWF 3D
1523: BCF 0A.4
1524: CALL 193
1525: BSF 0A.4
....................
....................
....................
.................... a=(float)Y/Z;
1526: MOVF 2A,W
1527: MOVWF 41
1528: MOVF 29,W
1529: MOVWF 40
152A: BCF 0A.4
152B: CALL 351
152C: BSF 0A.4
152D: MOVF 77,W
152E: MOVWF 3C
152F: MOVF 78,W
1530: MOVWF 3D
1531: MOVF 79,W
1532: MOVWF 3E
1533: MOVF 7A,W
1534: MOVWF 3F
1535: MOVF 2C,W
1536: MOVWF 41
1537: MOVF 2B,W
1538: MOVWF 40
1539: BCF 0A.4
153A: CALL 351
153B: BSF 0A.4
153C: MOVF 3F,W
153D: MOVWF 54
153E: MOVF 3E,W
153F: MOVWF 53
1540: MOVF 3D,W
1541: MOVWF 52
1542: MOVF 3C,W
1543: MOVWF 51
1544: MOVF 7A,W
1545: MOVWF 58
1546: MOVF 79,W
1547: MOVWF 57
1548: MOVF 78,W
1549: MOVWF 56
154A: MOVF 77,W
154B: MOVWF 55
154C: BCF 0A.4
154D: CALL 376
154E: BSF 0A.4
154F: MOVF 7A,W
1550: MOVWF 30
1551: MOVF 79,W
1552: MOVWF 2F
1553: MOVF 78,W
1554: MOVWF 2E
1555: MOVF 77,W
1556: MOVWF 2D
.................... printf("y/z %10.2f \r\n", a);
1557: MOVLW 81
1558: BSF 03.6
1559: MOVWF 0D
155A: MOVLW 00
155B: MOVWF 0F
155C: BCF 03.0
155D: MOVLW 04
155E: BCF 03.6
155F: MOVWF 3D
1560: BCF 0A.4
1561: CALL 193
1562: BSF 0A.4
1563: MOVLW 09
1564: MOVWF 04
1565: MOVF 30,W
1566: MOVWF 3F
1567: MOVF 2F,W
1568: MOVWF 3E
1569: MOVF 2E,W
156A: MOVWF 3D
156B: MOVF 2D,W
156C: MOVWF 3C
156D: MOVLW 02
156E: MOVWF 40
156F: BCF 0A.4
1570: CALL 4F7
1571: BSF 0A.4
1572: MOVLW 20
1573: MOVWF 49
1574: BCF 0A.4
1575: CALL 098
1576: BSF 0A.4
1577: MOVLW 0D
1578: MOVWF 49
1579: BCF 0A.4
157A: CALL 098
157B: BSF 0A.4
157C: MOVLW 0A
157D: MOVWF 49
157E: BCF 0A.4
157F: CALL 098
1580: BSF 0A.4
.................... b=atan(a);
1581: MOVF 30,W
1582: MOVWF 3F
1583: MOVF 2F,W
1584: MOVWF 3E
1585: MOVF 2E,W
1586: MOVWF 3D
1587: MOVF 2D,W
1588: MOVWF 3C
1589: BCF 0A.4
158A: BSF 0A.3
158B: GOTO 000
158C: BSF 0A.4
158D: BCF 0A.3
158E: MOVF 7A,W
158F: MOVWF 34
1590: MOVF 79,W
1591: MOVWF 33
1592: MOVF 78,W
1593: MOVWF 32
1594: MOVF 77,W
1595: MOVWF 31
.................... printf("atan %10.2f \r\n", b);
1596: MOVLW 88
1597: BSF 03.6
1598: MOVWF 0D
1599: MOVLW 00
159A: MOVWF 0F
159B: BCF 03.0
159C: MOVLW 05
159D: BCF 03.6
159E: MOVWF 3D
159F: BCF 0A.4
15A0: CALL 193
15A1: BSF 0A.4
15A2: MOVLW 09
15A3: MOVWF 04
15A4: MOVF 34,W
15A5: MOVWF 3F
15A6: MOVF 33,W
15A7: MOVWF 3E
15A8: MOVF 32,W
15A9: MOVWF 3D
15AA: MOVF 31,W
15AB: MOVWF 3C
15AC: MOVLW 02
15AD: MOVWF 40
15AE: BCF 0A.4
15AF: CALL 4F7
15B0: BSF 0A.4
15B1: MOVLW 20
15B2: MOVWF 49
15B3: BCF 0A.4
15B4: CALL 098
15B5: BSF 0A.4
15B6: MOVLW 0D
15B7: MOVWF 49
15B8: BCF 0A.4
15B9: CALL 098
15BA: BSF 0A.4
15BB: MOVLW 0A
15BC: MOVWF 49
15BD: BCF 0A.4
15BE: CALL 098
15BF: BSF 0A.4
.................... b = (b/3.14)*180;
15C0: MOVF 34,W
15C1: MOVWF 54
15C2: MOVF 33,W
15C3: MOVWF 53
15C4: MOVF 32,W
15C5: MOVWF 52
15C6: MOVF 31,W
15C7: MOVWF 51
15C8: MOVLW C3
15C9: MOVWF 58
15CA: MOVLW F5
15CB: MOVWF 57
15CC: MOVLW 48
15CD: MOVWF 56
15CE: MOVLW 80
15CF: MOVWF 55
15D0: BCF 0A.4
15D1: CALL 376
15D2: BSF 0A.4
15D3: MOVF 77,W
15D4: MOVWF 3C
15D5: MOVF 78,W
15D6: MOVWF 3D
15D7: MOVF 79,W
15D8: MOVWF 3E
15D9: MOVF 7A,W
15DA: MOVWF 3F
15DB: MOVWF 54
15DC: MOVF 3E,W
15DD: MOVWF 53
15DE: MOVF 3D,W
15DF: MOVWF 52
15E0: MOVF 3C,W
15E1: MOVWF 51
15E2: CLRF 58
15E3: CLRF 57
15E4: MOVLW 34
15E5: MOVWF 56
15E6: MOVLW 86
15E7: MOVWF 55
15E8: BCF 0A.4
15E9: CALL 440
15EA: BSF 0A.4
15EB: MOVF 7A,W
15EC: MOVWF 34
15ED: MOVF 79,W
15EE: MOVWF 33
15EF: MOVF 78,W
15F0: MOVWF 32
15F1: MOVF 77,W
15F2: MOVWF 31
.................... b=abs(b);
15F3: MOVF 31,W
15F4: MOVWF 77
15F5: MOVF 32,W
15F6: MOVWF 78
15F7: MOVF 33,W
15F8: MOVWF 79
15F9: MOVF 34,W
15FA: MOVWF 7A
15FB: BCF 78.7
15FC: MOVF 34,W
15FD: MOVWF 34
15FE: MOVF 33,W
15FF: MOVWF 33
1600: MOVF 78,W
1601: MOVWF 32
1602: MOVF 31,W
1603: MOVWF 31
.................... b=90-b;
1604: BSF 03.1
1605: CLRF 54
1606: CLRF 53
1607: MOVLW 34
1608: MOVWF 52
1609: MOVLW 85
160A: MOVWF 51
160B: MOVF 34,W
160C: MOVWF 58
160D: MOVF 33,W
160E: MOVWF 57
160F: MOVF 32,W
1610: MOVWF 56
1611: MOVF 31,W
1612: MOVWF 55
1613: BCF 0A.4
1614: CALL 61D
1615: BSF 0A.4
1616: MOVF 7A,W
1617: MOVWF 34
1618: MOVF 79,W
1619: MOVWF 33
161A: MOVF 78,W
161B: MOVWF 32
161C: MOVF 77,W
161D: MOVWF 31
.................... printf("uhel %10.2f \r\n", b);
161E: MOVLW 90
161F: BSF 03.6
1620: MOVWF 0D
1621: MOVLW 00
1622: MOVWF 0F
1623: BCF 03.0
1624: MOVLW 05
1625: BCF 03.6
1626: MOVWF 3D
1627: BCF 0A.4
1628: CALL 193
1629: BSF 0A.4
162A: MOVLW 09
162B: MOVWF 04
162C: MOVF 34,W
162D: MOVWF 3F
162E: MOVF 33,W
162F: MOVWF 3E
1630: MOVF 32,W
1631: MOVWF 3D
1632: MOVF 31,W
1633: MOVWF 3C
1634: MOVLW 02
1635: MOVWF 40
1636: BCF 0A.4
1637: CALL 4F7
1638: BSF 0A.4
1639: MOVLW 20
163A: MOVWF 49
163B: BCF 0A.4
163C: CALL 098
163D: BSF 0A.4
163E: MOVLW 0D
163F: MOVWF 49
1640: BCF 0A.4
1641: CALL 098
1642: BSF 0A.4
1643: MOVLW 0A
1644: MOVWF 49
1645: BCF 0A.4
1646: CALL 098
1647: BSF 0A.4
....................
.................... delay_ms (2000);
1648: MOVLW 08
1649: MOVWF 3C
164A: MOVLW FA
164B: MOVWF 3D
164C: BCF 0A.4
164D: GOTO 75E
164E: BSF 0A.4
164F: DECFSZ 3C,F
1650: GOTO 64A
....................
.................... }
1651: GOTO 0AC
.................... }
1652: SLEEP
Configuration Fuses:
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40