CCS PCM C Compiler, Version 4.106, 47914 16-4-13 01:14
Filename: c:\users\honza\documents\pic\meteo_stanice\main.lst
ROM used: 3527 words (43%)
Largest free fragment is 2048
RAM used: 36 (10%) at main() level
89 (24%) worst case
Stack: 3 locations
*
0000: MOVLW 0B
0001: MOVWF 0A
0002: GOTO 30B
0003: 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 52
02A1: MOVWF 04
02A2: BCF 03.7
02A3: MOVF 00,W
02A4: BTFSC 03.2
02A5: GOTO 2B3
02A6: MOVLW 02
02A7: MOVWF 78
02A8: CLRF 77
02A9: DECFSZ 77,F
02AA: GOTO 2A9
02AB: DECFSZ 78,F
02AC: GOTO 2A8
02AD: MOVLW 97
02AE: MOVWF 77
02AF: DECFSZ 77,F
02B0: GOTO 2AF
02B1: DECFSZ 00,F
02B2: GOTO 2A6
02B3: RETURN
....................
....................
....................
.................... #define PIN_SDA PIN_B0
.................... #define PIN_SCL PIN_B1
.................... #use i2c(master, sda=PIN_SDA, scl=PIN_SCL)
*
01FB: MOVLW 08
01FC: MOVWF 78
01FD: NOP
01FE: BCF 06.1
01FF: BSF 03.5
0200: BCF 06.1
0201: NOP
0202: BCF 03.5
0203: RLF 5F,F
0204: BCF 06.0
0205: BTFSS 03.0
0206: GOTO 20A
0207: BSF 03.5
0208: BSF 06.0
0209: BCF 03.5
020A: BTFSC 03.0
020B: GOTO 20F
020C: BSF 03.5
020D: BCF 06.0
020E: BCF 03.5
020F: BSF 03.5
0210: BSF 06.1
0211: BCF 03.5
0212: BTFSS 06.1
0213: GOTO 212
0214: DECFSZ 78,F
0215: GOTO 1FD
0216: NOP
0217: BCF 06.1
0218: BSF 03.5
0219: BCF 06.1
021A: NOP
021B: BSF 06.0
021C: NOP
021D: NOP
021E: BSF 06.1
021F: BCF 03.5
0220: BTFSS 06.1
0221: GOTO 220
0222: CLRF 78
0223: NOP
0224: BTFSC 06.0
0225: BSF 78.0
0226: BCF 06.1
0227: BSF 03.5
0228: BCF 06.1
0229: BCF 03.5
022A: BCF 06.0
022B: BSF 03.5
022C: BCF 06.0
022D: BCF 03.5
022E: RETURN
*
02B4: MOVLW 08
02B5: MOVWF 60
02B6: MOVF 77,W
02B7: MOVWF 61
02B8: BSF 03.5
02B9: BSF 06.0
02BA: NOP
02BB: BSF 06.1
02BC: BCF 03.5
02BD: BTFSS 06.1
02BE: GOTO 2BD
02BF: BTFSC 06.0
02C0: BSF 03.0
02C1: BTFSS 06.0
02C2: BCF 03.0
02C3: RLF 78,F
02C4: NOP
02C5: BSF 03.5
02C6: BCF 06.1
02C7: BCF 03.5
02C8: BCF 06.1
02C9: DECFSZ 60,F
02CA: GOTO 2B8
02CB: BSF 03.5
02CC: BSF 06.0
02CD: NOP
02CE: BCF 03.5
02CF: BCF 06.0
02D0: MOVF 61,W
02D1: BTFSC 03.2
02D2: GOTO 2D6
02D3: BSF 03.5
02D4: BCF 06.0
02D5: BCF 03.5
02D6: NOP
02D7: BSF 03.5
02D8: BSF 06.1
02D9: BCF 03.5
02DA: BTFSS 06.1
02DB: GOTO 2DA
02DC: NOP
02DD: BCF 06.1
02DE: BSF 03.5
02DF: BCF 06.1
02E0: NOP
02E1: BCF 03.5
02E2: BCF 06.0
02E3: BSF 03.5
02E4: BCF 06.0
02E5: BCF 03.5
02E6: RETURN
.................... #use rs232(baud=9600,parity=N,xmit=PIN_B3,rcv=PIN_B2,bits=8) //rcv TXD xmit RXD
*
009A: BSF 03.5
009B: BCF 06.3
009C: BCF 03.5
009D: BCF 06.3
009E: MOVLW 08
009F: MOVWF 78
00A0: GOTO 0A1
00A1: NOP
00A2: BSF 78.7
00A3: GOTO 0B2
00A4: BCF 78.7
00A5: RRF 51,F
00A6: BTFSC 03.0
00A7: BSF 06.3
00A8: BTFSS 03.0
00A9: BCF 06.3
00AA: BSF 78.6
00AB: GOTO 0B2
00AC: BCF 78.6
00AD: DECFSZ 78,F
00AE: GOTO 0A5
00AF: GOTO 0B0
00B0: NOP
00B1: BSF 06.3
00B2: MOVLW 3F
00B3: MOVWF 04
00B4: DECFSZ 04,F
00B5: GOTO 0B4
00B6: NOP
00B7: BTFSC 78.7
00B8: GOTO 0A4
00B9: BTFSC 78.6
00BA: GOTO 0AC
00BB: RETURN
.................... #include <math.h>
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// (C) Copyright 1996,2008 Custom Computer Services ////
.................... //// This source code may only be used by licensed users of the CCS C ////
.................... //// compiler. This source code may only be distributed to other ////
.................... //// licensed users of the CCS C compiler. No other use, reproduction ////
.................... //// or distribution is permitted without written permission. ////
.................... //// Derivative programs created using this software in object code ////
.................... //// form are not restricted in any way. ////
.................... ////////////////////////////////////////////////////////////////////////////
.................... //// ////
.................... //// History: ////
.................... //// * 9/20/2001 : Improvments are made to sin/cos code. ////
.................... //// The code now is small, much faster, ////
.................... //// and more accurate. ////
.................... //// * 2/21/2007 : Compiler handles & operator differently and does
.................... //// not return generic (int8 *) so type cast is done ////
.................... //// ////
.................... ////////////////////////////////////////////////////////////////////////////
....................
.................... #ifndef MATH_H
.................... #define MATH_H
....................
.................... #ifdef PI
.................... #undef PI
.................... #endif
.................... #define PI 3.1415926535897932
....................
....................
.................... #define SQRT2 1.4142135623730950
....................
.................... //float const ps[4] = {5.9304945, 21.125224, 8.9403076, 0.29730279};
.................... //float const qs[4] = {1.0000000, 15.035723, 17.764134, 2.4934718};
....................
.................... ///////////////////////////// Round Functions //////////////////////////////
....................
.................... float32 CEIL_FLOOR(float32 x, unsigned int8 n)
.................... {
.................... float32 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float32)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float32)l);
.................... res = 32768.0*(float32)l;
.................... res += (float32)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float32)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
....................
.................... // Overloaded Functions to take care for new Data types in PCD
.................... // Overloaded function CEIL_FLOOR() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 CEIL_FLOOR(float48 x, unsigned int8 n)
.................... {
.................... float48 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float48)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float48)l);
.................... res = 32768.0*(float32)l;
.................... res += (float48)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float48)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
....................
....................
.................... // Overloaded function CEIL_FLOOR() for data type - Float64
.................... float64 CEIL_FLOOR(float64 x, unsigned int8 n)
.................... {
.................... float64 y, res;
.................... unsigned int16 l;
.................... int1 s;
....................
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y <= 32768.0)
.................... res = (float64)(unsigned int16)y;
....................
.................... else if (y < 10000000.0)
.................... {
.................... l = (unsigned int16)(y/32768.0);
.................... y = 32768.0*(y/32768.0 - (float64)l);
.................... res = 32768.0*(float64)l;
.................... res += (float64)(unsigned int16)y;
.................... }
....................
.................... else
.................... res = y;
....................
.................... y = y - (float64)(unsigned int16)y;
....................
.................... if (s)
.................... res = -res;
....................
.................... if (y != 0)
.................... {
.................... if (s == 1 && n == 0)
.................... res -= 1.0;
....................
.................... if (s == 0 && n == 1)
.................... res += 1.0;
.................... }
.................... if (x == 0)
.................... res = 0;
....................
.................... return (res);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float floor(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : rounds down the number x.
.................... // Date : N/A
.................... //
.................... float32 floor(float32 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
.................... // Following 2 functions are overloaded functions of floor() for PCD
.................... // Overloaded function floor() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 floor(float48 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
....................
.................... // Overloaded function floor() for data type - Float64
.................... float64 floor(float64 x)
.................... {
.................... return CEIL_FLOOR(x, 0);
.................... }
.................... #endif
....................
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float ceil(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : rounds up the number x.
.................... // Date : N/A
.................... //
.................... float32 ceil(float32 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
.................... // Following 2 functions are overloaded functions of ceil() for PCD
.................... // Overloaded function ceil() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 ceil(float48 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
....................
.................... // Overloaded function ceil() for data type - Float64
.................... float64 ceil(float64 x)
.................... {
.................... return CEIL_FLOOR(x, 1);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float fabs(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the absolute value of floating point number x
.................... // Returns : returns the absolute value of x
.................... // Date : N/A
.................... //
.................... #define fabs abs
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float fmod(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : Computes the floating point remainder of x/y
.................... // Returns : returns the value of x= i*y, for some integer i such that, if y
.................... // is non zero, the result has the same isgn of x na dmagnitude less than the
.................... // magnitude of y. If y is zero then a domain error occurs.
.................... // Date : N/A
.................... //
....................
.................... float fmod(float32 x,float32 y)
.................... {
.................... float32 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... //Overloaded function for fmod() for PCD
.................... // Overloaded function fmod() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 fmod(float48 x,float48 y)
.................... {
.................... float48 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... // Overloaded function fmod() for data type - Float64
.................... float64 fmod(float64 x,float64 y)
.................... {
.................... float64 i;
.................... if (y!=0.0)
.................... {
.................... i=(x/y < 0.0)? ceil(x/y): floor(x/y);
.................... return(x-(i*y));
.................... }
.................... else
.................... {
.................... #ifdef _ERRNO
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... }
.................... }
.................... #endif
.................... //////////////////// Exponential and logarithmic functions ////////////////////
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float exp(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (e^x)
.................... // Date : N/A
.................... //
.................... #define LN2 0.6931471805599453
....................
.................... float const pe[6] = {0.000207455774, 0.00127100575, 0.00965065093,
.................... 0.0554965651, 0.240227138, 0.693147172};
....................
....................
.................... float32 exp(float32 x)
.................... {
.................... float32 y, res, r;
.................... #if defined(__PCD__)
.................... int8 data1;
.................... #endif
.................... signed int8 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 88.722838)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&res)) = n + 0x7F;
.................... #endif
....................
.................... #if defined(__PCD__) // Takes care of IEEE format for PCD
.................... data1 = n+0x7F;
.................... if(bit_test(data1,0))
.................... bit_set(*(((unsigned int8 *)(&res)+2)),7);
.................... rotate_right(&data1,1);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&res)+3)) = data1;
.................... #endif
....................
.................... y = y/LN2 - (float32)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
....................
.................... //Overloaded function for exp() for PCD
.................... // Overloaded function exp() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 exp(float48 x)
.................... {
.................... float48 y, res, r;
.................... int8 data1;
.................... signed int8 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 88.722838)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
....................
.................... data1 = n+0x7F;
.................... if(bit_test(data1,0))
.................... bit_set(*(((unsigned int8 *)(&res)+4)),7);
.................... rotate_right(&data1,1);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&res)+5)) = data1;
....................
.................... y = y/LN2 - (float48)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
.................... // Overloaded function exp() for data type - Float64
.................... float64 exp(float64 x)
.................... {
.................... float64 y, res, r;
.................... unsigned int16 data1, data2;
.................... unsigned int16 *p;
.................... signed int16 n;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x > 709.7827128)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... n = (signed int16)(x/LN2);
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... n = -n;
.................... y = -y;
.................... }
....................
.................... res = 0.0;
....................
.................... #if !defined(__PCD__)
.................... *((unsigned int16 *)(&res)) = n + 0x7F;
.................... #endif
.................... p= (((unsigned int16 *)(&res))+3);
.................... data1 = *p;
.................... data2 = *p;
.................... data1 = n + 0x3FF;
.................... data1 = data1 <<4;
.................... if(bit_test(data2,15))
.................... bit_set(data1,15);
.................... data2 = data2 & 0x000F;
.................... data1 ^= data2;
....................
.................... *(((unsigned int16 *)(&res)+3)) = data1;
....................
....................
.................... y = y/LN2 - (float64)n;
....................
.................... r = pe[0]*y + pe[1];
.................... r = r*y + pe[2];
.................... r = r*y + pe[3];
.................... r = r*y + pe[4];
.................... r = r*y + pe[5];
....................
.................... res = res*(1.0 + y*r);
....................
.................... if (s)
.................... res = 1.0/res;
.................... return(res);
.................... }
....................
.................... #ENDIF
....................
....................
.................... /************************************************************/
....................
.................... float32 const pl[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
.................... float32 const ql[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float log(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the the natural log of x
.................... // Date : N/A
.................... //
.................... float32 log(float32 x)
.................... {
.................... float32 y, res, r, y2;
.................... #if defined(__PCD__)
.................... unsigned int8 data1,data2;
.................... #endif
.................... signed int8 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
....................
.................... #if defined(__PCD__) // Takes care of IEEE format
.................... data2 = *(((unsigned int8 *)(&y))+3);
.................... *(((unsigned int8 *)(&y))+3) = 0x3F;
.................... data1 = *(((unsigned int8 *)(&y))+2);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&y))+2) = data1;
.................... if(bit_test(data2,7))
.................... bit_set(*(((unsigned int8 *)(&y))+3),7);
.................... #endif
....................
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl[0]*y2 + pl[1];
.................... res = res*y2 + pl[2];
.................... res = res*y2 + pl[3];
....................
.................... r = ql[0]*y2 + ql[1];
.................... r = r*y2 + ql[2];
.................... r = r*y2 + ql[3];
....................
.................... res = y*res/r;
.................... #if !defined(__PCD__)
.................... n = *((unsigned int8 *)(&x)) - 0x7E;
.................... #endif
.................... #if defined(__PCD__)
.................... data1 = *(((unsigned int8 *)(&x)+3));
.................... rotate_left(&data1,1);
.................... data2 = *(((unsigned int8 *)(&x)+2));
.................... if(bit_test (data2,7))
.................... bit_set(data1,0);
.................... n = data1 - 0x7E;
.................... #endif
....................
.................... if (n<0)
.................... r = -(float32)-n;
.................... else
.................... r = (float32)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
....................
.................... //Overloaded function for log() for PCD
.................... // Overloaded function log() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 log(float48 x)
.................... {
.................... float48 y, res, r, y2;
.................... unsigned int8 data1,data2;
.................... signed int8 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
....................
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
.................... data2 = *(((unsigned int8 *)(&y))+5);
.................... *(((unsigned int8 *)(&y))+5) = 0x3F;
.................... data1 = *(((unsigned int8 *)(&y))+4);
.................... bit_clear(data1,7);
.................... *(((unsigned int8 *)(&y))+4) = data1;
....................
.................... if(bit_test(data2,7))
.................... bit_set(*(((unsigned int8 *)(&y))+4),7);
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl[0]*y2 + pl[1];
.................... res = res*y2 + pl[2];
.................... res = res*y2 + pl[3];
....................
.................... r = ql[0]*y2 + ql[1];
.................... r = r*y2 + ql[2];
.................... r = r*y2 + ql[3];
....................
.................... res = y*res/r;
....................
.................... data1 = *(((unsigned int8 *)(&x)+5));
.................... rotate_left(&data1,1);
.................... data2 = *(((unsigned int8 *)(&x)+4));
.................... if(bit_test (data2,7))
.................... bit_set(data1,0);
....................
.................... n = data1 - 0x7E;
....................
.................... if (n<0)
.................... r = -(float48)-n;
.................... else
.................... r = (float48)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function log() for data type - Float48
.................... #if defined(__PCD__)
.................... float32 const pl_64[4] = {0.45145214, -9.0558803, 26.940971, -19.860189};
.................... float32 const ql_64[4] = {1.0000000, -8.1354259, 16.780517, -9.9300943};
.................... #endif
.................... float64 log(float64 x)
.................... {
.................... float64 y, res, r, y2;
.................... unsigned int16 data1,data2;
.................... unsigned int16 *p;
.................... signed int16 n;
.................... #ifdef _ERRNO
.................... if(x <0)
.................... {
.................... errno=EDOM;
.................... }
.................... if(x ==0)
.................... {
.................... errno=ERANGE;
.................... return(0);
.................... }
.................... #endif
.................... y = x;
....................
.................... if (y != 1.0)
.................... {
.................... #if !defined(__PCD__)
.................... *((unsigned int8 *)(&y)) = 0x7E;
.................... #endif
.................... p= (((unsigned int16 *)(&y))+3);
.................... data1 = *p;
.................... data2 = *p;
.................... data1 = 0x3FE;
.................... data1 = data1 <<4;
.................... if(bit_test (data2,15))
.................... bit_set(data1,15);
.................... data2 = data2 & 0x000F;
.................... data1 ^=data2;
....................
.................... *p = data1;
....................
.................... y = (y - 1.0)/(y + 1.0);
....................
.................... y2=y*y;
....................
.................... res = pl_64[0]*y2 + pl_64[1];
.................... res = res*y2 + pl_64[2];
.................... res = res*y2 + pl_64[3];
....................
.................... r = ql_64[0]*y2 + ql_64[1];
.................... r = r*y2 + ql_64[2];
.................... r = r*y2 + ql_64[3];
....................
.................... res = y*res/r;
....................
.................... p= (((unsigned int16 *)(&x))+3);
.................... data1 = *p;
.................... bit_clear(data1,15);
.................... data1 = data1 >>4;
.................... n = data1 - 0x3FE;
....................
....................
.................... if (n<0)
.................... r = -(float64)-n;
.................... else
.................... r = (float64)n;
....................
.................... res += r*LN2;
.................... }
....................
.................... else
.................... res = 0.0;
....................
.................... return(res);
.................... }
.................... #endif
....................
....................
.................... #define LN10 2.3025850929940456
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float log10(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the the log base 10 of x
.................... // Date : N/A
.................... //
.................... float32 log10(float32 x)
.................... {
.................... float32 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
....................
.................... //Overloaded functions for log10() for PCD
.................... // Overloaded function log10() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 log10(float48 x)
.................... {
.................... float48 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
....................
.................... // Overloaded function log10() for data type - Float64
.................... float64 log10(float64 x)
.................... {
.................... float64 r;
....................
.................... r = log(x);
.................... r = r/LN10;
.................... return(r);
.................... }
.................... #endif
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float modf(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description :breaks the argument value int integral and fractional parts,
.................... // ach of which have the same sign as the argument. It stores the integral part
.................... // as a float in the object pointed to by the iptr
.................... // Returns : returns the signed fractional part of value.
.................... // Date : N/A
.................... //
....................
.................... float32 modf(float32 value,float32 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... //Overloaded functions for modf() for PCD
.................... // Overloaded function modf() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 modf(float48 value,float48 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... // Overloaded function modf() for data type - Float64
.................... float64 modf(float64 value,float64 *iptr)
.................... {
.................... *iptr=(value < 0.0)? ceil(value): floor(value);
.................... return(value - *iptr);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float pwr(float x,float y)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (x^y)
.................... // Date : N/A
.................... // Note : 0 is returned when the function will generate an imaginary number
.................... //
.................... float32 pwr(float32 x,float32 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... //Overloaded functions for pwr() for PCD
.................... // Overloaded function pwr() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 pwr(float48 x,float48 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... // Overloaded function pwr() for data type - Float64
.................... float64 pwr(float64 x,float64 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... #endif
....................
.................... //////////////////// Power functions ////////////////////
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float pow(float x,float y)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the value (x^y)
.................... // Date : N/A
.................... // Note : 0 is returned when the function will generate an imaginary number
.................... //
.................... float32 pow(float32 x,float32 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... //Overloaded functions for pow() for PCD
.................... // Overloaded function for pow() data type - Float48
.................... #if defined(__PCD__)
.................... float48 pow(float48 x,float48 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
....................
.................... // Overloaded function pow() for data type - Float64
.................... float64 pow(float64 x,float64 y)
.................... {
.................... if(0 > x && fmod(y, 1) == 0) {
.................... if(fmod(y, 2) == 0) {
.................... return (exp(log(-x) * y));
.................... } else {
.................... return (-exp(log(-x) * y));
.................... }
.................... } else if(0 > x && fmod(y, 1) != 0) {
.................... return 0;
.................... } else {
.................... if(x != 0 || 0 >= y) {
.................... return (exp(log(x) * y));
.................... }
.................... }
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sqrt(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the square root of x
.................... // Date : N/A
.................... //
.................... float32 sqrt(float32 x)
.................... {
.................... float32 y, res;
.................... #if defined(__PCD__)
.................... unsigned int16 data1,data2;
.................... #endif
.................... BYTE *p;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
....................
.................... #if !defined(__PCD__)
.................... p=&y;
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
.................... #endif
....................
.................... #if defined(__PCD__)
.................... p = (((unsigned int8 *)(&y))+3);
.................... data1 = *(((unsigned int8 *)(&y))+3);
.................... data2 = *(((unsigned int8 *)(&y))+2);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1 = ((data1+127) >>1);
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+3) = data1;
.................... *(((unsigned int8 *)(&y))+2) = data2;
....................
.................... #endif
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
....................
.................... #if !defined(__PCD__)
.................... (*p)--;
.................... #endif
....................
.................... #if defined(__PCD__)
.................... data1 = *(((unsigned int8 *)(&y))+3);
.................... data2 = *(((unsigned int8 *)(&y))+2);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1--;
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+3) = data1;
.................... *(((unsigned int8 *)(&y))+2) = data2;
....................
.................... #endif
.................... } while(res != y);
....................
.................... return(res);
.................... }
.................... //Overloaded functions for sqrt() for PCD
.................... // Overloaded function sqrt() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sqrt(float48 x)
.................... {
.................... float48 y, res;
.................... unsigned int16 data1,data2;
.................... BYTE *p;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
....................
.................... #if !defined(__PCD__)
.................... p=&y;
.................... (*p)=(BYTE)((((unsigned int16)(*p)) + 127) >> 1);
.................... #endif
....................
.................... #if defined(__PCD__)
.................... p = (((unsigned int8 *)(&y))+5);
.................... data1 = *(((unsigned int8 *)(&y))+5);
.................... data2 = *(((unsigned int8 *)(&y))+4);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1 = ((data1+127) >>1);
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+5) = data1;
.................... *(((unsigned int8 *)(&y))+4) = data2;
....................
.................... #endif
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
....................
.................... #if !defined(__PCD__)
.................... (*p)--;
.................... #endif
....................
.................... data1 = *(((unsigned int8 *)(&y))+5);
.................... data2 = *(((unsigned int8 *)(&y))+4);
.................... rotate_left(&data1,1);
.................... if(bit_test(data2,7))
.................... bit_set(data1,0);
.................... data1--;
.................... bit_clear(data2,7);
.................... if(bit_test(data1,0))
.................... bit_set(data2,7);
.................... data1 = data1 >>1;
.................... *(((unsigned int8 *)(&y))+5) = data1;
.................... *(((unsigned int8 *)(&y))+4) = data2;
....................
.................... } while(res != y);
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function sqrt() for data type - Float64
.................... float64 sqrt(float64 x)
.................... {
.................... float64 y, res;
.................... unsigned int16 *p;
.................... unsigned int16 temp1,temp2;
....................
.................... #ifdef _ERRNO
.................... if(x < 0)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
....................
.................... if( x<=0.0)
.................... return(0.0);
....................
.................... y=x;
.................... p= (((unsigned int16 *)(&y))+3);
.................... temp1 = *p;
.................... temp2 = *p;
.................... bit_clear(temp1,15);
.................... temp1 = (temp1>>4)+1023;
.................... temp1 = temp1 >> 1;
.................... temp1 = (temp1<<4) & 0xFFF0;
.................... if(bit_test(temp2,15))
.................... bit_set(temp1,15);
.................... temp2 = temp2 & 0x000F;
.................... temp1 ^= temp2;
....................
.................... (*p) = temp1;
....................
.................... do {
.................... res=y;
.................... y+=(x/y);
.................... temp1 = *p;
.................... temp2 = *p;
.................... bit_clear(temp1,15);
.................... temp1 = (temp1>>4);
.................... temp1--;
.................... temp1 = (temp1<<4) & 0xFFF0;
.................... if(bit_test(temp2,15))
.................... bit_set(temp1,15);
.................... temp2 = temp2 & 0x000F;
.................... temp1 ^= temp2;
.................... (*p) = temp1;
....................
.................... } while(res != y);
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... ////////////////////////////// Trig Functions //////////////////////////////
.................... #ifdef PI_DIV_BY_TWO
.................... #undef PI_DIV_BY_TWO
.................... #endif
.................... #define PI_DIV_BY_TWO 1.5707963267948966
.................... #ifdef TWOBYPI
.................... #undef TWOBYPI
.................... #define TWOBYPI 0.6366197723675813
.................... #endif
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float cos(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the cosine value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 cos(float32 x)
.................... {
.................... float32 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float32 frac;
.................... float32 p[6] = { //by the series definition for cosine
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
.................... 0.04166666666667,
.................... -0.00138888888889,
.................... 0.00002480158730,
.................... -0.00000027557319,
.................... 0.00000000208767,
.................... //-0.00000000001147,
.................... // 0.00000000000005
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 1.0;
.................... t = t * t;
.................... for (i = 0; i <= 5; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
....................
.................... //Overloaded functions for cos() for PCD
.................... // Overloaded function cos() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 cos(float48 x)
.................... {
.................... float48 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float48 frac;
.................... float48 p[6] = { //by the series definition for cosine
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
.................... 0.04166666666667,
.................... -0.00138888888889,
.................... 0.00002480158730,
.................... -0.00000027557319,
.................... 0.00000000208767,
.................... //-0.00000000001147,
.................... // 0.00000000000005
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 5; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
.................... // Overloaded function cos() for data type - Float48
.................... float64 cos(float64 x)
.................... {
.................... float64 y, t, t2 = 1.0;
.................... unsigned int8 quad, i;
.................... float64 frac;
.................... float64 p[6] = { //by the series definition for cosine
.................... -0.5, // sum ( ( (-1)^n * x^2n )/(2n)! )
.................... 0.04166666666667,
.................... -0.00138888888889,
.................... 0.00002480158730,
.................... -0.00000027557319,
.................... 0.00000000208767,
.................... //-0.00000000001147,
.................... // 0.00000000000005
.................... };
....................
.................... if (x < 0) x = -x; // absolute value of input
....................
.................... quad = (unsigned int8)(x / PI_DIV_BY_TWO); // quadrant
.................... frac = (x / PI_DIV_BY_TWO) - quad; // fractional part of input
.................... quad = quad % 4; // quadrant (0 to 3)
....................
.................... if (quad == 0 || quad == 2)
.................... t = frac * PI_DIV_BY_TWO;
.................... else if (quad == 1)
.................... t = (1-frac) * PI_DIV_BY_TWO;
.................... else // should be 3
.................... t = (frac-1) * PI_DIV_BY_TWO;
....................
.................... y = 0.999999999781;
.................... t = t * t;
.................... for (i = 0; i <= 5; i++)
.................... {
.................... t2 = t2 * t;
.................... y = y + p[i] * t2;
.................... }
....................
.................... if (quad == 2 || quad == 1)
.................... y = -y; // correct sign
....................
.................... return (y);
.................... }
....................
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float sin(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the sine value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 sin(float32 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
....................
.................... //Overloaded functions for sin() for PCD
.................... // Overloaded function sin() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 sin(float48 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
....................
.................... // Overloaded function sin() for data type - Float48
.................... float64 sin(float64 x)
.................... {
.................... return cos(x - PI_DIV_BY_TWO);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float tan(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the tangent value of the angle x, which is in radian
.................... // Date : 9/20/2001
.................... //
.................... float32 tan(float32 x)
.................... {
.................... float32 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
.................... //Overloaded functions for tan() for PCD
.................... // Overloaded function tan() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 tan(float48 x)
.................... {
.................... float48 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
....................
.................... // Overloaded function tan() for data type - Float48
.................... float64 tan(float64 x)
.................... {
.................... float64 c, s;
....................
.................... c = cos(x);
.................... if (c == 0.0)
.................... return (1.0e+36);
....................
.................... s = sin(x);
.................... return(s/c);
.................... }
.................... #endif
....................
.................... float32 const pas[3] = {0.49559947, -4.6145309, 5.6036290};
.................... float32 const qas[3] = {1.0000000, -5.5484666, 5.6036290};
....................
.................... float32 ASIN_COS(float32 x, unsigned int8 n)
.................... {
.................... float32 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
....................
.................... //Overloaded functions for ASIN_COS() for PCD
.................... // Overloaded function ASIN_COS() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 ASIN_COS(float48 x, unsigned int8 n)
.................... {
.................... float48 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
....................
.................... // Overloaded function ASIN_COS() for data type - Float64
.................... float64 ASIN_COS(float64 x, unsigned int8 n)
.................... {
.................... float64 y, res, r, y2;
.................... int1 s;
.................... #ifdef _ERRNO
.................... if(x <-1 || x > 1)
.................... {
.................... errno=EDOM;
.................... }
.................... #endif
.................... s = 0;
.................... y = x;
....................
.................... if (x < 0)
.................... {
.................... s = 1;
.................... y = -y;
.................... }
....................
.................... if (y > 0.5)
.................... {
.................... y = sqrt((1.0 - y)/2.0);
.................... n += 2;
.................... }
....................
.................... y2=y*y;
....................
.................... res = pas[0]*y2 + pas[1];
.................... res = res*y2 + pas[2];
....................
.................... r = qas[0]*y2 + qas[1];
.................... r = r*y2 + qas[2];
....................
.................... res = y*res/r;
....................
.................... if (n & 2) // |x| > 0.5
.................... res = PI_DIV_BY_TWO - 2.0*res;
.................... if (s)
.................... res = -res;
.................... if (n & 1) // take arccos
.................... res = PI_DIV_BY_TWO - res;
....................
.................... return(res);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float asin(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arcsine value of the value x.
.................... // Date : N/A
.................... //
.................... float32 asin(float32 x)
.................... {
.................... float32 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
.................... //Overloaded functions for asin() for PCD
.................... // Overloaded function asin() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 asin(float48 x)
.................... {
.................... float48 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
....................
.................... // Overloaded function asin() for data type - Float64
.................... float64 asin(float64 x)
.................... {
.................... float64 r;
....................
.................... r = ASIN_COS(x, 0);
.................... return(r);
.................... }
.................... #endif
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float acos(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arccosine value of the value x.
.................... // Date : N/A
.................... //
.................... float32 acos(float32 x)
.................... {
.................... float32 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
.................... //Overloaded functions for acos() for PCD
.................... // Overloaded function acos() for data type - Float48
.................... #if defined(__PCD__)
.................... float48 acos(float48 x)
.................... {
.................... float48 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
....................
.................... // Overloaded function acos() for data type - Float64
.................... float64 acos(float64 x)
.................... {
.................... float64 r;
....................
.................... r = ASIN_COS(x, 1);
.................... return(r);
.................... }
.................... #endif
....................
.................... float32 const pat[4] = {0.17630401, 5.6710795, 22.376096, 19.818457};
.................... float32 const qat[4] = {1.0000000, 11.368190, 28.982246, 19.818457};
....................
.................... ////////////////////////////////////////////////////////////////////////////
.................... // float atan(float x)
.................... ////////////////////////////////////////////////////////////////////////////
.................... // Description : returns the arctangent value of the value x.
.................... // Date : N/A
.................... //
.................... float32 atan(float32 x)
.................... {
.................... float32 y, res, r;
.................... int1 s, flag;
....................
.................... s = 0;
.................... 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.6
0B26: CLRF 20
0B27: 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.5
0801: BSF 06.0
0802: NOP
0803: BSF 06.1
0804: NOP
0805: BCF 03.5
0806: BTFSS 06.1
0807: GOTO 006
0808: BCF 06.0
0809: BSF 03.5
080A: BCF 06.0
080B: NOP
080C: BCF 03.5
080D: BCF 06.1
080E: BSF 03.5
080F: BCF 06.1
.................... I2C_Write(SHT25_ADDR);
0810: MOVLW 80
0811: BCF 03.5
0812: MOVWF 5F
0813: BCF 0A.3
0814: CALL 1FB
0815: BSF 0A.3
.................... I2C_write(0xE3);
0816: MOVLW E3
0817: MOVWF 5F
0818: BCF 0A.3
0819: CALL 1FB
081A: BSF 0A.3
.................... i2c_stop();
081B: BSF 03.5
081C: BCF 06.0
081D: NOP
081E: BSF 06.1
081F: BCF 03.5
0820: BTFSS 06.1
0821: GOTO 020
0822: NOP
0823: GOTO 024
0824: NOP
0825: BSF 03.5
0826: BSF 06.0
0827: NOP
....................
.................... delay_ms(100);
0828: MOVLW 64
0829: BCF 03.5
082A: MOVWF 52
082B: BCF 0A.3
082C: CALL 2A0
082D: BSF 0A.3
....................
.................... i2c_start();
082E: BSF 03.5
082F: BSF 06.0
0830: NOP
0831: BSF 06.1
0832: NOP
0833: BCF 03.5
0834: BCF 06.0
0835: BSF 03.5
0836: BCF 06.0
0837: NOP
0838: BCF 03.5
0839: BCF 06.1
083A: BSF 03.5
083B: BCF 06.1
.................... I2C_Write(SHT25_ADDR+1);
083C: MOVLW 81
083D: BCF 03.5
083E: MOVWF 5F
083F: BCF 0A.3
0840: CALL 1FB
0841: BSF 0A.3
.................... MSB=i2c_read(1);
0842: MOVLW 01
0843: MOVWF 77
0844: BCF 0A.3
0845: CALL 2B4
0846: BSF 0A.3
0847: MOVF 78,W
0848: MOVWF 4D
.................... LSB=i2c_read(1);
0849: MOVLW 01
084A: MOVWF 77
084B: BCF 0A.3
084C: CALL 2B4
084D: BSF 0A.3
084E: MOVF 78,W
084F: MOVWF 4E
.................... Check=i2c_read(0);
0850: CLRF 77
0851: BCF 0A.3
0852: CALL 2B4
0853: BSF 0A.3
0854: MOVF 78,W
0855: MOVWF 4F
.................... i2c_stop();
0856: BSF 03.5
0857: BCF 06.0
0858: NOP
0859: BSF 06.1
085A: BCF 03.5
085B: BTFSS 06.1
085C: GOTO 05B
085D: NOP
085E: GOTO 05F
085F: NOP
0860: BSF 03.5
0861: BSF 06.0
0862: NOP
....................
.................... LSB = LSB >> 2; // trow out status bits
0863: BCF 03.5
0864: RRF 4E,F
0865: RRF 4E,F
0866: MOVLW 3F
0867: ANDWF 4E,F
....................
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4));
0868: CLRF 53
0869: MOVF 4D,W
086A: MOVWF 52
086B: MOVWF 53
086C: CLRF 52
086D: SWAPF 4E,W
086E: MOVWF 77
086F: MOVLW F0
0870: ANDWF 77,F
0871: MOVF 77,W
0872: ADDWF 52,W
0873: MOVWF 50
0874: MOVF 53,W
0875: MOVWF 51
0876: BTFSC 03.0
0877: INCF 51,F
.................... return(-46.85 + 175.72*((float)data/0xFFFF));
0878: MOVF 51,W
0879: MOVWF 5F
087A: MOVF 50,W
087B: MOVWF 5E
087C: BCF 0A.3
087D: CALL 325
087E: BSF 0A.3
087F: MOVF 77,W
0880: MOVWF 52
0881: MOVF 78,W
0882: MOVWF 53
0883: MOVF 79,W
0884: MOVWF 54
0885: MOVF 7A,W
0886: MOVWF 55
0887: MOVWF 65
0888: MOVF 54,W
0889: MOVWF 64
088A: MOVF 53,W
088B: MOVWF 63
088C: MOVF 52,W
088D: MOVWF 62
088E: CLRF 69
088F: MOVLW FF
0890: MOVWF 68
0891: MOVLW 7F
0892: MOVWF 67
0893: MOVLW 8E
0894: MOVWF 66
0895: BCF 0A.3
0896: CALL 342
0897: BSF 0A.3
0898: MOVLW 52
0899: MOVWF 5D
089A: MOVLW B8
089B: MOVWF 5C
089C: MOVLW 2F
089D: MOVWF 5B
089E: MOVLW 86
089F: MOVWF 5A
08A0: MOVF 7A,W
08A1: MOVWF 61
08A2: MOVF 79,W
08A3: MOVWF 60
08A4: MOVF 78,W
08A5: MOVWF 5F
08A6: MOVF 77,W
08A7: MOVWF 5E
08A8: BCF 0A.3
08A9: CALL 736
08AA: BSF 0A.3
08AB: BCF 03.1
08AC: MOVLW 66
08AD: MOVWF 67
08AE: MOVWF 66
08AF: MOVLW BB
08B0: MOVWF 65
08B1: MOVLW 84
08B2: MOVWF 64
08B3: MOVF 7A,W
08B4: MOVWF 6B
08B5: MOVF 79,W
08B6: MOVWF 6A
08B7: MOVF 78,W
08B8: MOVWF 69
08B9: MOVF 77,W
08BA: MOVWF 68
08BB: BCF 0A.3
08BC: CALL 40C
08BD: BSF 0A.3
.................... }
08BE: BSF 0A.3
08BF: BCF 0A.4
08C0: GOTO 372 (RETURN)
....................
.................... float SHT25_get_hum()
.................... {
.................... unsigned int8 MSB, LSB, Check;
.................... unsigned int16 data;
....................
.................... i2c_start(); //RH
08C1: BSF 03.5
08C2: BSF 06.0
08C3: NOP
08C4: BSF 06.1
08C5: NOP
08C6: BCF 03.5
08C7: BCF 06.0
08C8: BSF 03.5
08C9: BCF 06.0
08CA: NOP
08CB: BCF 03.5
08CC: BCF 06.1
08CD: BSF 03.5
08CE: BCF 06.1
.................... I2C_Write(SHT25_ADDR);
08CF: MOVLW 80
08D0: BCF 03.5
08D1: MOVWF 5F
08D2: BCF 0A.3
08D3: CALL 1FB
08D4: BSF 0A.3
.................... I2C_write(0xE5);
08D5: MOVLW E5
08D6: MOVWF 5F
08D7: BCF 0A.3
08D8: CALL 1FB
08D9: BSF 0A.3
....................
.................... delay_ms(100);
08DA: MOVLW 64
08DB: MOVWF 52
08DC: BCF 0A.3
08DD: CALL 2A0
08DE: BSF 0A.3
....................
.................... i2c_start();
08DF: BSF 03.5
08E0: BSF 06.0
08E1: NOP
08E2: BSF 06.1
08E3: NOP
08E4: BCF 03.5
08E5: BTFSS 06.1
08E6: GOTO 0E5
08E7: BCF 06.0
08E8: BSF 03.5
08E9: BCF 06.0
08EA: NOP
08EB: BCF 03.5
08EC: BCF 06.1
08ED: BSF 03.5
08EE: BCF 06.1
.................... I2C_Write(SHT25_ADDR+1);
08EF: MOVLW 81
08F0: BCF 03.5
08F1: MOVWF 5F
08F2: BCF 0A.3
08F3: CALL 1FB
08F4: BSF 0A.3
.................... MSB=i2c_read(1);
08F5: MOVLW 01
08F6: MOVWF 77
08F7: BCF 0A.3
08F8: CALL 2B4
08F9: BSF 0A.3
08FA: MOVF 78,W
08FB: MOVWF 4D
.................... LSB=i2c_read(1);
08FC: MOVLW 01
08FD: MOVWF 77
08FE: BCF 0A.3
08FF: CALL 2B4
0900: BSF 0A.3
0901: MOVF 78,W
0902: MOVWF 4E
.................... Check=i2c_read(0);
0903: CLRF 77
0904: BCF 0A.3
0905: CALL 2B4
0906: BSF 0A.3
0907: MOVF 78,W
0908: MOVWF 4F
.................... i2c_stop();
0909: BSF 03.5
090A: BCF 06.0
090B: NOP
090C: BSF 06.1
090D: BCF 03.5
090E: BTFSS 06.1
090F: GOTO 10E
0910: NOP
0911: GOTO 112
0912: NOP
0913: BSF 03.5
0914: BSF 06.0
0915: NOP
....................
.................... LSB = LSB >> 2; // trow out status bits
0916: BCF 03.5
0917: RRF 4E,F
0918: RRF 4E,F
0919: MOVLW 3F
091A: ANDWF 4E,F
....................
.................... data = (((unsigned int16) MSB << 8) + (LSB << 4) );
091B: CLRF 53
091C: MOVF 4D,W
091D: MOVWF 52
091E: MOVWF 53
091F: CLRF 52
0920: SWAPF 4E,W
0921: MOVWF 77
0922: MOVLW F0
0923: ANDWF 77,F
0924: MOVF 77,W
0925: ADDWF 52,W
0926: MOVWF 50
0927: MOVF 53,W
0928: MOVWF 51
0929: BTFSC 03.0
092A: INCF 51,F
.................... return( -6.0 + 125.0*((float)data/0xFFFF));
092B: MOVF 51,W
092C: MOVWF 5F
092D: MOVF 50,W
092E: MOVWF 5E
092F: BCF 0A.3
0930: CALL 325
0931: BSF 0A.3
0932: MOVF 77,W
0933: MOVWF 52
0934: MOVF 78,W
0935: MOVWF 53
0936: MOVF 79,W
0937: MOVWF 54
0938: MOVF 7A,W
0939: MOVWF 55
093A: MOVWF 65
093B: MOVF 79,W
093C: MOVWF 64
093D: MOVF 78,W
093E: MOVWF 63
093F: MOVF 77,W
0940: MOVWF 62
0941: CLRF 69
0942: MOVLW FF
0943: MOVWF 68
0944: MOVLW 7F
0945: MOVWF 67
0946: MOVLW 8E
0947: MOVWF 66
0948: BCF 0A.3
0949: CALL 342
094A: BSF 0A.3
094B: CLRF 5D
094C: CLRF 5C
094D: MOVLW 7A
094E: MOVWF 5B
094F: MOVLW 85
0950: MOVWF 5A
0951: MOVF 7A,W
0952: MOVWF 61
0953: MOVF 79,W
0954: MOVWF 60
0955: MOVF 78,W
0956: MOVWF 5F
0957: MOVF 77,W
0958: MOVWF 5E
0959: BCF 0A.3
095A: CALL 736
095B: BSF 0A.3
095C: BCF 03.1
095D: CLRF 67
095E: CLRF 66
095F: MOVLW C0
0960: MOVWF 65
0961: MOVLW 81
0962: MOVWF 64
0963: MOVF 7A,W
0964: MOVWF 6B
0965: MOVF 79,W
0966: MOVWF 6A
0967: MOVF 78,W
0968: MOVWF 69
0969: MOVF 77,W
096A: MOVWF 68
096B: BCF 0A.3
096C: CALL 40C
096D: BSF 0A.3
.................... }
096E: BSF 0A.3
096F: BCF 0A.4
0970: 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.5
0659: BSF 06.0
065A: NOP
065B: BSF 06.1
065C: NOP
065D: BCF 03.5
065E: BCF 06.0
065F: BSF 03.5
0660: BCF 06.0
0661: NOP
0662: BCF 03.5
0663: BCF 06.1
0664: BSF 03.5
0665: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
0666: MOVLW C0
0667: BCF 03.5
0668: MOVWF 5F
0669: CALL 1FB
.................... I2C_write(0x26);
066A: MOVLW 26
066B: MOVWF 5F
066C: CALL 1FB
.................... I2C_write(0xB8);
066D: MOVLW B8
066E: MOVWF 5F
066F: CALL 1FB
.................... i2c_stop();
0670: BSF 03.5
0671: BCF 06.0
0672: NOP
0673: BSF 06.1
0674: BCF 03.5
0675: BTFSS 06.1
0676: GOTO 675
0677: NOP
0678: GOTO 679
0679: NOP
067A: BSF 03.5
067B: BSF 06.0
067C: NOP
....................
.................... i2c_start(); //PT_DATA_CFG set
067D: BSF 06.0
067E: NOP
067F: BSF 06.1
0680: NOP
0681: BCF 03.5
0682: BCF 06.0
0683: BSF 03.5
0684: BCF 06.0
0685: NOP
0686: BCF 03.5
0687: BCF 06.1
0688: BSF 03.5
0689: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
068A: MOVLW C0
068B: BCF 03.5
068C: MOVWF 5F
068D: CALL 1FB
.................... I2C_write(0x13);
068E: MOVLW 13
068F: MOVWF 5F
0690: CALL 1FB
.................... I2C_write(0x07); //hodnota
0691: MOVLW 07
0692: MOVWF 5F
0693: CALL 1FB
.................... i2c_stop();
0694: BSF 03.5
0695: BCF 06.0
0696: NOP
0697: BSF 06.1
0698: BCF 03.5
0699: BTFSS 06.1
069A: GOTO 699
069B: NOP
069C: GOTO 69D
069D: NOP
069E: BSF 03.5
069F: BSF 06.0
06A0: NOP
....................
.................... i2c_start(); //ACTIVE mode
06A1: BSF 06.0
06A2: NOP
06A3: BSF 06.1
06A4: NOP
06A5: BCF 03.5
06A6: BCF 06.0
06A7: BSF 03.5
06A8: BCF 06.0
06A9: NOP
06AA: BCF 03.5
06AB: BCF 06.1
06AC: BSF 03.5
06AD: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
06AE: MOVLW C0
06AF: BCF 03.5
06B0: MOVWF 5F
06B1: CALL 1FB
.................... I2C_write(0x26);
06B2: MOVLW 26
06B3: MOVWF 5F
06B4: CALL 1FB
.................... I2C_write(0xB9);
06B5: MOVLW B9
06B6: MOVWF 5F
06B7: CALL 1FB
.................... i2c_stop();
06B8: BSF 03.5
06B9: BCF 06.0
06BA: NOP
06BB: BSF 06.1
06BC: BCF 03.5
06BD: BTFSS 06.1
06BE: GOTO 6BD
06BF: NOP
06C0: GOTO 6C1
06C1: NOP
06C2: BSF 03.5
06C3: BSF 06.0
06C4: NOP
.................... }
06C5: BCF 03.5
06C6: BSF 0A.3
06C7: BCF 0A.4
06C8: GOTO 35B (RETURN)
....................
.................... void mpl3115_setP (void) //nastavení pro tlak
.................... {
....................
....................
.................... i2c_start(); //STANDBY mode
*
022F: BSF 03.5
0230: BSF 06.0
0231: NOP
0232: BSF 06.1
0233: NOP
0234: BCF 03.5
0235: BCF 06.0
0236: BSF 03.5
0237: BCF 06.0
0238: NOP
0239: BCF 03.5
023A: BCF 06.1
023B: BSF 03.5
023C: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
023D: MOVLW C0
023E: BCF 03.5
023F: MOVWF 5F
0240: CALL 1FB
.................... I2C_write(0x26);
0241: MOVLW 26
0242: MOVWF 5F
0243: CALL 1FB
.................... I2C_write(0xB8);
0244: MOVLW B8
0245: MOVWF 5F
0246: CALL 1FB
.................... i2c_stop();
0247: BSF 03.5
0248: BCF 06.0
0249: NOP
024A: BSF 06.1
024B: BCF 03.5
024C: BTFSS 06.1
024D: GOTO 24C
024E: NOP
024F: GOTO 250
0250: NOP
0251: BSF 03.5
0252: BSF 06.0
0253: NOP
....................
.................... i2c_start(); //PT_DATA_CFG set
0254: BSF 06.0
0255: NOP
0256: BSF 06.1
0257: NOP
0258: BCF 03.5
0259: BCF 06.0
025A: BSF 03.5
025B: BCF 06.0
025C: NOP
025D: BCF 03.5
025E: BCF 06.1
025F: BSF 03.5
0260: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
0261: MOVLW C0
0262: BCF 03.5
0263: MOVWF 5F
0264: CALL 1FB
.................... I2C_write(0x13);
0265: MOVLW 13
0266: MOVWF 5F
0267: CALL 1FB
.................... I2C_write(0x07); //hodnota
0268: MOVLW 07
0269: MOVWF 5F
026A: CALL 1FB
.................... i2c_stop();
026B: BSF 03.5
026C: BCF 06.0
026D: NOP
026E: BSF 06.1
026F: BCF 03.5
0270: BTFSS 06.1
0271: GOTO 270
0272: NOP
0273: GOTO 274
0274: NOP
0275: BSF 03.5
0276: BSF 06.0
0277: NOP
....................
.................... i2c_start(); //ACTIVE mode
0278: BSF 06.0
0279: NOP
027A: BSF 06.1
027B: NOP
027C: BCF 03.5
027D: BCF 06.0
027E: BSF 03.5
027F: BCF 06.0
0280: NOP
0281: BCF 03.5
0282: BCF 06.1
0283: BSF 03.5
0284: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
0285: MOVLW C0
0286: BCF 03.5
0287: MOVWF 5F
0288: CALL 1FB
.................... I2C_write(0x26);
0289: MOVLW 26
028A: MOVWF 5F
028B: CALL 1FB
.................... I2C_write(0x39);
028C: MOVLW 39
028D: MOVWF 5F
028E: CALL 1FB
.................... i2c_stop();
028F: BSF 03.5
0290: BCF 06.0
0291: NOP
0292: BSF 06.1
0293: BCF 03.5
0294: BTFSS 06.1
0295: GOTO 294
0296: NOP
0297: GOTO 298
0298: NOP
0299: BSF 03.5
029A: BSF 06.0
029B: NOP
.................... }
029C: BCF 03.5
029D: BSF 0A.3
029E: BCF 0A.4
029F: GOTO 339 (RETURN)
....................
....................
.................... byte mpl3115_read (byte reg)
.................... {
.................... byte i;
....................
.................... i2c_start();
*
02E7: BSF 03.5
02E8: BSF 06.0
02E9: NOP
02EA: BSF 06.1
02EB: NOP
02EC: BCF 03.5
02ED: BCF 06.0
02EE: BSF 03.5
02EF: BCF 06.0
02F0: NOP
02F1: BCF 03.5
02F2: BCF 06.1
02F3: BSF 03.5
02F4: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_W);
02F5: MOVLW C0
02F6: BCF 03.5
02F7: MOVWF 5F
02F8: CALL 1FB
.................... I2C_write(reg);
02F9: MOVF 5D,W
02FA: MOVWF 5F
02FB: CALL 1FB
.................... i2c_start();
02FC: BSF 03.5
02FD: BSF 06.0
02FE: NOP
02FF: BSF 06.1
0300: NOP
0301: BCF 03.5
0302: BTFSS 06.1
0303: GOTO 302
0304: BCF 06.0
0305: BSF 03.5
0306: BCF 06.0
0307: NOP
0308: BCF 03.5
0309: BCF 06.1
030A: BSF 03.5
030B: BCF 06.1
.................... I2C_Write(MPL3115_ADDR_R);
030C: MOVLW C1
030D: BCF 03.5
030E: MOVWF 5F
030F: CALL 1FB
.................... i=i2c_read(0);
0310: CLRF 77
0311: CALL 2B4
0312: MOVF 78,W
0313: MOVWF 5E
.................... i2c_stop();
0314: BSF 03.5
0315: BCF 06.0
0316: NOP
0317: BSF 06.1
0318: BCF 03.5
0319: BTFSS 06.1
031A: GOTO 319
031B: NOP
031C: GOTO 31D
031D: NOP
031E: BSF 03.5
031F: BSF 06.0
0320: NOP
....................
.................... return i;
0321: BCF 03.5
0322: MOVF 5E,W
0323: MOVWF 78
.................... }
0324: RETURN
....................
....................
.................... float mpl3115_T (void) //teplota ve stupnich
.................... {
.................... int m;
.................... float l, t;
....................
.................... m= mpl3115_read (0x04);
*
054D: MOVLW 04
054E: MOVWF 5D
054F: CALL 2E7
0550: MOVF 78,W
0551: MOVWF 4D
.................... l= (float)(mpl3115_read(0x05)>>4)/16.0;
0552: MOVLW 05
0553: MOVWF 5D
0554: CALL 2E7
0555: SWAPF 78,W
0556: MOVWF 77
0557: MOVLW 0F
0558: ANDWF 77,F
0559: MOVF 77,W
055A: CLRF 5F
055B: MOVWF 5E
055C: CALL 325
055D: MOVF 77,W
055E: MOVWF 56
055F: MOVF 78,W
0560: MOVWF 57
0561: MOVF 79,W
0562: MOVWF 58
0563: MOVF 7A,W
0564: MOVWF 59
0565: MOVWF 65
0566: MOVF 79,W
0567: MOVWF 64
0568: MOVF 78,W
0569: MOVWF 63
056A: MOVF 77,W
056B: MOVWF 62
056C: CLRF 69
056D: CLRF 68
056E: CLRF 67
056F: MOVLW 83
0570: MOVWF 66
0571: CALL 342
0572: MOVF 7A,W
0573: MOVWF 51
0574: MOVF 79,W
0575: MOVWF 50
0576: MOVF 78,W
0577: MOVWF 4F
0578: MOVF 77,W
0579: MOVWF 4E
.................... t = (float)(M + L);
057A: CLRF 5F
057B: MOVF 4D,W
057C: MOVWF 5E
057D: CALL 325
057E: BCF 03.1
057F: MOVF 7A,W
0580: MOVWF 67
0581: MOVF 79,W
0582: MOVWF 66
0583: MOVF 78,W
0584: MOVWF 65
0585: MOVF 77,W
0586: MOVWF 64
0587: MOVF 51,W
0588: MOVWF 6B
0589: MOVF 50,W
058A: MOVWF 6A
058B: MOVF 4F,W
058C: MOVWF 69
058D: MOVF 4E,W
058E: MOVWF 68
058F: CALL 40C
0590: MOVF 7A,W
0591: MOVWF 55
0592: MOVF 79,W
0593: MOVWF 54
0594: MOVF 78,W
0595: MOVWF 53
0596: MOVF 77,W
0597: MOVWF 52
.................... return t;
0598: MOVF 52,W
0599: MOVWF 77
059A: MOVF 53,W
059B: MOVWF 78
059C: MOVF 54,W
059D: MOVWF 79
059E: MOVF 55,W
059F: MOVWF 7A
.................... }
05A0: BSF 0A.3
05A1: BCF 0A.4
05A2: GOTO 345 (RETURN)
....................
.................... float mpl3115_A (void) //vyska v m
.................... {
....................
.................... int16 m;
.................... unsigned int8 c;
.................... float l, a;
....................
.................... m= mpl3115_read (0x01);
*
06C9: MOVLW 01
06CA: MOVWF 5D
06CB: CALL 2E7
06CC: CLRF 4E
06CD: MOVF 78,W
06CE: MOVWF 4D
.................... c= mpl3115_read (0x02);
06CF: MOVLW 02
06D0: MOVWF 5D
06D1: CALL 2E7
06D2: MOVF 78,W
06D3: MOVWF 4F
.................... l= (float)(mpl3115_read(0x03)>>4)/16.0;
06D4: MOVLW 03
06D5: MOVWF 5D
06D6: CALL 2E7
06D7: SWAPF 78,W
06D8: MOVWF 77
06D9: MOVLW 0F
06DA: ANDWF 77,F
06DB: MOVF 77,W
06DC: CLRF 5F
06DD: MOVWF 5E
06DE: CALL 325
06DF: MOVF 77,W
06E0: MOVWF 58
06E1: MOVF 78,W
06E2: MOVWF 59
06E3: MOVF 79,W
06E4: MOVWF 5A
06E5: MOVF 7A,W
06E6: MOVWF 5B
06E7: MOVWF 65
06E8: MOVF 79,W
06E9: MOVWF 64
06EA: MOVF 78,W
06EB: MOVWF 63
06EC: MOVF 77,W
06ED: MOVWF 62
06EE: CLRF 69
06EF: CLRF 68
06F0: CLRF 67
06F1: MOVLW 83
06F2: MOVWF 66
06F3: CALL 342
06F4: MOVF 7A,W
06F5: MOVWF 53
06F6: MOVF 79,W
06F7: MOVWF 52
06F8: MOVF 78,W
06F9: MOVWF 51
06FA: MOVF 77,W
06FB: MOVWF 50
.................... a = (float)((m << 8)|c) + l;
06FC: MOVF 4D,W
06FD: MOVWF 5A
06FE: CLRF 59
06FF: MOVF 59,W
0700: IORWF 4F,W
0701: MOVWF 77
0702: MOVF 4D,W
0703: MOVWF 7A
0704: MOVF 77,W
0705: MOVWF 5E
0706: MOVF 4D,W
0707: MOVWF 5F
0708: CALL 325
0709: MOVF 77,W
070A: MOVWF 59
070B: MOVF 78,W
070C: MOVWF 5A
070D: MOVF 79,W
070E: MOVWF 5B
070F: MOVF 7A,W
0710: MOVWF 5C
0711: BCF 03.1
0712: MOVF 7A,W
0713: MOVWF 67
0714: MOVF 79,W
0715: MOVWF 66
0716: MOVF 78,W
0717: MOVWF 65
0718: MOVF 77,W
0719: MOVWF 64
071A: MOVF 53,W
071B: MOVWF 6B
071C: MOVF 52,W
071D: MOVWF 6A
071E: MOVF 51,W
071F: MOVWF 69
0720: MOVF 50,W
0721: MOVWF 68
0722: CALL 40C
0723: MOVF 7A,W
0724: MOVWF 57
0725: MOVF 79,W
0726: MOVWF 56
0727: MOVF 78,W
0728: MOVWF 55
0729: MOVF 77,W
072A: MOVWF 54
.................... return a;
072B: MOVF 54,W
072C: MOVWF 77
072D: MOVF 55,W
072E: MOVWF 78
072F: MOVF 56,W
0730: MOVWF 79
0731: MOVF 57,W
0732: MOVWF 7A
.................... }
0733: BSF 0A.3
0734: BCF 0A.4
0735: 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 01
05A4: MOVWF 5D
05A5: CALL 2E7
05A6: CLRF 50
05A7: CLRF 4F
05A8: CLRF 4E
05A9: MOVF 78,W
05AA: MOVWF 4D
.................... c= mpl3115_read (0x02);
05AB: MOVLW 02
05AC: MOVWF 5D
05AD: CALL 2E7
05AE: CLRF 52
05AF: MOVF 78,W
05B0: MOVWF 51
.................... l=mpl3115_read(0x03);
05B1: MOVLW 03
05B2: MOVWF 5D
05B3: CALL 2E7
05B4: MOVF 78,W
05B5: MOVWF 53
.................... l2=l<<2;
05B6: RLF 53,W
05B7: MOVWF 54
05B8: RLF 54,F
05B9: MOVLW FC
05BA: ANDWF 54,F
.................... l1= (float)(l>>6)/4.0;
05BB: SWAPF 53,W
05BC: MOVWF 77
05BD: RRF 77,F
05BE: RRF 77,F
05BF: MOVLW 03
05C0: ANDWF 77,F
05C1: MOVF 77,W
05C2: CLRF 5F
05C3: MOVWF 5E
05C4: CALL 325
05C5: MOVF 77,W
05C6: MOVWF 5E
05C7: MOVF 78,W
05C8: MOVWF 5F
05C9: MOVF 79,W
05CA: MOVWF 60
05CB: MOVF 7A,W
05CC: MOVWF 61
05CD: MOVWF 65
05CE: MOVF 79,W
05CF: MOVWF 64
05D0: MOVF 78,W
05D1: MOVWF 63
05D2: MOVF 77,W
05D3: MOVWF 62
05D4: CLRF 69
05D5: CLRF 68
05D6: CLRF 67
05D7: MOVLW 81
05D8: MOVWF 66
05D9: CALL 342
05DA: MOVF 7A,W
05DB: MOVWF 5C
05DC: MOVF 79,W
05DD: MOVWF 5B
05DE: MOVF 78,W
05DF: MOVWF 5A
05E0: MOVF 77,W
05E1: MOVWF 59
.................... p = (float)((m << 10)|(c<<2)|(l>>6)) + l1;
05E2: CLRF 5E
05E3: RLF 4D,W
05E4: MOVWF 5F
05E5: RLF 4E,W
05E6: MOVWF 60
05E7: RLF 4F,W
05E8: MOVWF 61
05E9: RLF 5F,F
05EA: RLF 60,F
05EB: RLF 61,F
05EC: MOVLW FC
05ED: ANDWF 5F,F
05EE: RLF 51,W
05EF: MOVWF 79
05F0: RLF 52,W
05F1: MOVWF 7A
05F2: RLF 79,F
05F3: RLF 7A,F
05F4: MOVLW FC
05F5: ANDWF 79,F
05F6: MOVF 79,W
05F7: IORWF 5E,F
05F8: MOVF 7A,W
05F9: IORWF 5F,F
05FA: SWAPF 53,W
05FB: MOVWF 77
05FC: RRF 77,F
05FD: RRF 77,F
05FE: MOVLW 03
05FF: ANDWF 77,F
0600: MOVF 77,W
0601: IORWF 5E,W
0602: MOVWF 77
0603: MOVF 5F,W
0604: MOVWF 78
0605: MOVF 60,W
0606: MOVWF 79
0607: MOVF 61,W
0608: MOVWF 7A
0609: MOVF 7A,W
060A: MOVWF 67
060B: MOVF 79,W
060C: MOVWF 66
060D: MOVF 78,W
060E: MOVWF 65
060F: MOVF 77,W
0610: MOVWF 64
*
062B: MOVF 77,W
062C: MOVWF 5E
062D: MOVF 78,W
062E: MOVWF 5F
062F: MOVF 79,W
0630: MOVWF 60
0631: MOVF 7A,W
0632: MOVWF 61
0633: BCF 03.1
0634: MOVF 7A,W
0635: MOVWF 67
0636: MOVF 79,W
0637: MOVWF 66
0638: MOVF 78,W
0639: MOVWF 65
063A: MOVF 77,W
063B: MOVWF 64
063C: MOVF 5C,W
063D: MOVWF 6B
063E: MOVF 5B,W
063F: MOVWF 6A
0640: MOVF 5A,W
0641: MOVWF 69
0642: MOVF 59,W
0643: MOVWF 68
0644: CALL 40C
0645: MOVF 7A,W
0646: MOVWF 58
0647: MOVF 79,W
0648: MOVWF 57
0649: MOVF 78,W
064A: MOVWF 56
064B: MOVF 77,W
064C: MOVWF 55
....................
.................... return p;
064D: MOVF 55,W
064E: MOVWF 77
064F: MOVF 56,W
0650: MOVWF 78
0651: MOVF 57,W
0652: MOVWF 79
0653: MOVF 58,W
0654: MOVWF 7A
.................... }
0655: BSF 0A.3
0656: BCF 0A.4
0657: 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 30
0B29: MOVWF 22
0B2A: MOVLW 2E
0B2B: MOVWF 23
0B2C: MOVLW 31
0B2D: MOVWF 24
0B2E: 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 04
0173: BSF 03.6
0174: MOVWF 0D
0175: MOVLW 00
0176: MOVWF 0F
0177: BCF 03.0
0178: MOVLW 1D
0179: BCF 03.6
017A: MOVWF 4D
017B: CALL 0BC
017C: MOVLW 20
017D: BSF 03.6
017E: MOVWF 0D
017F: MOVLW 00
0180: MOVWF 0F
0181: BCF 03.6
0182: CALL 10B
0183: MOVLW 13
0184: BSF 03.6
0185: MOVWF 0D
0186: MOVLW 00
0187: MOVWF 0F
0188: BSF 03.0
0189: MOVLW 18
018A: BCF 03.6
018B: MOVWF 4D
018C: CALL 0BC
.................... printf("\r\n# Autor: %s Posledni uprava: %s \r\n",AUTOR, DATE);// Welcome message
018D: MOVLW 22
018E: BSF 03.6
018F: MOVWF 0D
0190: MOVLW 00
0191: MOVWF 0F
0192: BCF 03.0
0193: MOVLW 0B
0194: BCF 03.6
0195: MOVWF 4D
0196: CALL 0BC
0197: MOVLW 35
0198: BSF 03.6
0199: MOVWF 0D
019A: MOVLW 00
019B: MOVWF 0F
019C: BCF 03.6
019D: CALL 10B
019E: MOVLW 28
019F: BSF 03.6
01A0: MOVWF 0D
01A1: MOVLW 00
01A2: MOVWF 0F
01A3: BSF 03.0
01A4: MOVLW 12
01A5: BCF 03.6
01A6: MOVWF 4D
01A7: CALL 0BC
01A8: MOVLW 3B
01A9: BSF 03.6
01AA: MOVWF 0D
01AB: MOVLW 00
01AC: MOVWF 0F
01AD: BCF 03.6
01AE: CALL 10B
01AF: MOVLW 20
01B0: MOVWF 51
01B1: CALL 09A
01B2: MOVLW 0D
01B3: MOVWF 51
01B4: CALL 09A
01B5: MOVLW 0A
01B6: MOVWF 51
01B7: CALL 09A
.................... //printf("#%s\r\n",&REV[4]);
.................... printf("# ver poradi ");
01B8: MOVLW 40
01B9: BSF 03.6
01BA: MOVWF 0D
01BB: MOVLW 00
01BC: MOVWF 0F
01BD: BCF 03.6
01BE: CALL 10B
.................... printf("altimet_t[°C] altimet_a[m] altimet_p[Pa] ");
01BF: MOVLW 47
01C0: BSF 03.6
01C1: MOVWF 0D
01C2: MOVLW 00
01C3: MOVWF 0F
.................... printf("sht_t[°C] sht_h[%%] Anemo[m/s]check\r\n\r\n");
*
01E4: MOVLW 71
01E5: MOVWF 0D
01E6: MOVLW 00
01E7: MOVWF 0F
01E8: MOVLW 10
01E9: BCF 03.6
01EA: MOVWF 4D
01EB: CALL 151
01EC: MOVLW 25
01ED: MOVWF 51
01EE: CALL 09A
01EF: MOVLW 83
01F0: BSF 03.6
01F1: MOVWF 0D
01F2: MOVLW 00
01F3: MOVWF 0F
01F4: MOVLW 16
01F5: BCF 03.6
01F6: MOVWF 4D
01F7: CALL 151
.................... }
01F8: BSF 0A.3
01F9: BCF 0A.4
01FA: GOTO 335 (RETURN)
....................
....................
....................
....................
....................
.................... void main ()
.................... {
*
0B0B: CLRF 04
0B0C: BCF 03.7
0B0D: MOVLW 1F
0B0E: ANDWF 03,F
0B0F: MOVLW 71
0B10: BSF 03.5
0B11: MOVWF 0F
0B12: MOVF 0F,W
0B13: BCF 06.3
0B14: BCF 03.5
0B15: BSF 06.3
0B16: BSF 03.5
0B17: BSF 03.6
0B18: MOVF 09,W
0B19: ANDLW C0
0B1A: MOVWF 09
0B1B: BCF 03.6
0B1C: BCF 1F.4
0B1D: BCF 1F.5
0B1E: MOVLW 00
0B1F: BSF 03.6
0B20: MOVWF 08
0B21: BCF 03.5
0B22: CLRF 07
0B23: CLRF 08
0B24: CLRF 09
*
0B31: CLRF 3D
0B32: 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.3
0B34: GOTO 172
0B35: 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 teplotu
0B37: BCF 0A.3
0B38: GOTO 22F
0B39: BSF 0A.3
.................... delay_ms (500);
0B3A: MOVLW 02
0B3B: MOVWF 4D
0B3C: MOVLW FA
0B3D: MOVWF 52
0B3E: BCF 0A.3
0B3F: CALL 2A0
0B40: BSF 0A.3
0B41: DECFSZ 4D,F
0B42: GOTO 33C
.................... altimet_t=mpl3115_T();
0B43: BCF 0A.3
0B44: GOTO 54D
0B45: BSF 0A.3
0B46: MOVF 7A,W
0B47: MOVWF 2B
0B48: MOVF 79,W
0B49: MOVWF 2A
0B4A: MOVF 78,W
0B4B: MOVWF 29
0B4C: MOVF 77,W
0B4D: MOVWF 28
.................... altimet_p=mpl3115_P();
0B4E: BCF 0A.3
0B4F: GOTO 5A3
0B50: BSF 0A.3
0B51: MOVF 7A,W
0B52: MOVWF 2F
0B53: MOVF 79,W
0B54: MOVWF 2E
0B55: MOVF 78,W
0B56: MOVWF 2D
0B57: MOVF 77,W
0B58: MOVWF 2C
....................
.................... mpl3115_setA(); //nastaveni pro vysku a teplotu
0B59: BCF 0A.3
0B5A: GOTO 658
0B5B: BSF 0A.3
.................... delay_ms (500);
0B5C: MOVLW 02
0B5D: MOVWF 4D
0B5E: MOVLW FA
0B5F: MOVWF 52
0B60: BCF 0A.3
0B61: CALL 2A0
0B62: BSF 0A.3
0B63: DECFSZ 4D,F
0B64: GOTO 35E
.................... altimet_a=mpl3115_A();
0B65: BCF 0A.3
0B66: GOTO 6C9
0B67: BSF 0A.3
0B68: MOVF 7A,W
0B69: MOVWF 33
0B6A: MOVF 79,W
0B6B: MOVWF 32
0B6C: MOVF 78,W
0B6D: MOVWF 31
0B6E: MOVF 77,W
0B6F: 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 v
0B70: CLRF 4C
....................
....................
....................
....................
....................
.................... sht25_t=SHT25_get_temp();
0B71: GOTO 000
0B72: MOVF 7A,W
0B73: MOVWF 37
0B74: MOVF 79,W
0B75: MOVWF 36
0B76: MOVF 78,W
0B77: MOVWF 35
0B78: MOVF 77,W
0B79: MOVWF 34
.................... sht25_h=SHT25_get_hum();
0B7A: GOTO 0C1
0B7B: MOVF 7A,W
0B7C: MOVWF 3B
0B7D: MOVF 79,W
0B7E: MOVWF 3A
0B7F: MOVF 78,W
0B80: MOVWF 39
0B81: MOVF 77,W
0B82: MOVWF 38
....................
....................
.................... delay_us(SEND_DELAY);
0B83: MOVLW 21
0B84: MOVWF 77
0B85: DECFSZ 77,F
0B86: GOTO 385
.................... putc('$');
0B87: MOVLW 24
0B88: MOVWF 51
0B89: BCF 0A.3
0B8A: CALL 09A
0B8B: BSF 0A.3
.................... delay_us(SEND_DELAY);
0B8C: MOVLW 21
0B8D: MOVWF 77
0B8E: DECFSZ 77,F
0B8F: GOTO 38E
.................... sprintf(output,"MST%s \0",VER);
0B90: CLRF 27
0B91: MOVLW 3E
0B92: MOVWF 26
0B93: MOVLW 4D
0B94: MOVWF 5A
0B95: BCF 0A.3
0B96: CALL 7AB
0B97: BSF 0A.3
0B98: MOVLW 53
0B99: MOVWF 5A
0B9A: BCF 0A.3
0B9B: CALL 7AB
0B9C: BSF 0A.3
0B9D: MOVLW 54
0B9E: MOVWF 5A
0B9F: BCF 0A.3
0BA0: CALL 7AB
0BA1: BSF 0A.3
0BA2: MOVLW 22
0BA3: MOVWF 04
0BA4: BCF 03.7
0BA5: BCF 0A.3
0BA6: GOTO 7B8
0BA7: BSF 0A.3
0BA8: MOVLW 20
0BA9: MOVWF 5A
0BAA: BCF 0A.3
0BAB: CALL 7AB
0BAC: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0BAD: CLRF 4A
0BAE: MOVLW 3E
0BAF: ADDWF 4A,W
0BB0: MOVWF 04
0BB1: BCF 03.7
0BB2: MOVF 00,F
0BB3: BTFSC 03.2
0BB4: GOTO 3CC
0BB5: MOVLW 21
0BB6: MOVWF 77
0BB7: DECFSZ 77,F
0BB8: GOTO 3B7
0BB9: MOVLW 3E
0BBA: ADDWF 4A,W
0BBB: MOVWF 04
0BBC: BCF 03.7
0BBD: MOVF 00,W
0BBE: MOVWF 4D
0BBF: MOVF 4D,W
0BC0: MOVWF 51
0BC1: BCF 0A.3
0BC2: CALL 09A
0BC3: BSF 0A.3
0BC4: MOVF 4A,W
0BC5: INCF 4A,F
0BC6: ADDLW 3E
0BC7: MOVWF 04
0BC8: BCF 03.7
0BC9: MOVF 00,W
0BCA: XORWF 4B,F
0BCB: GOTO 3AE
.................... sprintf(output,"%4.0Lu \0", poradi);
0BCC: CLRF 27
0BCD: MOVLW 3E
0BCE: MOVWF 26
0BCF: MOVLW 01
0BD0: MOVWF 04
0BD1: MOVF 3D,W
0BD2: MOVWF 4E
0BD3: MOVF 3C,W
0BD4: MOVWF 4D
0BD5: GOTO 171
0BD6: MOVLW 20
0BD7: MOVWF 5A
0BD8: BCF 0A.3
0BD9: CALL 7AB
0BDA: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0BDB: CLRF 4A
0BDC: MOVLW 3E
0BDD: ADDWF 4A,W
0BDE: MOVWF 04
0BDF: BCF 03.7
0BE0: MOVF 00,F
0BE1: BTFSC 03.2
0BE2: GOTO 3FA
0BE3: MOVLW 21
0BE4: MOVWF 77
0BE5: DECFSZ 77,F
0BE6: GOTO 3E5
0BE7: MOVLW 3E
0BE8: ADDWF 4A,W
0BE9: MOVWF 04
0BEA: BCF 03.7
0BEB: MOVF 00,W
0BEC: MOVWF 4D
0BED: MOVF 4D,W
0BEE: MOVWF 51
0BEF: BCF 0A.3
0BF0: CALL 09A
0BF1: BSF 0A.3
0BF2: MOVF 4A,W
0BF3: INCF 4A,F
0BF4: ADDLW 3E
0BF5: MOVWF 04
0BF6: BCF 03.7
0BF7: MOVF 00,W
0BF8: XORWF 4B,F
0BF9: GOTO 3DC
.................... sprintf(output,"%3.2f \0", altimet_t );
0BFA: CLRF 27
0BFB: MOVLW 3E
0BFC: MOVWF 26
0BFD: MOVLW 02
0BFE: MOVWF 04
0BFF: MOVF 2B,W
0C00: MOVWF 50
0C01: MOVF 2A,W
0C02: MOVWF 4F
0C03: MOVF 29,W
0C04: MOVWF 4E
0C05: MOVF 28,W
0C06: MOVWF 4D
0C07: MOVLW 02
0C08: MOVWF 51
0C09: CALL 21A
0C0A: MOVLW 20
0C0B: MOVWF 5A
0C0C: BCF 0A.3
0C0D: CALL 7AB
0C0E: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0C0F: CLRF 4A
0C10: MOVLW 3E
0C11: ADDWF 4A,W
0C12: MOVWF 04
0C13: BCF 03.7
0C14: MOVF 00,F
0C15: BTFSC 03.2
0C16: GOTO 42E
0C17: MOVLW 21
0C18: MOVWF 77
0C19: DECFSZ 77,F
0C1A: GOTO 419
0C1B: MOVLW 3E
0C1C: ADDWF 4A,W
0C1D: MOVWF 04
0C1E: BCF 03.7
0C1F: MOVF 00,W
0C20: MOVWF 4D
0C21: MOVF 4D,W
0C22: MOVWF 51
0C23: BCF 0A.3
0C24: CALL 09A
0C25: BSF 0A.3
0C26: MOVF 4A,W
0C27: INCF 4A,F
0C28: ADDLW 3E
0C29: MOVWF 04
0C2A: BCF 03.7
0C2B: MOVF 00,W
0C2C: XORWF 4B,F
0C2D: GOTO 410
.................... sprintf(output,"%5.2f \0", altimet_a);
0C2E: CLRF 27
0C2F: MOVLW 3E
0C30: MOVWF 26
0C31: MOVLW 04
0C32: MOVWF 04
0C33: MOVF 33,W
0C34: MOVWF 50
0C35: MOVF 32,W
0C36: MOVWF 4F
0C37: MOVF 31,W
0C38: MOVWF 4E
0C39: MOVF 30,W
0C3A: MOVWF 4D
0C3B: MOVLW 02
0C3C: MOVWF 51
0C3D: CALL 21A
0C3E: MOVLW 20
0C3F: MOVWF 5A
0C40: BCF 0A.3
0C41: CALL 7AB
0C42: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0C43: CLRF 4A
0C44: MOVLW 3E
0C45: ADDWF 4A,W
0C46: MOVWF 04
0C47: BCF 03.7
0C48: MOVF 00,F
0C49: BTFSC 03.2
0C4A: GOTO 462
0C4B: MOVLW 21
0C4C: MOVWF 77
0C4D: DECFSZ 77,F
0C4E: GOTO 44D
0C4F: MOVLW 3E
0C50: ADDWF 4A,W
0C51: MOVWF 04
0C52: BCF 03.7
0C53: MOVF 00,W
0C54: MOVWF 4D
0C55: MOVF 4D,W
0C56: MOVWF 51
0C57: BCF 0A.3
0C58: CALL 09A
0C59: BSF 0A.3
0C5A: MOVF 4A,W
0C5B: INCF 4A,F
0C5C: ADDLW 3E
0C5D: MOVWF 04
0C5E: BCF 03.7
0C5F: MOVF 00,W
0C60: XORWF 4B,F
0C61: GOTO 444
.................... sprintf(output,"%6.2f \0", altimet_p);
0C62: CLRF 27
0C63: MOVLW 3E
0C64: MOVWF 26
0C65: MOVLW 05
0C66: MOVWF 04
0C67: MOVF 2F,W
0C68: MOVWF 50
0C69: MOVF 2E,W
0C6A: MOVWF 4F
0C6B: MOVF 2D,W
0C6C: MOVWF 4E
0C6D: MOVF 2C,W
0C6E: MOVWF 4D
0C6F: MOVLW 02
0C70: MOVWF 51
0C71: CALL 21A
0C72: MOVLW 20
0C73: MOVWF 5A
0C74: BCF 0A.3
0C75: CALL 7AB
0C76: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0C77: CLRF 4A
0C78: MOVLW 3E
0C79: ADDWF 4A,W
0C7A: MOVWF 04
0C7B: BCF 03.7
0C7C: MOVF 00,F
0C7D: BTFSC 03.2
0C7E: GOTO 496
0C7F: MOVLW 21
0C80: MOVWF 77
0C81: DECFSZ 77,F
0C82: GOTO 481
0C83: MOVLW 3E
0C84: ADDWF 4A,W
0C85: MOVWF 04
0C86: BCF 03.7
0C87: MOVF 00,W
0C88: MOVWF 4D
0C89: MOVF 4D,W
0C8A: MOVWF 51
0C8B: BCF 0A.3
0C8C: CALL 09A
0C8D: BSF 0A.3
0C8E: MOVF 4A,W
0C8F: INCF 4A,F
0C90: ADDLW 3E
0C91: MOVWF 04
0C92: BCF 03.7
0C93: MOVF 00,W
0C94: XORWF 4B,F
0C95: GOTO 478
.................... sprintf(output,"%5.2f \0", sht25_t);
0C96: CLRF 27
0C97: MOVLW 3E
0C98: MOVWF 26
0C99: MOVLW 04
0C9A: MOVWF 04
0C9B: MOVF 37,W
0C9C: MOVWF 50
0C9D: MOVF 36,W
0C9E: MOVWF 4F
0C9F: MOVF 35,W
0CA0: MOVWF 4E
0CA1: MOVF 34,W
0CA2: MOVWF 4D
0CA3: MOVLW 02
0CA4: MOVWF 51
0CA5: CALL 21A
0CA6: MOVLW 20
0CA7: MOVWF 5A
0CA8: BCF 0A.3
0CA9: CALL 7AB
0CAA: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0CAB: CLRF 4A
0CAC: MOVLW 3E
0CAD: ADDWF 4A,W
0CAE: MOVWF 04
0CAF: BCF 03.7
0CB0: MOVF 00,F
0CB1: BTFSC 03.2
0CB2: GOTO 4CA
0CB3: MOVLW 21
0CB4: MOVWF 77
0CB5: DECFSZ 77,F
0CB6: GOTO 4B5
0CB7: MOVLW 3E
0CB8: ADDWF 4A,W
0CB9: MOVWF 04
0CBA: BCF 03.7
0CBB: MOVF 00,W
0CBC: MOVWF 4D
0CBD: MOVF 4D,W
0CBE: MOVWF 51
0CBF: BCF 0A.3
0CC0: CALL 09A
0CC1: BSF 0A.3
0CC2: MOVF 4A,W
0CC3: INCF 4A,F
0CC4: ADDLW 3E
0CC5: MOVWF 04
0CC6: BCF 03.7
0CC7: MOVF 00,W
0CC8: XORWF 4B,F
0CC9: GOTO 4AC
.................... sprintf(output,"%3.2f \0", sht25_h);
0CCA: CLRF 27
0CCB: MOVLW 3E
0CCC: MOVWF 26
0CCD: MOVLW 02
0CCE: MOVWF 04
0CCF: MOVF 3B,W
0CD0: MOVWF 50
0CD1: MOVF 3A,W
0CD2: MOVWF 4F
0CD3: MOVF 39,W
0CD4: MOVWF 4E
0CD5: MOVF 38,W
0CD6: MOVWF 4D
0CD7: MOVLW 02
0CD8: MOVWF 51
0CD9: CALL 21A
0CDA: MOVLW 20
0CDB: MOVWF 5A
0CDC: BCF 0A.3
0CDD: CALL 7AB
0CDE: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0CDF: CLRF 4A
0CE0: MOVLW 3E
0CE1: ADDWF 4A,W
0CE2: MOVWF 04
0CE3: BCF 03.7
0CE4: MOVF 00,F
0CE5: BTFSC 03.2
0CE6: GOTO 4FE
0CE7: MOVLW 21
0CE8: MOVWF 77
0CE9: DECFSZ 77,F
0CEA: GOTO 4E9
0CEB: MOVLW 3E
0CEC: ADDWF 4A,W
0CED: MOVWF 04
0CEE: BCF 03.7
0CEF: MOVF 00,W
0CF0: MOVWF 4D
0CF1: MOVF 4D,W
0CF2: MOVWF 51
0CF3: BCF 0A.3
0CF4: CALL 09A
0CF5: BSF 0A.3
0CF6: MOVF 4A,W
0CF7: INCF 4A,F
0CF8: ADDLW 3E
0CF9: MOVWF 04
0CFA: BCF 03.7
0CFB: MOVF 00,W
0CFC: XORWF 4B,F
0CFD: GOTO 4E0
.................... sprintf(output,"%5.0f \0", altimet_t);
0CFE: CLRF 27
0CFF: MOVLW 3E
0D00: MOVWF 26
0D01: MOVLW 04
0D02: MOVWF 04
0D03: MOVF 2B,W
0D04: MOVWF 50
0D05: MOVF 2A,W
0D06: MOVWF 4F
0D07: MOVF 29,W
0D08: MOVWF 4E
0D09: MOVF 28,W
0D0A: MOVWF 4D
0D0B: CLRF 51
0D0C: CALL 21A
0D0D: MOVLW 20
0D0E: MOVWF 5A
0D0F: BCF 0A.3
0D10: CALL 7AB
0D11: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0D12: CLRF 4A
0D13: MOVLW 3E
0D14: ADDWF 4A,W
0D15: MOVWF 04
0D16: BCF 03.7
0D17: MOVF 00,F
0D18: BTFSC 03.2
0D19: GOTO 531
0D1A: MOVLW 21
0D1B: MOVWF 77
0D1C: DECFSZ 77,F
0D1D: GOTO 51C
0D1E: MOVLW 3E
0D1F: ADDWF 4A,W
0D20: MOVWF 04
0D21: BCF 03.7
0D22: MOVF 00,W
0D23: MOVWF 4D
0D24: MOVF 4D,W
0D25: MOVWF 51
0D26: BCF 0A.3
0D27: CALL 09A
0D28: BSF 0A.3
0D29: MOVF 4A,W
0D2A: INCF 4A,F
0D2B: ADDLW 3E
0D2C: MOVWF 04
0D2D: BCF 03.7
0D2E: MOVF 00,W
0D2F: XORWF 4B,F
0D30: GOTO 513
.................... sprintf(output,"%5.1f \0", altimet_t);
0D31: CLRF 27
0D32: MOVLW 3E
0D33: MOVWF 26
0D34: MOVLW 04
0D35: MOVWF 04
0D36: MOVF 2B,W
0D37: MOVWF 50
0D38: MOVF 2A,W
0D39: MOVWF 4F
0D3A: MOVF 29,W
0D3B: MOVWF 4E
0D3C: MOVF 28,W
0D3D: MOVWF 4D
0D3E: MOVLW 01
0D3F: MOVWF 51
0D40: CALL 21A
0D41: MOVLW 20
0D42: MOVWF 5A
0D43: BCF 0A.3
0D44: CALL 7AB
0D45: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0D46: CLRF 4A
0D47: MOVLW 3E
0D48: ADDWF 4A,W
0D49: MOVWF 04
0D4A: BCF 03.7
0D4B: MOVF 00,F
0D4C: BTFSC 03.2
0D4D: GOTO 565
0D4E: MOVLW 21
0D4F: MOVWF 77
0D50: DECFSZ 77,F
0D51: GOTO 550
0D52: MOVLW 3E
0D53: ADDWF 4A,W
0D54: MOVWF 04
0D55: BCF 03.7
0D56: MOVF 00,W
0D57: MOVWF 4D
0D58: MOVF 4D,W
0D59: MOVWF 51
0D5A: BCF 0A.3
0D5B: CALL 09A
0D5C: BSF 0A.3
0D5D: MOVF 4A,W
0D5E: INCF 4A,F
0D5F: ADDLW 3E
0D60: MOVWF 04
0D61: BCF 03.7
0D62: MOVF 00,W
0D63: XORWF 4B,F
0D64: GOTO 547
.................... sprintf(output,"%3.1f \0", altimet_t);
0D65: CLRF 27
0D66: MOVLW 3E
0D67: MOVWF 26
0D68: MOVLW 02
0D69: MOVWF 04
0D6A: MOVF 2B,W
0D6B: MOVWF 50
0D6C: MOVF 2A,W
0D6D: MOVWF 4F
0D6E: MOVF 29,W
0D6F: MOVWF 4E
0D70: MOVF 28,W
0D71: MOVWF 4D
0D72: MOVLW 01
0D73: MOVWF 51
0D74: CALL 21A
0D75: MOVLW 20
0D76: MOVWF 5A
0D77: BCF 0A.3
0D78: CALL 7AB
0D79: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
0D7A: CLRF 4A
0D7B: MOVLW 3E
0D7C: ADDWF 4A,W
0D7D: MOVWF 04
0D7E: BCF 03.7
0D7F: MOVF 00,F
0D80: BTFSC 03.2
0D81: GOTO 599
0D82: MOVLW 21
0D83: MOVWF 77
0D84: DECFSZ 77,F
0D85: GOTO 584
0D86: MOVLW 3E
0D87: ADDWF 4A,W
0D88: MOVWF 04
0D89: BCF 03.7
0D8A: MOVF 00,W
0D8B: MOVWF 4D
0D8C: MOVF 4D,W
0D8D: MOVWF 51
0D8E: BCF 0A.3
0D8F: CALL 09A
0D90: BSF 0A.3
0D91: MOVF 4A,W
0D92: INCF 4A,F
0D93: ADDLW 3E
0D94: MOVWF 04
0D95: BCF 03.7
0D96: MOVF 00,W
0D97: XORWF 4B,F
0D98: GOTO 57B
.................... sprintf(output,"*%X\r\n\0", check);
0D99: CLRF 27
0D9A: MOVLW 3E
0D9B: MOVWF 26
0D9C: MOVLW 2A
0D9D: MOVWF 5A
0D9E: BCF 0A.3
0D9F: CALL 7AB
0DA0: BSF 0A.3
0DA1: MOVF 4B,W
0DA2: MOVWF 4D
0DA3: MOVLW 37
0DA4: MOVWF 4E
0DA5: BCF 0A.3
0DA6: GOTO 7D0
0DA7: BSF 0A.3
0DA8: MOVLW 0D
0DA9: MOVWF 5A
0DAA: BCF 0A.3
0DAB: CALL 7AB
0DAC: BSF 0A.3
0DAD: MOVLW 0A
0DAE: MOVWF 5A
0DAF: BCF 0A.3
0DB0: CALL 7AB
0DB1: BSF 0A.3
.................... j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); }
0DB2: CLRF 4A
0DB3: MOVLW 3E
0DB4: ADDWF 4A,W
0DB5: MOVWF 04
0DB6: BCF 03.7
0DB7: MOVF 00,F
0DB8: BTFSC 03.2
0DB9: GOTO 5CB
0DBA: MOVLW 21
0DBB: MOVWF 77
0DBC: DECFSZ 77,F
0DBD: GOTO 5BC
0DBE: MOVF 4A,W
0DBF: INCF 4A,F
0DC0: ADDLW 3E
0DC1: MOVWF 04
0DC2: BCF 03.7
0DC3: MOVF 00,W
0DC4: MOVWF 4D
0DC5: MOVF 4D,W
0DC6: MOVWF 51
0DC7: BCF 0A.3
0DC8: CALL 09A
0DC9: BSF 0A.3
0DCA: GOTO 5B3
.................... delay_us(SEND_DELAY);
0DCB: MOVLW 21
0DCC: MOVWF 77
0DCD: DECFSZ 77,F
0DCE: GOTO 5CD
....................
.................... poradi++;
0DCF: INCF 3C,F
0DD0: BTFSC 03.2
0DD1: INCF 3D,F
....................
....................
....................
....................
....................
....................
....................
....................
.................... }
0DD2: GOTO 336
....................
....................
.................... }
0DD3: SLEEP
Configuration Fuses:
Word 1: 2CF5 INTRC NOWDT NOPUT MCLR NOPROTECT NOCPD NOBROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40