CCS PCM C Compiler, Version 4.106, 47914 16-4-13 01:14Filename: c:\users\honza\documents\pic\meteo_stanice\main.lstROM used: 3527 words (43%)Largest free fragment is 2048RAM used: 36 (10%) at main() level89 (24%) worst caseStack: 3 locations*0000: MOVLW 0B0001: MOVWF 0A0002: GOTO 30B0003: NOP.................... //Meteorologicka cast.................... #define VERSION "0.1".................... #define AUTOR "Jan Chroust".................... #define DATE "15.4.2013"................................................................................ #include "C:\Users\Honza\Documents\pic\meteo_stanice\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)*02A0: MOVLW 5202A1: MOVWF 0402A2: BCF 03.702A3: MOVF 00,W02A4: BTFSC 03.202A5: GOTO 2B302A6: MOVLW 0202A7: MOVWF 7802A8: CLRF 7702A9: DECFSZ 77,F02AA: GOTO 2A902AB: DECFSZ 78,F02AC: GOTO 2A802AD: MOVLW 9702AE: MOVWF 7702AF: DECFSZ 77,F02B0: GOTO 2AF02B1: DECFSZ 00,F02B2: GOTO 2A602B3: RETURN................................................................................ #define PIN_SDA PIN_B0.................... #define PIN_SCL PIN_B1.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL)*01FB: MOVLW 0801FC: MOVWF 7801FD: NOP01FE: BCF 06.101FF: BSF 03.50200: BCF 06.10201: NOP0202: BCF 03.50203: RLF 5F,F0204: BCF 06.00205: BTFSS 03.00206: GOTO 20A0207: BSF 03.50208: BSF 06.00209: BCF 03.5020A: BTFSC 03.0020B: GOTO 20F020C: BSF 03.5020D: BCF 06.0020E: BCF 03.5020F: BSF 03.50210: BSF 06.10211: BCF 03.50212: BTFSS 06.10213: GOTO 2120214: DECFSZ 78,F0215: GOTO 1FD0216: NOP0217: BCF 06.10218: BSF 03.50219: BCF 06.1021A: NOP021B: BSF 06.0021C: NOP021D: NOP021E: BSF 06.1021F: BCF 03.50220: BTFSS 06.10221: GOTO 2200222: CLRF 780223: NOP0224: BTFSC 06.00225: BSF 78.00226: BCF 06.10227: BSF 03.50228: BCF 06.10229: BCF 03.5022A: BCF 06.0022B: BSF 03.5022C: BCF 06.0022D: BCF 03.5022E: RETURN*02B4: MOVLW 0802B5: MOVWF 6002B6: MOVF 77,W02B7: MOVWF 6102B8: BSF 03.502B9: BSF 06.002BA: NOP02BB: BSF 06.102BC: BCF 03.502BD: BTFSS 06.102BE: GOTO 2BD02BF: BTFSC 06.002C0: BSF 03.002C1: BTFSS 06.002C2: BCF 03.002C3: RLF 78,F02C4: NOP02C5: BSF 03.502C6: BCF 06.102C7: BCF 03.502C8: BCF 06.102C9: DECFSZ 60,F02CA: GOTO 2B802CB: BSF 03.502CC: BSF 06.002CD: NOP02CE: BCF 03.502CF: BCF 06.002D0: MOVF 61,W02D1: BTFSC 03.202D2: GOTO 2D602D3: BSF 03.502D4: BCF 06.002D5: BCF 03.502D6: NOP02D7: BSF 03.502D8: BSF 06.102D9: BCF 03.502DA: BTFSS 06.102DB: GOTO 2DA02DC: NOP02DD: BCF 06.102DE: BSF 03.502DF: BCF 06.102E0: NOP02E1: BCF 03.502E2: BCF 06.002E3: BSF 03.502E4: BCF 06.002E5: BCF 03.502E6: RETURN.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD*009A: BSF 03.5009B: BCF 06.3009C: BCF 03.5009D: BCF 06.3009E: MOVLW 08009F: MOVWF 7800A0: GOTO 0A100A1: NOP00A2: BSF 78.700A3: GOTO 0B200A4: BCF 78.700A5: RRF 51,F00A6: BTFSC 03.000A7: BSF 06.300A8: BTFSS 03.000A9: BCF 06.300AA: BSF 78.600AB: GOTO 0B200AC: BCF 78.600AD: DECFSZ 78,F00AE: GOTO 0A500AF: GOTO 0B000B0: NOP00B1: BSF 06.300B2: MOVLW 3F00B3: MOVWF 0400B4: DECFSZ 04,F00B5: GOTO 0B400B6: NOP00B7: BTFSC 78.700B8: GOTO 0A400B9: BTFSC 78.600BA: GOTO 0AC00BB: 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;.................... 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 functions for atan() for PCD.................... // Overloaded function atan() for data type - Float48.................... #if defined(__PCD__).................... float48 atan(float48 x).................... {.................... float48 y, res, r;.................... int1 s, flag;........................................ s = 0;.................... flag = 0;.................... y = x;........................................ if (x < 0).................... {.................... s = 1;.................... y = -y;.................... }........................................ if (y > 1.0).................... {.................... y = 1.0/y;.................... flag = 1;.................... }........................................ res = pat[0]*y*y + pat[1];.................... res = res*y*y + pat[2];.................... res = res*y*y + pat[3];........................................ r = qat[0]*y*y + qat[1];.................... r = r*y*y + qat[2];.................... r = r*y*y + qat[3];........................................ res = y*res/r;............................................................ if (flag) // for |x| > 1.................... res = PI_DIV_BY_TWO - res;.................... if (s).................... res = -res;........................................ return(res);.................... }........................................ // Overloaded function atan() for data type - Float64.................... float64 atan(float64 x).................... {.................... float64 y, res, r;.................... int1 s, flag;........................................ s = 0;.................... flag = 0;.................... y = x;........................................ if (x < 0).................... {.................... s = 1;.................... y = -y;.................... }........................................ if (y > 1.0).................... {.................... y = 1.0/y;.................... flag = 1;.................... }........................................ res = pat[0]*y*y + pat[1];.................... res = res*y*y + pat[2];.................... res = res*y*y + pat[3];........................................ r = qat[0]*y*y + qat[1];.................... r = r*y*y + qat[2];.................... r = r*y*y + qat[3];........................................ res = y*res/r;............................................................ if (flag) // for |x| > 1.................... res = PI_DIV_BY_TWO - res;.................... if (s).................... res = -res;........................................ return(res);.................... }.................... #endif........................................ /////////////////////////////////////////////////////////////////////////////.................... // float atan2(float y, float x).................... /////////////////////////////////////////////////////////////////////////////.................... // Description :computes the principal value of arc tangent of y/x, using the.................... // signs of both the arguments to determine the quadrant of the return value.................... // Returns : returns the arc tangent of y/x..................... // Date : N/A.................... //........................................ float32 atan2(float32 y,float32 x).................... {.................... float32 z;.................... int1 sign;.................... unsigned int8 quad;.................... sign=0;.................... quad=0; //quadrant.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));.................... if(y<0.0).................... {.................... sign=1;.................... y=-y;.................... }.................... if(x<0.0).................... {.................... x=-x;.................... }.................... if (x==0.0).................... {.................... if(y==0.0).................... {.................... #ifdef _ERRNO.................... {.................... errno=EDOM;.................... }.................... #endif.................... }.................... else.................... {.................... if(sign).................... {.................... return (-(PI_DIV_BY_TWO));.................... }.................... else.................... {.................... return (PI_DIV_BY_TWO);.................... }.................... }.................... }.................... else.................... {.................... z=y/x;.................... switch(quad).................... {.................... case 1:.................... {.................... return atan(z);.................... break;.................... }.................... case 2:.................... {.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122.................... return (PI-atan(z));.................... break;.................... }.................... case 3:.................... {.................... return (atan(z)-PI);.................... break;.................... }.................... case 4:.................... {.................... return (-atan(z));.................... break;.................... }.................... }.................... }.................... }........................................ //Overloaded functions for atan2() for PCD.................... // Overloaded function atan2() for data type - Float48.................... #if defined(__PCD__).................... float48 atan2(float48 y,float48 x).................... {.................... float48 z;.................... int1 sign;.................... unsigned int8 quad;.................... sign=0;.................... quad=0; //quadrant.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));.................... if(y<0.0).................... {.................... sign=1;.................... y=-y;.................... }.................... if(x<0.0).................... {.................... x=-x;.................... }.................... if (x==0.0).................... {.................... if(y==0.0).................... {.................... #ifdef _ERRNO.................... {.................... errno=EDOM;.................... }.................... #endif.................... }.................... else.................... {.................... if(sign).................... {.................... return (-(PI_DIV_BY_TWO));.................... }.................... else.................... {.................... return (PI_DIV_BY_TWO);.................... }.................... }.................... }.................... else.................... {.................... z=y/x;.................... switch(quad).................... {.................... case 1:.................... {.................... return atan(z);.................... break;.................... }.................... case 2:.................... {.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122.................... return (PI-atan(z));.................... break;.................... }.................... case 3:.................... {.................... return (atan(z)-PI);.................... break;.................... }.................... case 4:.................... {.................... return (-atan(z));.................... break;.................... }.................... }.................... }.................... }........................................ // Overloaded function atan2() for data type - Float64.................... float64 atan2(float64 y,float64 x).................... {.................... float64 z;.................... int1 sign;.................... unsigned int8 quad;.................... sign=0;.................... quad=0; //quadrant.................... quad=((y<=0.0)?((x<=0.0)?3:4):((x<0.0)?2:1));.................... if(y<0.0).................... {.................... sign=1;.................... y=-y;.................... }.................... if(x<0.0).................... {.................... x=-x;.................... }.................... if (x==0.0).................... {.................... if(y==0.0).................... {.................... #ifdef _ERRNO.................... {.................... errno=EDOM;.................... }.................... #endif.................... }.................... else.................... {.................... if(sign).................... {.................... return (-(PI_DIV_BY_TWO));.................... }.................... else.................... {.................... return (PI_DIV_BY_TWO);.................... }.................... }.................... }.................... else.................... {.................... z=y/x;.................... switch(quad).................... {.................... case 1:.................... {.................... return atan(z);.................... break;.................... }.................... case 2:.................... {.................... // return (atan(z)+PI_DIV_BY_TWO); //2L3122.................... return (PI-atan(z));.................... break;.................... }.................... case 3:.................... {.................... return (atan(z)-PI);.................... break;.................... }.................... case 4:.................... {.................... return (-atan(z));.................... break;.................... }.................... }.................... }.................... }.................... #endif........................................ //////////////////// Hyperbolic functions ////////////////////........................................ ////////////////////////////////////////////////////////////////////////////.................... // float cosh(float x).................... ////////////////////////////////////////////////////////////////////////////.................... // Description : Computes the hyperbolic cosine value of x.................... // Returns : returns the hyperbolic cosine value of x.................... // Date : N/A.................... //........................................ float32 cosh(float32 x).................... {.................... return ((exp(x)+exp(-x))/2);.................... }.................... //Overloaded functions for cosh() for PCD.................... // Overloaded function cosh() for data type - Float48.................... #if defined(__PCD__).................... float48 cosh(float48 x).................... {.................... return ((exp(x)+exp(-x))/2);.................... }........................................ // Overloaded function cosh() for data type - Float64.................... float64 cosh(float64 x).................... {.................... return ((exp(x)+exp(-x))/2);.................... }.................... #endif........................................ ////////////////////////////////////////////////////////////////////////////.................... // float sinh(float x).................... ////////////////////////////////////////////////////////////////////////////.................... // Description : Computes the hyperbolic sine value of x.................... // Returns : returns the hyperbolic sine value of x.................... // Date : N/A.................... //........................................ float32 sinh(float32 x).................... {........................................ return ((exp(x) - exp(-x))/2);.................... }.................... //Overloaded functions for sinh() for PCD.................... // Overloaded function sinh() for data type - Float48.................... #if defined(__PCD__).................... float48 sinh(float48 x).................... {........................................ return ((exp(x) - exp(-x))/2);.................... }........................................ // Overloaded function sinh() for data type - Float48.................... float64 sinh(float64 x).................... {........................................ return ((exp(x) - exp(-x))/2);.................... }.................... #endif........................................ ////////////////////////////////////////////////////////////////////////////.................... // float tanh(float x).................... ////////////////////////////////////////////////////////////////////////////.................... // Description : Computes the hyperbolic tangent value of x.................... // Returns : returns the hyperbolic tangent value of x.................... // Date : N/A.................... //........................................ float32 tanh(float32 x).................... {.................... return(sinh(x)/cosh(x));.................... }.................... //Overloaded functions for tanh() for PCD.................... // Overloaded function tanh() for data type - Float48.................... #if defined(__PCD__).................... float48 tanh(float48 x).................... {.................... return(sinh(x)/cosh(x));.................... }........................................ // Overloaded function tanh() for data type - Float64.................... float64 tanh(float64 x).................... {.................... return(sinh(x)/cosh(x));.................... }.................... #endif........................................ ////////////////////////////////////////////////////////////////////////////.................... // float frexp(float x, signed int *exp).................... ////////////////////////////////////////////////////////////////////////////.................... // Description : breaks a floating point number into a normalized fraction and an integral.................... // power of 2. It stores the integer in the signed int object pointed to by exp..................... // Returns : returns the value x, such that x is a double with magnitude in the interval.................... // [1/2,1) or zero, and value equals x times 2 raised to the power *exp.If value is zero,.................... // both parts of the result are zero..................... // Date : N/A.................... //........................................ #define LOG2 .30102999566398119521.................... float32 frexp(float32 x, signed int8 *exp).................... {.................... float32 res;.................... int1 sign = 0;.................... if(x == 0.0).................... {.................... *exp=0;.................... return (0.0);.................... }.................... if(x < 0.0).................... {.................... x=-x;.................... sign=1;.................... }.................... if (x > 1.0).................... {.................... *exp=(ceil(log10(x)/LOG2));.................... res=x/(pow(2, *exp));.................... if (res == 1).................... {.................... *exp=*exp+1;.................... res=.5;.................... }.................... }.................... else.................... {.................... if(x < 0.5).................... {.................... *exp=-1;.................... res=x*2;.................... }.................... else.................... {.................... *exp=0;.................... res=x;.................... }.................... }.................... if(sign).................... {.................... res=-res;.................... }.................... return res;.................... }........................................ //Overloaded functions for frexp() for PCD.................... // Overloaded function frexp() for data type - Float48.................... #if defined(__PCD__).................... float48 frexp(float48 x, signed int8 *exp).................... {.................... float48 res;.................... int1 sign = 0;.................... if(x == 0.0).................... {.................... *exp=0;.................... return (0.0);.................... }.................... if(x < 0.0).................... {.................... x=-x;.................... sign=1;.................... }.................... if (x > 1.0).................... {.................... *exp=(ceil(log10(x)/LOG2));.................... res=x/(pow(2, *exp));.................... if (res == 1).................... {.................... *exp=*exp+1;.................... res=.5;.................... }.................... }.................... else.................... {.................... if(x < 0.5).................... {.................... *exp=-1;.................... res=x*2;.................... }.................... else.................... {.................... *exp=0;.................... res=x;.................... }.................... }.................... if(sign).................... {.................... res=-res;.................... }.................... return res;.................... }........................................ // Overloaded function frexp() for data type - Float64.................... float64 frexp(float64 x, signed int8 *exp).................... {.................... float64 res;.................... int1 sign = 0;.................... if(x == 0.0).................... {.................... *exp=0;.................... return (0.0);.................... }.................... if(x < 0.0).................... {.................... x=-x;.................... sign=1;.................... }.................... if (x > 1.0).................... {.................... *exp=(ceil(log10(x)/LOG2));.................... res=x/(pow(2, *exp));.................... if (res == 1).................... {.................... *exp=*exp+1;.................... res=.5;.................... }.................... }.................... else.................... {.................... if(x < 0.5).................... {.................... *exp=-1;.................... res=x*2;.................... }.................... else.................... {.................... *exp=0;.................... res=x;.................... }.................... }.................... if(sign).................... {.................... res=-res;.................... }.................... return res;.................... }.................... #endif........................................ //////////////////////////////////////////////////////////////////////////////.................... // float ldexp(float x, signed int *exp).................... //////////////////////////////////////////////////////////////////////////////.................... // Description : multiplies a floating point number by an integral power of 2..................... // Returns : returns the value of x times 2 raised to the power exp..................... // Date : N/A.................... //........................................ float32 ldexp(float32 value, signed int8 exp).................... {.................... return (value * pow(2,exp));.................... }.................... //Overloaded functions for ldexp() for PCD.................... // Overloaded function ldexp() for data type - Float48........................................ #if defined(__PCD__).................... float48 ldexp(float48 value, signed int8 exp).................... {.................... return (value * pow(2,exp));.................... }.................... // Overloaded function ldexp() for data type - Float64.................... float64 ldexp(float64 value, signed int8 exp).................... {.................... return (value * pow(2,exp));.................... }.................... #endif........................................ #endif........................................ #include <string.h>.................... ////////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2008 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ////////////////////////////////////////////////////////////////////////////........................................ #ifndef _STRING.................... #define _STRING.................... #include <stddef.h>.................... ///////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ///////////////////////////////////////////////////////////////////////////........................................ #ifndef _STDDEF........................................ #define _STDDEF........................................ #if sizeof(unsigned int8 *)==1.................... #define ptrdiff_t unsigned int8.................... #else.................... #define ptrdiff_t unsigned int16.................... #endif........................................ #define size_t unsigned int8.................... #define wchar_t char.................... #define NULL 0........................................ #define offsetof(s,f) (offsetofbit(s,f)/8)........................................ #endif........................................ #include <ctype.h>.................... ////////////////////////////////////////////////////////////////////////////.................... //// (C) Copyright 1996,2003 Custom Computer Services ////.................... //// This source code may only be used by licensed users of the CCS C ////.................... //// compiler. This source code may only be distributed to other ////.................... //// licensed users of the CCS C compiler. No other use, reproduction ////.................... //// or distribution is permitted without written permission. ////.................... //// Derivative programs created using this software in object code ////.................... //// form are not restricted in any way. ////.................... ////////////////////////////////////////////////////////////////////////////........................................ #ifndef _CTYPE.................... #define _CTYPE........................................ #define islower(x) isamong(x,"abcdefghijklmnopqrstuvwxyz").................... #define isupper(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ").................... #define isalnum(x) isamong(x,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").................... #define isalpha(x) isamong(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz").................... #define isdigit(x) isamong(x,"0123456789").................... #define isspace(x) ((x)==' ').................... #define isxdigit(x) isamong(x,"0123456789ABCDEFabcdef").................... #define iscntrl(x) ((x)<' ').................... #define isprint(x) ((x)>=' ').................... #define isgraph(x) ((x)>' ').................... #define ispunct(x) (((x)>' ')&&!isalnum(x))........................................ #endif........................................................................................................................ //////////////////////////////////////////////.................... //// Uncomment the following define to ////.................... //// allow some functions to use a ////.................... //// quicker algorithm, but use more ROM ////.................... //// ////.................... //// #define FASTER_BUT_MORE_ROM ////.................... //////////////////////////////////////////////................................................................................ /*Copying functions*/.................... /* standard template:.................... void *memmove(void *s1, void *s2, size_t n)..................... Copies max of n characters safely (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *memmove(void *s1,char *s2,size_t n).................... {.................... char *sc1;.................... char *sc2;.................... sc1=s1;.................... sc2=s2;.................... if(sc2<sc1 && sc1 <sc2 +n).................... for(sc1+=n,sc2+=n;0<n;--n).................... *--sc1=*--sc2;.................... else.................... for(;0<n;--n).................... *sc1++=*sc2++;.................... return s1;.................... }........................................ /* Standard template: char *strcpy(char *s1, const char *s2).................... copies the string s2 including the null character to s1..................... This is a compiler built in to handle the different address.................... spaces */........................................ #define strcopy strcpy........................................ /* standard template:.................... char *strncpy(char *s1, const char *s2, size_t n)..................... Copies max of n characters (not following ending '\0').................... from s2 in s1; if s2 has less than n characters, appends 0 */........................................ char *strncpy(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(s1);.................... }.................... /***********************************************************/........................................ /*concatenation functions*/.................... /* standard template: char *strcat(char *s1, const char *s2).................... appends s2 to s1*/........................................ char *strcat(char *s1, char *s2).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0').................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... }........................................ *s = '\0';.................... return(s1);.................... }.................... /* standard template: char *strncat(char *s1, char *s2,size_t n).................... appends not more than n characters from s2 to s1*/........................................ char *strncat(char *s1, char *s2, size_t n).................... {.................... char *s;........................................ for (s = s1; *s != '\0'; ++s);.................... while(*s2 != '\0' && 0<n).................... {.................... *s = *s2;.................... ++s;.................... ++s2;.................... --n;.................... }........................................ *s = '\0';.................... return(s1);.................... }........................................ /***********************************************************/............................................................ /*comparison functions*/.................... /* standard template: signed int memcmp(void *s1, void *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int8 memcmp(void * s1,char *s2,size_t n).................... {.................... char *su1, *su2;.................... for(su1=s1, su2=s2; 0<n; ++su1, ++su2, --n).................... {.................... if(*su1!=*su2).................... return ((*su1<*su2)?-1:+1);.................... }.................... return 0;.................... }........................................ /* standard template: int strcmp(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int8 strcmp(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }.................... /* standard template: int strcoll(const char *s1, const char *s2)..................... Compares s1 & s2; returns -1 if s1<s2, 0 if s1=s2, 1 if s1>s2 */........................................ signed int8 strcoll(char *s1, char *s2).................... {.................... for (; *s1 == *s2; s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }........................................ /* standard template:.................... int strncmp(const char *s1, const char *s2, size_t n)..................... Compares max of n characters (not following 0) from s1 to s2;.................... returns same as strcmp */........................................ signed int8 strncmp(char *s1, char *s2, size_t n).................... {.................... for (; n > 0; s1++, s2++, n--).................... if (*s1 != *s2).................... return((*s1 <*s2) ? -1: 1);.................... else if (*s1 == '\0').................... return(0);.................... return(0);.................... }.................... /* standard template:.................... int strxfrm(const char *s1, const char *s2, size_t n)..................... transforms maximum of n characters from s2 and places them into s1*/.................... size_t strxfrm(char *s1, char *s2, size_t n).................... {.................... char *s;.................... unsigned int8 n1;.................... n1=n;.................... for (s = s1; n > 0 && *s2 != '\0'; n--).................... *s++ = *s2++;.................... for (; n > 0; n--).................... *s++ = '\0';........................................ return(n1);.................... }........................................................................................................................ /***********************************************************/.................... /*Search functions*/.................... /* standard template: void *memchr(const char *s, int c)..................... Finds first occurrence of c in n characters of s */........................................ char *memchr(void *s,unsigned int8 c,size_t n).................... {.................... char uc;.................... char *su;.................... uc=c;.................... for(su=s;0<n;++su,--n).................... if(*su==uc).................... return su;.................... return NULL;.................... }........................................ /* standard template: char *strchr(const char *s, int c)..................... Finds first occurrence of c in s */........................................ char *strchr(char *s, unsigned int8 c).................... {.................... for (; *s != c; s++).................... if (*s == '\0').................... return(0);.................... return(s);.................... }.................... /* standard template:.................... size_t strcspn(const char *s1, const char *s2)..................... Computes length of max initial segment of s1 that.................... consists entirely of characters NOT from s2*/........................................ unsigned int8 strcspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1 - s1);.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strpbrk(const char *s1, const char *s2)..................... Locates first occurence of any character from s2 in s1;.................... returns s1 if s2 is empty string */........................................ char *strpbrk(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; *sc2 != 0; sc2++).................... if (*sc1 == *sc2).................... return(sc1);.................... return(0);.................... }............................................................ /* standard template: char *strrchr(const char *s, int c)..................... Finds last occurrence of c in s */........................................ char *strrchr(char *s, unsigned int8 c).................... {.................... char *p;........................................ for (p = 0; ; s++).................... {.................... if (*s == c).................... p = s;.................... if (*s == '\0').................... return(p);.................... }.................... }.................... /* computes length of max initial segment of s1 consisting.................... entirely of characters from s2 */........................................ unsigned int8 strspn(char *s1, char *s2).................... {.................... char *sc1, *sc2;........................................ for (sc1 = s1; *sc1 != 0; sc1++).................... for (sc2 = s2; ; sc2++).................... if (*sc2 == '\0').................... return(sc1 - s1);.................... else if (*sc1 == *sc2).................... break;.................... return(sc1 - s1);.................... }.................... /* standard template:.................... char *strstr(const char *s1, const char *s2);.................... Locates first occurence of character sequence s2 in s1;.................... returns 0 if s2 is empty string........................................ Uncomment #define FASTER_BUT_MORE_ROM at the top of the.................... file to use the faster algorithm */.................... char *strstr(char *s1, char *s2).................... {.................... char *s, *t;........................................ #ifdef FASTER_BUT_MORE_ROM.................... if (*s2 == '\0').................... return(s1);.................... #endif........................................ while (*s1).................... {.................... for(s = s1, t = s2; *t && (*s == *t); ++s, ++t);........................................ if (*t == '\0').................... return s1;.................... ++s1;.................... #ifdef FASTER_BUT_MORE_ROM.................... while(*s1 != '\0' && *s1 != *s2).................... ++s1;.................... #endif.................... }.................... return 0;.................... }........................................ /* standard template: char *strtok(char *s1, const char *s2)......................................... Finds next token in s1 delimited by a character from separator.................... string s2 (which can be different from call to call). First call.................... starts at beginning of s1 searching for first character NOT.................... contained in s2; returns 0 if none is found..................... If one is found, it is the start of first token (return value)..................... Function then searches from there for a character contained in s2..................... If none is found, current token extends to end of s1, and subsequent.................... searches for a token will return 0. If one is found, it is.................... overwritten by '\0', which terminates current token. Function saves.................... pointer to following character from which next search will start..................... Each subsequent call, with 0 as first argument, starts searching.................... from saved pointer */........................................ char *strtok(char *s1, char *s2).................... {.................... char *beg, *end;.................... static char *save;*0B25: BCF 03.60B26: CLRF 200B27: CLRF 21........................................ beg = (s1)? s1: save;.................... beg += strspn(beg, s2);.................... if (*beg == '\0').................... {.................... *save = ' ';.................... return(0);.................... }.................... end = strpbrk(beg, s2);.................... if (*end != '\0').................... {.................... *end = '\0';.................... end++;.................... }.................... save = end;.................... return(beg);.................... }........................................ /*****************************************************************/.................... /*Miscellaneous functions*/.................... /* standard template.................... maps error number in errnum to an error message string.................... Returns: Pointer to string.................... */.................... #ifdef _ERRNO.................... char * strerror(unsigned int8 errnum).................... {.................... char s[15];.................... switch( errnum).................... {.................... case 0:.................... strcpy(s,"no errors");.................... return s;.................... case EDOM :.................... strcpy(s,"domain error");.................... return s;.................... case ERANGE:.................... strcpy(s,"range error");.................... return s;.................... }.................... }.................... #ENDIF.................... /* standard template: size_t strlen(const char *s)..................... Computes length of s1 (preceding terminating 0) */........................................ unsigned int8 strlen(char *s).................... {.................... char *sc;........................................ for (sc = s; *sc != 0; sc++);.................... return(sc - s);.................... }........................................ /* standard template: size_t stricmp(const char *s1, const char *s2)..................... Compares s1 to s2 ignoring case (upper vs. lower) */........................................ signed int8 stricmp(char *s1, char *s2).................... {.................... for(; *s1==*s2||(isalpha(*s1)&&isalpha(*s2)&&(*s1==*s2+32||*s2==*s1+32));.................... s1++, s2++).................... if (*s1 == '\0').................... return(0);.................... return((*s1 < *s2) ? -1: 1);.................... }............................................................ /* standard template: char *strlwr(char *s)..................... Replaces uppercase letters by lowercase;.................... returns pointer to new string s */........................................ char *strlwr(char *s).................... {.................... char *p;........................................ for (p = s; *p != '\0'; p++).................... if (*p >= 'A' && *p <='Z').................... *p += 'a' - 'A';.................... return(s);.................... }............................................................ /************************************************************/............................................................ #endif............................................................ #include "SHT25.h"........................................ #define SHT25_HEATER_ON 0x04.................... #define SHT25_HEATER_OFF 0x00.................... #define SHT25_OTP_reload_off 0x02.................... #define SHT25_RH12_T14 0x00.................... #define SHT25_RH8_T12 0x01.................... #define SHT25_RH10_T13 0x80.................... #define SHT25_RH11_T11 0x81........................................ #define SHT25_ADDR 0x80........................................ #include "SHT25.c".................... void SHT25_soft_reset().................... {.................... i2c_start(); // Start condition.................... i2c_write(0x80); // Device address.................... i2c_write(0xFE); // Device command.................... i2c_stop(); // Stop condition.................... }........................................ unsigned int8 SHT25_setup(unsigned int8 setup_reg ) // writes to status register and returns its value.................... {.................... unsigned int8 reg;........................................ i2c_start(); // Start condition.................... i2c_write(SHT25_ADDR); // Device address.................... i2c_write(0xE7); // Device command........................................ i2c_start(); // Start condition.................... i2c_write(SHT25_ADDR+1); // Device address.................... reg=i2c_read(0); // Read status actual status register........................................ reg = (reg & 0x3A) | setup_reg;........................................ i2c_start(); // Start condition.................... i2c_write(SHT25_ADDR); // Device address.................... i2c_write(0xE6); // Write to status register.................... i2c_write(reg); // Device command.................... i2c_stop(); // Stop condition........................................ delay_ms(10);........................................ i2c_start(); // Start condition.................... i2c_write(SHT25_ADDR); // Device address.................... i2c_write(0xE7); // Device command........................................ i2c_start(); // Start condition.................... i2c_write(SHT25_ADDR+1); // Device address.................... reg=i2c_read(0); // Read status actual status register........................................ return (reg);.................... }............................................................ float SHT25_get_temp().................... {.................... unsigned int8 MSB, LSB, Check;.................... unsigned int16 data;........................................ i2c_start();*0800: BSF 03.50801: BSF 06.00802: NOP0803: BSF 06.10804: NOP0805: BCF 03.50806: BTFSS 06.10807: GOTO 0060808: BCF 06.00809: BSF 03.5080A: BCF 06.0080B: NOP080C: BCF 03.5080D: BCF 06.1080E: BSF 03.5080F: BCF 06.1.................... I2C_Write(SHT25_ADDR);0810: MOVLW 800811: BCF 03.50812: MOVWF 5F0813: BCF 0A.30814: CALL 1FB0815: BSF 0A.3.................... I2C_write(0xE3);0816: MOVLW E30817: MOVWF 5F0818: BCF 0A.30819: CALL 1FB081A: BSF 0A.3.................... i2c_stop();081B: BSF 03.5081C: BCF 06.0081D: NOP081E: BSF 06.1081F: BCF 03.50820: BTFSS 06.10821: GOTO 0200822: NOP0823: GOTO 0240824: NOP0825: BSF 03.50826: BSF 06.00827: NOP........................................ delay_ms(100);0828: MOVLW 640829: BCF 03.5082A: MOVWF 52082B: BCF 0A.3082C: CALL 2A0082D: BSF 0A.3........................................ i2c_start();082E: BSF 03.5082F: BSF 06.00830: NOP0831: BSF 06.10832: NOP0833: BCF 03.50834: BCF 06.00835: BSF 03.50836: BCF 06.00837: NOP0838: BCF 03.50839: BCF 06.1083A: BSF 03.5083B: BCF 06.1.................... I2C_Write(SHT25_ADDR+1);083C: MOVLW 81083D: BCF 03.5083E: MOVWF 5F083F: BCF 0A.30840: CALL 1FB0841: BSF 0A.3.................... MSB=i2c_read(1);0842: MOVLW 010843: MOVWF 770844: BCF 0A.30845: CALL 2B40846: BSF 0A.30847: MOVF 78,W0848: MOVWF 4D.................... LSB=i2c_read(1);0849: MOVLW 01084A: MOVWF 77084B: BCF 0A.3084C: CALL 2B4084D: BSF 0A.3084E: MOVF 78,W084F: MOVWF 4E.................... Check=i2c_read(0);0850: CLRF 770851: BCF 0A.30852: CALL 2B40853: BSF 0A.30854: MOVF 78,W0855: MOVWF 4F.................... i2c_stop();0856: BSF 03.50857: BCF 06.00858: NOP0859: BSF 06.1085A: BCF 03.5085B: BTFSS 06.1085C: GOTO 05B085D: NOP085E: GOTO 05F085F: NOP0860: BSF 03.50861: BSF 06.00862: NOP........................................ LSB = LSB >> 2; // trow out status bits0863: BCF 03.50864: RRF 4E,F0865: RRF 4E,F0866: MOVLW 3F0867: ANDWF 4E,F........................................ data = (((unsigned int16) MSB << 8) + (LSB << 4));0868: CLRF 530869: MOVF 4D,W086A: MOVWF 52086B: MOVWF 53086C: CLRF 52086D: SWAPF 4E,W086E: MOVWF 77086F: MOVLW F00870: ANDWF 77,F0871: MOVF 77,W0872: ADDWF 52,W0873: MOVWF 500874: MOVF 53,W0875: MOVWF 510876: BTFSC 03.00877: INCF 51,F.................... return(-46.85 + 175.72*((float)data/0xFFFF));0878: MOVF 51,W0879: MOVWF 5F087A: MOVF 50,W087B: MOVWF 5E087C: BCF 0A.3087D: CALL 325087E: BSF 0A.3087F: MOVF 77,W0880: MOVWF 520881: MOVF 78,W0882: MOVWF 530883: MOVF 79,W0884: MOVWF 540885: MOVF 7A,W0886: MOVWF 550887: MOVWF 650888: MOVF 54,W0889: MOVWF 64088A: MOVF 53,W088B: MOVWF 63088C: MOVF 52,W088D: MOVWF 62088E: CLRF 69088F: MOVLW FF0890: MOVWF 680891: MOVLW 7F0892: MOVWF 670893: MOVLW 8E0894: MOVWF 660895: BCF 0A.30896: CALL 3420897: BSF 0A.30898: MOVLW 520899: MOVWF 5D089A: MOVLW B8089B: MOVWF 5C089C: MOVLW 2F089D: MOVWF 5B089E: MOVLW 86089F: MOVWF 5A08A0: MOVF 7A,W08A1: MOVWF 6108A2: MOVF 79,W08A3: MOVWF 6008A4: MOVF 78,W08A5: MOVWF 5F08A6: MOVF 77,W08A7: MOVWF 5E08A8: BCF 0A.308A9: CALL 73608AA: BSF 0A.308AB: BCF 03.108AC: MOVLW 6608AD: MOVWF 6708AE: MOVWF 6608AF: MOVLW BB08B0: MOVWF 6508B1: MOVLW 8408B2: MOVWF 6408B3: MOVF 7A,W08B4: MOVWF 6B08B5: MOVF 79,W08B6: MOVWF 6A08B7: MOVF 78,W08B8: MOVWF 6908B9: MOVF 77,W08BA: MOVWF 6808BB: BCF 0A.308BC: CALL 40C08BD: BSF 0A.3.................... }08BE: BSF 0A.308BF: BCF 0A.408C0: GOTO 372 (RETURN)........................................ float SHT25_get_hum().................... {.................... unsigned int8 MSB, LSB, Check;.................... unsigned int16 data;........................................ i2c_start(); //RH08C1: BSF 03.508C2: BSF 06.008C3: NOP08C4: BSF 06.108C5: NOP08C6: BCF 03.508C7: BCF 06.008C8: BSF 03.508C9: BCF 06.008CA: NOP08CB: BCF 03.508CC: BCF 06.108CD: BSF 03.508CE: BCF 06.1.................... I2C_Write(SHT25_ADDR);08CF: MOVLW 8008D0: BCF 03.508D1: MOVWF 5F08D2: BCF 0A.308D3: CALL 1FB08D4: BSF 0A.3.................... I2C_write(0xE5);08D5: MOVLW E508D6: MOVWF 5F08D7: BCF 0A.308D8: CALL 1FB08D9: BSF 0A.3........................................ delay_ms(100);08DA: MOVLW 6408DB: MOVWF 5208DC: BCF 0A.308DD: CALL 2A008DE: BSF 0A.3........................................ i2c_start();08DF: BSF 03.508E0: BSF 06.008E1: NOP08E2: BSF 06.108E3: NOP08E4: BCF 03.508E5: BTFSS 06.108E6: GOTO 0E508E7: BCF 06.008E8: BSF 03.508E9: BCF 06.008EA: NOP08EB: BCF 03.508EC: BCF 06.108ED: BSF 03.508EE: BCF 06.1.................... I2C_Write(SHT25_ADDR+1);08EF: MOVLW 8108F0: BCF 03.508F1: MOVWF 5F08F2: BCF 0A.308F3: CALL 1FB08F4: BSF 0A.3.................... MSB=i2c_read(1);08F5: MOVLW 0108F6: MOVWF 7708F7: BCF 0A.308F8: CALL 2B408F9: BSF 0A.308FA: MOVF 78,W08FB: MOVWF 4D.................... LSB=i2c_read(1);08FC: MOVLW 0108FD: MOVWF 7708FE: BCF 0A.308FF: CALL 2B40900: BSF 0A.30901: MOVF 78,W0902: MOVWF 4E.................... Check=i2c_read(0);0903: CLRF 770904: BCF 0A.30905: CALL 2B40906: BSF 0A.30907: MOVF 78,W0908: MOVWF 4F.................... i2c_stop();0909: BSF 03.5090A: BCF 06.0090B: NOP090C: BSF 06.1090D: BCF 03.5090E: BTFSS 06.1090F: GOTO 10E0910: NOP0911: GOTO 1120912: NOP0913: BSF 03.50914: BSF 06.00915: NOP........................................ LSB = LSB >> 2; // trow out status bits0916: BCF 03.50917: RRF 4E,F0918: RRF 4E,F0919: MOVLW 3F091A: ANDWF 4E,F........................................ data = (((unsigned int16) MSB << 8) + (LSB << 4) );091B: CLRF 53091C: MOVF 4D,W091D: MOVWF 52091E: MOVWF 53091F: CLRF 520920: SWAPF 4E,W0921: MOVWF 770922: MOVLW F00923: ANDWF 77,F0924: MOVF 77,W0925: ADDWF 52,W0926: MOVWF 500927: MOVF 53,W0928: MOVWF 510929: BTFSC 03.0092A: INCF 51,F.................... return( -6.0 + 125.0*((float)data/0xFFFF));092B: MOVF 51,W092C: MOVWF 5F092D: MOVF 50,W092E: MOVWF 5E092F: BCF 0A.30930: CALL 3250931: BSF 0A.30932: MOVF 77,W0933: MOVWF 520934: MOVF 78,W0935: MOVWF 530936: MOVF 79,W0937: MOVWF 540938: MOVF 7A,W0939: MOVWF 55093A: MOVWF 65093B: MOVF 79,W093C: MOVWF 64093D: MOVF 78,W093E: MOVWF 63093F: MOVF 77,W0940: MOVWF 620941: CLRF 690942: MOVLW FF0943: MOVWF 680944: MOVLW 7F0945: MOVWF 670946: MOVLW 8E0947: MOVWF 660948: BCF 0A.30949: CALL 342094A: BSF 0A.3094B: CLRF 5D094C: CLRF 5C094D: MOVLW 7A094E: MOVWF 5B094F: MOVLW 850950: MOVWF 5A0951: MOVF 7A,W0952: MOVWF 610953: MOVF 79,W0954: MOVWF 600955: MOVF 78,W0956: MOVWF 5F0957: MOVF 77,W0958: MOVWF 5E0959: BCF 0A.3095A: CALL 736095B: BSF 0A.3095C: BCF 03.1095D: CLRF 67095E: CLRF 66095F: MOVLW C00960: MOVWF 650961: MOVLW 810962: MOVWF 640963: MOVF 7A,W0964: MOVWF 6B0965: MOVF 79,W0966: MOVWF 6A0967: MOVF 78,W0968: MOVWF 690969: MOVF 77,W096A: MOVWF 68096B: BCF 0A.3096C: CALL 40C096D: BSF 0A.3.................... }096E: BSF 0A.3096F: BCF 0A.40970: GOTO 37B (RETURN).................................................................................................... #include "MPL3115.h".................... #define MPL3115_ADDR_R 0xC1 //addresa pro cteni.................... #define MPL3115_ADDR_W 0xC0........................................ #include "MPL3115.c".................... void mpl3115_setA (void) //nastavení pro výku.................... {............................................................ i2c_start(); //STANDBY mode*0658: BSF 03.50659: BSF 06.0065A: NOP065B: BSF 06.1065C: NOP065D: BCF 03.5065E: BCF 06.0065F: BSF 03.50660: BCF 06.00661: NOP0662: BCF 03.50663: BCF 06.10664: BSF 03.50665: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);0666: MOVLW C00667: BCF 03.50668: MOVWF 5F0669: CALL 1FB.................... I2C_write(0x26);066A: MOVLW 26066B: MOVWF 5F066C: CALL 1FB.................... I2C_write(0xB8);066D: MOVLW B8066E: MOVWF 5F066F: CALL 1FB.................... i2c_stop();0670: BSF 03.50671: BCF 06.00672: NOP0673: BSF 06.10674: BCF 03.50675: BTFSS 06.10676: GOTO 6750677: NOP0678: GOTO 6790679: NOP067A: BSF 03.5067B: BSF 06.0067C: NOP........................................ i2c_start(); //PT_DATA_CFG set067D: BSF 06.0067E: NOP067F: BSF 06.10680: NOP0681: BCF 03.50682: BCF 06.00683: BSF 03.50684: BCF 06.00685: NOP0686: BCF 03.50687: BCF 06.10688: BSF 03.50689: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);068A: MOVLW C0068B: BCF 03.5068C: MOVWF 5F068D: CALL 1FB.................... I2C_write(0x13);068E: MOVLW 13068F: MOVWF 5F0690: CALL 1FB.................... I2C_write(0x07); //hodnota0691: MOVLW 070692: MOVWF 5F0693: CALL 1FB.................... i2c_stop();0694: BSF 03.50695: BCF 06.00696: NOP0697: BSF 06.10698: BCF 03.50699: BTFSS 06.1069A: GOTO 699069B: NOP069C: GOTO 69D069D: NOP069E: BSF 03.5069F: BSF 06.006A0: NOP........................................ i2c_start(); //ACTIVE mode06A1: BSF 06.006A2: NOP06A3: BSF 06.106A4: NOP06A5: BCF 03.506A6: BCF 06.006A7: BSF 03.506A8: BCF 06.006A9: NOP06AA: BCF 03.506AB: BCF 06.106AC: BSF 03.506AD: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);06AE: MOVLW C006AF: BCF 03.506B0: MOVWF 5F06B1: CALL 1FB.................... I2C_write(0x26);06B2: MOVLW 2606B3: MOVWF 5F06B4: CALL 1FB.................... I2C_write(0xB9);06B5: MOVLW B906B6: MOVWF 5F06B7: CALL 1FB.................... i2c_stop();06B8: BSF 03.506B9: BCF 06.006BA: NOP06BB: BSF 06.106BC: BCF 03.506BD: BTFSS 06.106BE: GOTO 6BD06BF: NOP06C0: GOTO 6C106C1: NOP06C2: BSF 03.506C3: BSF 06.006C4: NOP.................... }06C5: BCF 03.506C6: BSF 0A.306C7: BCF 0A.406C8: GOTO 35B (RETURN)........................................ void mpl3115_setP (void) //nastavení pro tlak.................... {............................................................ i2c_start(); //STANDBY mode*022F: BSF 03.50230: BSF 06.00231: NOP0232: BSF 06.10233: NOP0234: BCF 03.50235: BCF 06.00236: BSF 03.50237: BCF 06.00238: NOP0239: BCF 03.5023A: BCF 06.1023B: BSF 03.5023C: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);023D: MOVLW C0023E: BCF 03.5023F: MOVWF 5F0240: CALL 1FB.................... I2C_write(0x26);0241: MOVLW 260242: MOVWF 5F0243: CALL 1FB.................... I2C_write(0xB8);0244: MOVLW B80245: MOVWF 5F0246: CALL 1FB.................... i2c_stop();0247: BSF 03.50248: BCF 06.00249: NOP024A: BSF 06.1024B: BCF 03.5024C: BTFSS 06.1024D: GOTO 24C024E: NOP024F: GOTO 2500250: NOP0251: BSF 03.50252: BSF 06.00253: NOP........................................ i2c_start(); //PT_DATA_CFG set0254: BSF 06.00255: NOP0256: BSF 06.10257: NOP0258: BCF 03.50259: BCF 06.0025A: BSF 03.5025B: BCF 06.0025C: NOP025D: BCF 03.5025E: BCF 06.1025F: BSF 03.50260: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);0261: MOVLW C00262: BCF 03.50263: MOVWF 5F0264: CALL 1FB.................... I2C_write(0x13);0265: MOVLW 130266: MOVWF 5F0267: CALL 1FB.................... I2C_write(0x07); //hodnota0268: MOVLW 070269: MOVWF 5F026A: CALL 1FB.................... i2c_stop();026B: BSF 03.5026C: BCF 06.0026D: NOP026E: BSF 06.1026F: BCF 03.50270: BTFSS 06.10271: GOTO 2700272: NOP0273: GOTO 2740274: NOP0275: BSF 03.50276: BSF 06.00277: NOP........................................ i2c_start(); //ACTIVE mode0278: BSF 06.00279: NOP027A: BSF 06.1027B: NOP027C: BCF 03.5027D: BCF 06.0027E: BSF 03.5027F: BCF 06.00280: NOP0281: BCF 03.50282: BCF 06.10283: BSF 03.50284: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);0285: MOVLW C00286: BCF 03.50287: MOVWF 5F0288: CALL 1FB.................... I2C_write(0x26);0289: MOVLW 26028A: MOVWF 5F028B: CALL 1FB.................... I2C_write(0x39);028C: MOVLW 39028D: MOVWF 5F028E: CALL 1FB.................... i2c_stop();028F: BSF 03.50290: BCF 06.00291: NOP0292: BSF 06.10293: BCF 03.50294: BTFSS 06.10295: GOTO 2940296: NOP0297: GOTO 2980298: NOP0299: BSF 03.5029A: BSF 06.0029B: NOP.................... }029C: BCF 03.5029D: BSF 0A.3029E: BCF 0A.4029F: GOTO 339 (RETURN)............................................................ byte mpl3115_read (byte reg).................... {.................... byte i;........................................ i2c_start();*02E7: BSF 03.502E8: BSF 06.002E9: NOP02EA: BSF 06.102EB: NOP02EC: BCF 03.502ED: BCF 06.002EE: BSF 03.502EF: BCF 06.002F0: NOP02F1: BCF 03.502F2: BCF 06.102F3: BSF 03.502F4: BCF 06.1.................... I2C_Write(MPL3115_ADDR_W);02F5: MOVLW C002F6: BCF 03.502F7: MOVWF 5F02F8: CALL 1FB.................... I2C_write(reg);02F9: MOVF 5D,W02FA: MOVWF 5F02FB: CALL 1FB.................... i2c_start();02FC: BSF 03.502FD: BSF 06.002FE: NOP02FF: BSF 06.10300: NOP0301: BCF 03.50302: BTFSS 06.10303: GOTO 3020304: BCF 06.00305: BSF 03.50306: BCF 06.00307: NOP0308: BCF 03.50309: BCF 06.1030A: BSF 03.5030B: BCF 06.1.................... I2C_Write(MPL3115_ADDR_R);030C: MOVLW C1030D: BCF 03.5030E: MOVWF 5F030F: CALL 1FB.................... i=i2c_read(0);0310: CLRF 770311: CALL 2B40312: MOVF 78,W0313: MOVWF 5E.................... i2c_stop();0314: BSF 03.50315: BCF 06.00316: NOP0317: BSF 06.10318: BCF 03.50319: BTFSS 06.1031A: GOTO 319031B: NOP031C: GOTO 31D031D: NOP031E: BSF 03.5031F: BSF 06.00320: NOP........................................ return i;0321: BCF 03.50322: MOVF 5E,W0323: MOVWF 78.................... }0324: RETURN............................................................ float mpl3115_T (void) //teplota ve stupnich.................... {.................... int m;.................... float l, t;........................................ m= mpl3115_read (0x04);*054D: MOVLW 04054E: MOVWF 5D054F: CALL 2E70550: MOVF 78,W0551: MOVWF 4D.................... l= (float)(mpl3115_read(0x05)>>4)/16.0;0552: MOVLW 050553: MOVWF 5D0554: CALL 2E70555: SWAPF 78,W0556: MOVWF 770557: MOVLW 0F0558: ANDWF 77,F0559: MOVF 77,W055A: CLRF 5F055B: MOVWF 5E055C: CALL 325055D: MOVF 77,W055E: MOVWF 56055F: MOVF 78,W0560: MOVWF 570561: MOVF 79,W0562: MOVWF 580563: MOVF 7A,W0564: MOVWF 590565: MOVWF 650566: MOVF 79,W0567: MOVWF 640568: MOVF 78,W0569: MOVWF 63056A: MOVF 77,W056B: MOVWF 62056C: CLRF 69056D: CLRF 68056E: CLRF 67056F: MOVLW 830570: MOVWF 660571: CALL 3420572: MOVF 7A,W0573: MOVWF 510574: MOVF 79,W0575: MOVWF 500576: MOVF 78,W0577: MOVWF 4F0578: MOVF 77,W0579: MOVWF 4E.................... t = (float)(M + L);057A: CLRF 5F057B: MOVF 4D,W057C: MOVWF 5E057D: CALL 325057E: BCF 03.1057F: MOVF 7A,W0580: MOVWF 670581: MOVF 79,W0582: MOVWF 660583: MOVF 78,W0584: MOVWF 650585: MOVF 77,W0586: MOVWF 640587: MOVF 51,W0588: MOVWF 6B0589: MOVF 50,W058A: MOVWF 6A058B: MOVF 4F,W058C: MOVWF 69058D: MOVF 4E,W058E: MOVWF 68058F: CALL 40C0590: MOVF 7A,W0591: MOVWF 550592: MOVF 79,W0593: MOVWF 540594: MOVF 78,W0595: MOVWF 530596: MOVF 77,W0597: MOVWF 52.................... return t;0598: MOVF 52,W0599: MOVWF 77059A: MOVF 53,W059B: MOVWF 78059C: MOVF 54,W059D: MOVWF 79059E: MOVF 55,W059F: MOVWF 7A.................... }05A0: BSF 0A.305A1: BCF 0A.405A2: GOTO 345 (RETURN)........................................ float mpl3115_A (void) //vyska v m.................... {........................................ int16 m;.................... unsigned int8 c;.................... float l, a;........................................ m= mpl3115_read (0x01);*06C9: MOVLW 0106CA: MOVWF 5D06CB: CALL 2E706CC: CLRF 4E06CD: MOVF 78,W06CE: MOVWF 4D.................... c= mpl3115_read (0x02);06CF: MOVLW 0206D0: MOVWF 5D06D1: CALL 2E706D2: MOVF 78,W06D3: MOVWF 4F.................... l= (float)(mpl3115_read(0x03)>>4)/16.0;06D4: MOVLW 0306D5: MOVWF 5D06D6: CALL 2E706D7: SWAPF 78,W06D8: MOVWF 7706D9: MOVLW 0F06DA: ANDWF 77,F06DB: MOVF 77,W06DC: CLRF 5F06DD: MOVWF 5E06DE: CALL 32506DF: MOVF 77,W06E0: MOVWF 5806E1: MOVF 78,W06E2: MOVWF 5906E3: MOVF 79,W06E4: MOVWF 5A06E5: MOVF 7A,W06E6: MOVWF 5B06E7: MOVWF 6506E8: MOVF 79,W06E9: MOVWF 6406EA: MOVF 78,W06EB: MOVWF 6306EC: MOVF 77,W06ED: MOVWF 6206EE: CLRF 6906EF: CLRF 6806F0: CLRF 6706F1: MOVLW 8306F2: MOVWF 6606F3: CALL 34206F4: MOVF 7A,W06F5: MOVWF 5306F6: MOVF 79,W06F7: MOVWF 5206F8: MOVF 78,W06F9: MOVWF 5106FA: MOVF 77,W06FB: MOVWF 50.................... a = (float)((m << 8)|c) + l;06FC: MOVF 4D,W06FD: MOVWF 5A06FE: CLRF 5906FF: MOVF 59,W0700: IORWF 4F,W0701: MOVWF 770702: MOVF 4D,W0703: MOVWF 7A0704: MOVF 77,W0705: MOVWF 5E0706: MOVF 4D,W0707: MOVWF 5F0708: CALL 3250709: MOVF 77,W070A: MOVWF 59070B: MOVF 78,W070C: MOVWF 5A070D: MOVF 79,W070E: MOVWF 5B070F: MOVF 7A,W0710: MOVWF 5C0711: BCF 03.10712: MOVF 7A,W0713: MOVWF 670714: MOVF 79,W0715: MOVWF 660716: MOVF 78,W0717: MOVWF 650718: MOVF 77,W0719: MOVWF 64071A: MOVF 53,W071B: MOVWF 6B071C: MOVF 52,W071D: MOVWF 6A071E: MOVF 51,W071F: MOVWF 690720: MOVF 50,W0721: MOVWF 680722: CALL 40C0723: MOVF 7A,W0724: MOVWF 570725: MOVF 79,W0726: MOVWF 560727: MOVF 78,W0728: MOVWF 550729: MOVF 77,W072A: MOVWF 54.................... return a;072B: MOVF 54,W072C: MOVWF 77072D: MOVF 55,W072E: MOVWF 78072F: MOVF 56,W0730: MOVWF 790731: MOVF 57,W0732: MOVWF 7A.................... }0733: BSF 0A.30734: BCF 0A.40735: GOTO 367 (RETURN)............................................................ float mpl3115_P (void) //tlak v Pa.................... {.................... unsigned int32 m;.................... unsigned int16 c;.................... unsigned int8 l,l2;.................... float p, l1;........................................ m= mpl3115_read (0x01);*05A3: MOVLW 0105A4: MOVWF 5D05A5: CALL 2E705A6: CLRF 5005A7: CLRF 4F05A8: CLRF 4E05A9: MOVF 78,W05AA: MOVWF 4D.................... c= mpl3115_read (0x02);05AB: MOVLW 0205AC: MOVWF 5D05AD: CALL 2E705AE: CLRF 5205AF: MOVF 78,W05B0: MOVWF 51.................... l=mpl3115_read(0x03);05B1: MOVLW 0305B2: MOVWF 5D05B3: CALL 2E705B4: MOVF 78,W05B5: MOVWF 53.................... l2=l<<2;05B6: RLF 53,W05B7: MOVWF 5405B8: RLF 54,F05B9: MOVLW FC05BA: ANDWF 54,F.................... l1= (float)(l>>6)/4.0;05BB: SWAPF 53,W05BC: MOVWF 7705BD: RRF 77,F05BE: RRF 77,F05BF: MOVLW 0305C0: ANDWF 77,F05C1: MOVF 77,W05C2: CLRF 5F05C3: MOVWF 5E05C4: CALL 32505C5: MOVF 77,W05C6: MOVWF 5E05C7: MOVF 78,W05C8: MOVWF 5F05C9: MOVF 79,W05CA: MOVWF 6005CB: MOVF 7A,W05CC: MOVWF 6105CD: MOVWF 6505CE: MOVF 79,W05CF: MOVWF 6405D0: MOVF 78,W05D1: MOVWF 6305D2: MOVF 77,W05D3: MOVWF 6205D4: CLRF 6905D5: CLRF 6805D6: CLRF 6705D7: MOVLW 8105D8: MOVWF 6605D9: CALL 34205DA: MOVF 7A,W05DB: MOVWF 5C05DC: MOVF 79,W05DD: MOVWF 5B05DE: MOVF 78,W05DF: MOVWF 5A05E0: MOVF 77,W05E1: MOVWF 59.................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1;05E2: CLRF 5E05E3: RLF 4D,W05E4: MOVWF 5F05E5: RLF 4E,W05E6: MOVWF 6005E7: RLF 4F,W05E8: MOVWF 6105E9: RLF 5F,F05EA: RLF 60,F05EB: RLF 61,F05EC: MOVLW FC05ED: ANDWF 5F,F05EE: RLF 51,W05EF: MOVWF 7905F0: RLF 52,W05F1: MOVWF 7A05F2: RLF 79,F05F3: RLF 7A,F05F4: MOVLW FC05F5: ANDWF 79,F05F6: MOVF 79,W05F7: IORWF 5E,F05F8: MOVF 7A,W05F9: IORWF 5F,F05FA: SWAPF 53,W05FB: MOVWF 7705FC: RRF 77,F05FD: RRF 77,F05FE: MOVLW 0305FF: ANDWF 77,F0600: MOVF 77,W0601: IORWF 5E,W0602: MOVWF 770603: MOVF 5F,W0604: MOVWF 780605: MOVF 60,W0606: MOVWF 790607: MOVF 61,W0608: MOVWF 7A0609: MOVF 7A,W060A: MOVWF 67060B: MOVF 79,W060C: MOVWF 66060D: MOVF 78,W060E: MOVWF 65060F: MOVF 77,W0610: MOVWF 64*062B: MOVF 77,W062C: MOVWF 5E062D: MOVF 78,W062E: MOVWF 5F062F: MOVF 79,W0630: MOVWF 600631: MOVF 7A,W0632: MOVWF 610633: BCF 03.10634: MOVF 7A,W0635: MOVWF 670636: MOVF 79,W0637: MOVWF 660638: MOVF 78,W0639: MOVWF 65063A: MOVF 77,W063B: MOVWF 64063C: MOVF 5C,W063D: MOVWF 6B063E: MOVF 5B,W063F: MOVWF 6A0640: MOVF 5A,W0641: MOVWF 690642: MOVF 59,W0643: MOVWF 680644: CALL 40C0645: MOVF 7A,W0646: MOVWF 580647: MOVF 79,W0648: MOVWF 570649: MOVF 78,W064A: MOVWF 56064B: MOVF 77,W064C: MOVWF 55........................................ return p;064D: MOVF 55,W064E: MOVWF 77064F: MOVF 56,W0650: MOVWF 780651: MOVF 57,W0652: MOVWF 790653: MOVF 58,W0654: MOVWF 7A.................... }0655: BSF 0A.30656: BCF 0A.40657: GOTO 350 (RETURN)............................................................................................................................................ #define SEND_DELAY 50 // Time between two characters on RS232............................................................ char VER[4]=VERSION; // Buffer for concatenate of a version string*0B28: MOVLW 300B29: MOVWF 220B2A: MOVLW 2E0B2B: MOVWF 230B2C: MOVLW 310B2D: MOVWF 240B2E: CLRF 25........................................ void uvitani(void) // uvitaci zprava.................... {........................................ printf("\r\n\r\n# Meteorologicka stanice %s (C) 2013 www.mlab.cz \r\n",VERSION);*0172: MOVLW 040173: BSF 03.60174: MOVWF 0D0175: MOVLW 000176: MOVWF 0F0177: BCF 03.00178: MOVLW 1D0179: BCF 03.6017A: MOVWF 4D017B: CALL 0BC017C: MOVLW 20017D: BSF 03.6017E: MOVWF 0D017F: MOVLW 000180: MOVWF 0F0181: BCF 03.60182: CALL 10B0183: MOVLW 130184: BSF 03.60185: MOVWF 0D0186: MOVLW 000187: MOVWF 0F0188: BSF 03.00189: MOVLW 18018A: BCF 03.6018B: MOVWF 4D018C: CALL 0BC.................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message018D: MOVLW 22018E: BSF 03.6018F: MOVWF 0D0190: MOVLW 000191: MOVWF 0F0192: BCF 03.00193: MOVLW 0B0194: BCF 03.60195: MOVWF 4D0196: CALL 0BC0197: MOVLW 350198: BSF 03.60199: MOVWF 0D019A: MOVLW 00019B: MOVWF 0F019C: BCF 03.6019D: CALL 10B019E: MOVLW 28019F: BSF 03.601A0: MOVWF 0D01A1: MOVLW 0001A2: MOVWF 0F01A3: BSF 03.001A4: MOVLW 1201A5: BCF 03.601A6: MOVWF 4D01A7: CALL 0BC01A8: MOVLW 3B01A9: BSF 03.601AA: MOVWF 0D01AB: MOVLW 0001AC: MOVWF 0F01AD: BCF 03.601AE: CALL 10B01AF: MOVLW 2001B0: MOVWF 5101B1: CALL 09A01B2: MOVLW 0D01B3: MOVWF 5101B4: CALL 09A01B5: MOVLW 0A01B6: MOVWF 5101B7: CALL 09A.................... //printf("#%s\r\n",&REV[4]);.................... printf("# ver poradi ");01B8: MOVLW 4001B9: BSF 03.601BA: MOVWF 0D01BB: MOVLW 0001BC: MOVWF 0F01BD: BCF 03.601BE: CALL 10B.................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] ");01BF: MOVLW 4701C0: BSF 03.601C1: MOVWF 0D01C2: MOVLW 0001C3: MOVWF 0F.................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n");*01E4: MOVLW 7101E5: MOVWF 0D01E6: MOVLW 0001E7: MOVWF 0F01E8: MOVLW 1001E9: BCF 03.601EA: MOVWF 4D01EB: CALL 15101EC: MOVLW 2501ED: MOVWF 5101EE: CALL 09A01EF: MOVLW 8301F0: BSF 03.601F1: MOVWF 0D01F2: MOVLW 0001F3: MOVWF 0F01F4: MOVLW 1601F5: BCF 03.601F6: MOVWF 4D01F7: CALL 151.................... }01F8: BSF 0A.301F9: BCF 0A.401FA: GOTO 335 (RETURN)........................................................................................................................ void main ().................... {*0B0B: CLRF 040B0C: BCF 03.70B0D: MOVLW 1F0B0E: ANDWF 03,F0B0F: MOVLW 710B10: BSF 03.50B11: MOVWF 0F0B12: MOVF 0F,W0B13: BCF 06.30B14: BCF 03.50B15: BSF 06.30B16: BSF 03.50B17: BSF 03.60B18: MOVF 09,W0B19: ANDLW C00B1A: MOVWF 090B1B: BCF 03.60B1C: BCF 1F.40B1D: BCF 1F.50B1E: MOVLW 000B1F: BSF 03.60B20: MOVWF 080B21: BCF 03.50B22: CLRF 070B23: CLRF 080B24: CLRF 09*0B31: CLRF 3D0B32: CLRF 3C.................... float altimet_t; //teplota z MPL3115.................... float altimet_p; //tlak z MPL3115.................... float altimet_a; //vyska z MPL3115.................... float sht25_t;.................... float sht25_h;........................................ unsigned int16 poradi=0;........................................ uvitani();0B33: BCF 0A.30B34: GOTO 1720B35: BSF 0A.3............................................................ while(TRUE).................... {.................... char output[12]; // Output buffer.................... int8 j; // String pointer.................... int8 check=0; // Checksum is calculated between '$' and '*'.................... unsigned int sht_config;0B36: CLRF 4B........................................ mpl3115_setP(); //nastaveni pro tlak a teplotu0B37: BCF 0A.30B38: GOTO 22F0B39: BSF 0A.3.................... delay_ms (500);0B3A: MOVLW 020B3B: MOVWF 4D0B3C: MOVLW FA0B3D: MOVWF 520B3E: BCF 0A.30B3F: CALL 2A00B40: BSF 0A.30B41: DECFSZ 4D,F0B42: GOTO 33C.................... altimet_t=mpl3115_T();0B43: BCF 0A.30B44: GOTO 54D0B45: BSF 0A.30B46: MOVF 7A,W0B47: MOVWF 2B0B48: MOVF 79,W0B49: MOVWF 2A0B4A: MOVF 78,W0B4B: MOVWF 290B4C: MOVF 77,W0B4D: MOVWF 28.................... altimet_p=mpl3115_P();0B4E: BCF 0A.30B4F: GOTO 5A30B50: BSF 0A.30B51: MOVF 7A,W0B52: MOVWF 2F0B53: MOVF 79,W0B54: MOVWF 2E0B55: MOVF 78,W0B56: MOVWF 2D0B57: MOVF 77,W0B58: MOVWF 2C........................................ mpl3115_setA(); //nastaveni pro vysku a teplotu0B59: BCF 0A.30B5A: GOTO 6580B5B: BSF 0A.3.................... delay_ms (500);0B5C: MOVLW 020B5D: MOVWF 4D0B5E: MOVLW FA0B5F: MOVWF 520B60: BCF 0A.30B61: CALL 2A00B62: BSF 0A.30B63: DECFSZ 4D,F0B64: GOTO 35E.................... altimet_a=mpl3115_A();0B65: BCF 0A.30B66: GOTO 6C90B67: BSF 0A.30B68: MOVF 7A,W0B69: MOVWF 330B6A: MOVF 79,W0B6B: MOVWF 320B6C: MOVF 78,W0B6D: MOVWF 310B6E: MOVF 77,W0B6F: MOVWF 30............................................................ //printf("Teplota: %10.4f(stupne)\r\n", t);.................... //printf("Tlak: %10.4f(Pa)\r\n", altimet_p);.................... //printf("Výka: %10.4f(m)\r\n", a);.................................................................................................... sht_config = SHT25_RH12_T14 | SHT25_HEATER_OFF; //vypnuti topeni v0B70: CLRF 4C........................................................................................................................ sht25_t=SHT25_get_temp();0B71: GOTO 0000B72: MOVF 7A,W0B73: MOVWF 370B74: MOVF 79,W0B75: MOVWF 360B76: MOVF 78,W0B77: MOVWF 350B78: MOVF 77,W0B79: MOVWF 34.................... sht25_h=SHT25_get_hum();0B7A: GOTO 0C10B7B: MOVF 7A,W0B7C: MOVWF 3B0B7D: MOVF 79,W0B7E: MOVWF 3A0B7F: MOVF 78,W0B80: MOVWF 390B81: MOVF 77,W0B82: MOVWF 38............................................................ delay_us(SEND_DELAY);0B83: MOVLW 210B84: MOVWF 770B85: DECFSZ 77,F0B86: GOTO 385.................... putc('$');0B87: MOVLW 240B88: MOVWF 510B89: BCF 0A.30B8A: CALL 09A0B8B: BSF 0A.3.................... delay_us(SEND_DELAY);0B8C: MOVLW 210B8D: MOVWF 770B8E: DECFSZ 77,F0B8F: GOTO 38E.................... sprintf(output,"MST%s \0",VER);0B90: CLRF 270B91: MOVLW 3E0B92: MOVWF 260B93: MOVLW 4D0B94: MOVWF 5A0B95: BCF 0A.30B96: CALL 7AB0B97: BSF 0A.30B98: MOVLW 530B99: MOVWF 5A0B9A: BCF 0A.30B9B: CALL 7AB0B9C: BSF 0A.30B9D: MOVLW 540B9E: MOVWF 5A0B9F: BCF 0A.30BA0: CALL 7AB0BA1: BSF 0A.30BA2: MOVLW 220BA3: MOVWF 040BA4: BCF 03.70BA5: BCF 0A.30BA6: GOTO 7B80BA7: BSF 0A.30BA8: MOVLW 200BA9: MOVWF 5A0BAA: BCF 0A.30BAB: CALL 7AB0BAC: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0BAD: CLRF 4A0BAE: MOVLW 3E0BAF: ADDWF 4A,W0BB0: MOVWF 040BB1: BCF 03.70BB2: MOVF 00,F0BB3: BTFSC 03.20BB4: GOTO 3CC0BB5: MOVLW 210BB6: MOVWF 770BB7: DECFSZ 77,F0BB8: GOTO 3B70BB9: MOVLW 3E0BBA: ADDWF 4A,W0BBB: MOVWF 040BBC: BCF 03.70BBD: MOVF 00,W0BBE: MOVWF 4D0BBF: MOVF 4D,W0BC0: MOVWF 510BC1: BCF 0A.30BC2: CALL 09A0BC3: BSF 0A.30BC4: MOVF 4A,W0BC5: INCF 4A,F0BC6: ADDLW 3E0BC7: MOVWF 040BC8: BCF 03.70BC9: MOVF 00,W0BCA: XORWF 4B,F0BCB: GOTO 3AE.................... sprintf(output,"%4.0Lu \0", poradi);0BCC: CLRF 270BCD: MOVLW 3E0BCE: MOVWF 260BCF: MOVLW 010BD0: MOVWF 040BD1: MOVF 3D,W0BD2: MOVWF 4E0BD3: MOVF 3C,W0BD4: MOVWF 4D0BD5: GOTO 1710BD6: MOVLW 200BD7: MOVWF 5A0BD8: BCF 0A.30BD9: CALL 7AB0BDA: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0BDB: CLRF 4A0BDC: MOVLW 3E0BDD: ADDWF 4A,W0BDE: MOVWF 040BDF: BCF 03.70BE0: MOVF 00,F0BE1: BTFSC 03.20BE2: GOTO 3FA0BE3: MOVLW 210BE4: MOVWF 770BE5: DECFSZ 77,F0BE6: GOTO 3E50BE7: MOVLW 3E0BE8: ADDWF 4A,W0BE9: MOVWF 040BEA: BCF 03.70BEB: MOVF 00,W0BEC: MOVWF 4D0BED: MOVF 4D,W0BEE: MOVWF 510BEF: BCF 0A.30BF0: CALL 09A0BF1: BSF 0A.30BF2: MOVF 4A,W0BF3: INCF 4A,F0BF4: ADDLW 3E0BF5: MOVWF 040BF6: BCF 03.70BF7: MOVF 00,W0BF8: XORWF 4B,F0BF9: GOTO 3DC.................... sprintf(output,"%3.2f \0", altimet_t );0BFA: CLRF 270BFB: MOVLW 3E0BFC: MOVWF 260BFD: MOVLW 020BFE: MOVWF 040BFF: MOVF 2B,W0C00: MOVWF 500C01: MOVF 2A,W0C02: MOVWF 4F0C03: MOVF 29,W0C04: MOVWF 4E0C05: MOVF 28,W0C06: MOVWF 4D0C07: MOVLW 020C08: MOVWF 510C09: CALL 21A0C0A: MOVLW 200C0B: MOVWF 5A0C0C: BCF 0A.30C0D: CALL 7AB0C0E: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0C0F: CLRF 4A0C10: MOVLW 3E0C11: ADDWF 4A,W0C12: MOVWF 040C13: BCF 03.70C14: MOVF 00,F0C15: BTFSC 03.20C16: GOTO 42E0C17: MOVLW 210C18: MOVWF 770C19: DECFSZ 77,F0C1A: GOTO 4190C1B: MOVLW 3E0C1C: ADDWF 4A,W0C1D: MOVWF 040C1E: BCF 03.70C1F: MOVF 00,W0C20: MOVWF 4D0C21: MOVF 4D,W0C22: MOVWF 510C23: BCF 0A.30C24: CALL 09A0C25: BSF 0A.30C26: MOVF 4A,W0C27: INCF 4A,F0C28: ADDLW 3E0C29: MOVWF 040C2A: BCF 03.70C2B: MOVF 00,W0C2C: XORWF 4B,F0C2D: GOTO 410.................... sprintf(output,"%5.2f \0", altimet_a);0C2E: CLRF 270C2F: MOVLW 3E0C30: MOVWF 260C31: MOVLW 040C32: MOVWF 040C33: MOVF 33,W0C34: MOVWF 500C35: MOVF 32,W0C36: MOVWF 4F0C37: MOVF 31,W0C38: MOVWF 4E0C39: MOVF 30,W0C3A: MOVWF 4D0C3B: MOVLW 020C3C: MOVWF 510C3D: CALL 21A0C3E: MOVLW 200C3F: MOVWF 5A0C40: BCF 0A.30C41: CALL 7AB0C42: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0C43: CLRF 4A0C44: MOVLW 3E0C45: ADDWF 4A,W0C46: MOVWF 040C47: BCF 03.70C48: MOVF 00,F0C49: BTFSC 03.20C4A: GOTO 4620C4B: MOVLW 210C4C: MOVWF 770C4D: DECFSZ 77,F0C4E: GOTO 44D0C4F: MOVLW 3E0C50: ADDWF 4A,W0C51: MOVWF 040C52: BCF 03.70C53: MOVF 00,W0C54: MOVWF 4D0C55: MOVF 4D,W0C56: MOVWF 510C57: BCF 0A.30C58: CALL 09A0C59: BSF 0A.30C5A: MOVF 4A,W0C5B: INCF 4A,F0C5C: ADDLW 3E0C5D: MOVWF 040C5E: BCF 03.70C5F: MOVF 00,W0C60: XORWF 4B,F0C61: GOTO 444.................... sprintf(output,"%6.2f \0", altimet_p);0C62: CLRF 270C63: MOVLW 3E0C64: MOVWF 260C65: MOVLW 050C66: MOVWF 040C67: MOVF 2F,W0C68: MOVWF 500C69: MOVF 2E,W0C6A: MOVWF 4F0C6B: MOVF 2D,W0C6C: MOVWF 4E0C6D: MOVF 2C,W0C6E: MOVWF 4D0C6F: MOVLW 020C70: MOVWF 510C71: CALL 21A0C72: MOVLW 200C73: MOVWF 5A0C74: BCF 0A.30C75: CALL 7AB0C76: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0C77: CLRF 4A0C78: MOVLW 3E0C79: ADDWF 4A,W0C7A: MOVWF 040C7B: BCF 03.70C7C: MOVF 00,F0C7D: BTFSC 03.20C7E: GOTO 4960C7F: MOVLW 210C80: MOVWF 770C81: DECFSZ 77,F0C82: GOTO 4810C83: MOVLW 3E0C84: ADDWF 4A,W0C85: MOVWF 040C86: BCF 03.70C87: MOVF 00,W0C88: MOVWF 4D0C89: MOVF 4D,W0C8A: MOVWF 510C8B: BCF 0A.30C8C: CALL 09A0C8D: BSF 0A.30C8E: MOVF 4A,W0C8F: INCF 4A,F0C90: ADDLW 3E0C91: MOVWF 040C92: BCF 03.70C93: MOVF 00,W0C94: XORWF 4B,F0C95: GOTO 478.................... sprintf(output,"%5.2f \0", sht25_t);0C96: CLRF 270C97: MOVLW 3E0C98: MOVWF 260C99: MOVLW 040C9A: MOVWF 040C9B: MOVF 37,W0C9C: MOVWF 500C9D: MOVF 36,W0C9E: MOVWF 4F0C9F: MOVF 35,W0CA0: MOVWF 4E0CA1: MOVF 34,W0CA2: MOVWF 4D0CA3: MOVLW 020CA4: MOVWF 510CA5: CALL 21A0CA6: MOVLW 200CA7: MOVWF 5A0CA8: BCF 0A.30CA9: CALL 7AB0CAA: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0CAB: CLRF 4A0CAC: MOVLW 3E0CAD: ADDWF 4A,W0CAE: MOVWF 040CAF: BCF 03.70CB0: MOVF 00,F0CB1: BTFSC 03.20CB2: GOTO 4CA0CB3: MOVLW 210CB4: MOVWF 770CB5: DECFSZ 77,F0CB6: GOTO 4B50CB7: MOVLW 3E0CB8: ADDWF 4A,W0CB9: MOVWF 040CBA: BCF 03.70CBB: MOVF 00,W0CBC: MOVWF 4D0CBD: MOVF 4D,W0CBE: MOVWF 510CBF: BCF 0A.30CC0: CALL 09A0CC1: BSF 0A.30CC2: MOVF 4A,W0CC3: INCF 4A,F0CC4: ADDLW 3E0CC5: MOVWF 040CC6: BCF 03.70CC7: MOVF 00,W0CC8: XORWF 4B,F0CC9: GOTO 4AC.................... sprintf(output,"%3.2f \0", sht25_h);0CCA: CLRF 270CCB: MOVLW 3E0CCC: MOVWF 260CCD: MOVLW 020CCE: MOVWF 040CCF: MOVF 3B,W0CD0: MOVWF 500CD1: MOVF 3A,W0CD2: MOVWF 4F0CD3: MOVF 39,W0CD4: MOVWF 4E0CD5: MOVF 38,W0CD6: MOVWF 4D0CD7: MOVLW 020CD8: MOVWF 510CD9: CALL 21A0CDA: MOVLW 200CDB: MOVWF 5A0CDC: BCF 0A.30CDD: CALL 7AB0CDE: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0CDF: CLRF 4A0CE0: MOVLW 3E0CE1: ADDWF 4A,W0CE2: MOVWF 040CE3: BCF 03.70CE4: MOVF 00,F0CE5: BTFSC 03.20CE6: GOTO 4FE0CE7: MOVLW 210CE8: MOVWF 770CE9: DECFSZ 77,F0CEA: GOTO 4E90CEB: MOVLW 3E0CEC: ADDWF 4A,W0CED: MOVWF 040CEE: BCF 03.70CEF: MOVF 00,W0CF0: MOVWF 4D0CF1: MOVF 4D,W0CF2: MOVWF 510CF3: BCF 0A.30CF4: CALL 09A0CF5: BSF 0A.30CF6: MOVF 4A,W0CF7: INCF 4A,F0CF8: ADDLW 3E0CF9: MOVWF 040CFA: BCF 03.70CFB: MOVF 00,W0CFC: XORWF 4B,F0CFD: GOTO 4E0.................... sprintf(output,"%5.0f \0", altimet_t);0CFE: CLRF 270CFF: MOVLW 3E0D00: MOVWF 260D01: MOVLW 040D02: MOVWF 040D03: MOVF 2B,W0D04: MOVWF 500D05: MOVF 2A,W0D06: MOVWF 4F0D07: MOVF 29,W0D08: MOVWF 4E0D09: MOVF 28,W0D0A: MOVWF 4D0D0B: CLRF 510D0C: CALL 21A0D0D: MOVLW 200D0E: MOVWF 5A0D0F: BCF 0A.30D10: CALL 7AB0D11: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0D12: CLRF 4A0D13: MOVLW 3E0D14: ADDWF 4A,W0D15: MOVWF 040D16: BCF 03.70D17: MOVF 00,F0D18: BTFSC 03.20D19: GOTO 5310D1A: MOVLW 210D1B: MOVWF 770D1C: DECFSZ 77,F0D1D: GOTO 51C0D1E: MOVLW 3E0D1F: ADDWF 4A,W0D20: MOVWF 040D21: BCF 03.70D22: MOVF 00,W0D23: MOVWF 4D0D24: MOVF 4D,W0D25: MOVWF 510D26: BCF 0A.30D27: CALL 09A0D28: BSF 0A.30D29: MOVF 4A,W0D2A: INCF 4A,F0D2B: ADDLW 3E0D2C: MOVWF 040D2D: BCF 03.70D2E: MOVF 00,W0D2F: XORWF 4B,F0D30: GOTO 513.................... sprintf(output,"%5.1f \0", altimet_t);0D31: CLRF 270D32: MOVLW 3E0D33: MOVWF 260D34: MOVLW 040D35: MOVWF 040D36: MOVF 2B,W0D37: MOVWF 500D38: MOVF 2A,W0D39: MOVWF 4F0D3A: MOVF 29,W0D3B: MOVWF 4E0D3C: MOVF 28,W0D3D: MOVWF 4D0D3E: MOVLW 010D3F: MOVWF 510D40: CALL 21A0D41: MOVLW 200D42: MOVWF 5A0D43: BCF 0A.30D44: CALL 7AB0D45: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0D46: CLRF 4A0D47: MOVLW 3E0D48: ADDWF 4A,W0D49: MOVWF 040D4A: BCF 03.70D4B: MOVF 00,F0D4C: BTFSC 03.20D4D: GOTO 5650D4E: MOVLW 210D4F: MOVWF 770D50: DECFSZ 77,F0D51: GOTO 5500D52: MOVLW 3E0D53: ADDWF 4A,W0D54: MOVWF 040D55: BCF 03.70D56: MOVF 00,W0D57: MOVWF 4D0D58: MOVF 4D,W0D59: MOVWF 510D5A: BCF 0A.30D5B: CALL 09A0D5C: BSF 0A.30D5D: MOVF 4A,W0D5E: INCF 4A,F0D5F: ADDLW 3E0D60: MOVWF 040D61: BCF 03.70D62: MOVF 00,W0D63: XORWF 4B,F0D64: GOTO 547.................... sprintf(output,"%3.1f \0", altimet_t);0D65: CLRF 270D66: MOVLW 3E0D67: MOVWF 260D68: MOVLW 020D69: MOVWF 040D6A: MOVF 2B,W0D6B: MOVWF 500D6C: MOVF 2A,W0D6D: MOVWF 4F0D6E: MOVF 29,W0D6F: MOVWF 4E0D70: MOVF 28,W0D71: MOVWF 4D0D72: MOVLW 010D73: MOVWF 510D74: CALL 21A0D75: MOVLW 200D76: MOVWF 5A0D77: BCF 0A.30D78: CALL 7AB0D79: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }0D7A: CLRF 4A0D7B: MOVLW 3E0D7C: ADDWF 4A,W0D7D: MOVWF 040D7E: BCF 03.70D7F: MOVF 00,F0D80: BTFSC 03.20D81: GOTO 5990D82: MOVLW 210D83: MOVWF 770D84: DECFSZ 77,F0D85: GOTO 5840D86: MOVLW 3E0D87: ADDWF 4A,W0D88: MOVWF 040D89: BCF 03.70D8A: MOVF 00,W0D8B: MOVWF 4D0D8C: MOVF 4D,W0D8D: MOVWF 510D8E: BCF 0A.30D8F: CALL 09A0D90: BSF 0A.30D91: MOVF 4A,W0D92: INCF 4A,F0D93: ADDLW 3E0D94: MOVWF 040D95: BCF 03.70D96: MOVF 00,W0D97: XORWF 4B,F0D98: GOTO 57B.................... sprintf(output,"*%X\r\n\0", check);0D99: CLRF 270D9A: MOVLW 3E0D9B: MOVWF 260D9C: MOVLW 2A0D9D: MOVWF 5A0D9E: BCF 0A.30D9F: CALL 7AB0DA0: BSF 0A.30DA1: MOVF 4B,W0DA2: MOVWF 4D0DA3: MOVLW 370DA4: MOVWF 4E0DA5: BCF 0A.30DA6: GOTO 7D00DA7: BSF 0A.30DA8: MOVLW 0D0DA9: MOVWF 5A0DAA: BCF 0A.30DAB: CALL 7AB0DAC: BSF 0A.30DAD: MOVLW 0A0DAE: MOVWF 5A0DAF: BCF 0A.30DB0: CALL 7AB0DB1: BSF 0A.3.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); }0DB2: CLRF 4A0DB3: MOVLW 3E0DB4: ADDWF 4A,W0DB5: MOVWF 040DB6: BCF 03.70DB7: MOVF 00,F0DB8: BTFSC 03.20DB9: GOTO 5CB0DBA: MOVLW 210DBB: MOVWF 770DBC: DECFSZ 77,F0DBD: GOTO 5BC0DBE: MOVF 4A,W0DBF: INCF 4A,F0DC0: ADDLW 3E0DC1: MOVWF 040DC2: BCF 03.70DC3: MOVF 00,W0DC4: MOVWF 4D0DC5: MOVF 4D,W0DC6: MOVWF 510DC7: BCF 0A.30DC8: CALL 09A0DC9: BSF 0A.30DCA: GOTO 5B3.................... delay_us(SEND_DELAY);0DCB: MOVLW 210DCC: MOVWF 770DCD: DECFSZ 77,F0DCE: GOTO 5CD........................................ poradi++;0DCF: INCF 3C,F0DD0: BTFSC 03.20DD1: INCF 3D,F.................................................................................................................................................................................... }0DD2: GOTO 336............................................................ }0DD3: SLEEPConfiguration Fuses:Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUGWord 2: 3FFF NOWRT BORV40