#### File: D:\bobes\0 skola\_car4\my matlab\HIL - PID speed\firmware\Vejlupek_Car4_HIL_PIDSpeed_dspic\sources\rtGetInf.c
        1   /*
        2    * File: rtGetInf.c
        3    *
        4    * Real-Time Workshop code generated for Simulink model Vejlupek_Car4_HIL_PIDSpeed.
        5    *
        6    * Model version                        : 1.460
        7    * Real-Time Workshop file version      : 7.3  (R2009a)  15-Jan-2009
        8    * Real-Time Workshop file generated on : Fri Apr 30 16:12:44 2010
        9    * TLC version                          : 7.3 (Jan 18 2009)
       10    * C source code generated on           : Fri Apr 30 16:12:44 2010
       11    *--------------------------------------------------------------
       12    *   Embedded Coder for Microchip dsPIC family.                 |
       13    *   Generate .c and .h files from your Matlab/simulink model   |
       14    *   and compile the diagram to .hex and .coff file that can be |
       15    *   downloaded directly into the microcontroller               |
       16    *                                                              |
       17    * Licence Accorded to Ing. Robert Grepl, Ph.D.                 |
       18    *                     Technical University Brno                |
       19    *                                                              |
       20    *   Written by Lubin KERHUEL -  http://www.kerhuel.eu          |
       21    *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
       22    *   Version 3.1                               26-Nov-2009      |
       23    *   For Matlab 7.8             R2009a                          |
       24    *--------------------------------------------------------------
       25    */
       26
       27   /*
       28    * Abstract:
       29    *      Real-Time Workshop function to intialize non-finite, Inf
       30    */
       31   #include "rtGetInf.h"
       32   #define NumBitsPerChar                 8
       33
       34   /* Function: rtGetInf ==================================================
       35    * Abstract:
       36    *	Initialize rtInf needed by the generated code.
       37    *	Inf is initialized as non-signaling. Assumes IEEE.
       38    */
       39   real_T rtGetInf(void)
       40   {
       41     size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
       42     real_T inf = 0.0;
       43     if (bitsPerReal == 32) {
       44       inf = rtGetInfF();
       45     } else {
       46       typedef struct {
       47         struct {
       48           uint32_T wordL;
       49           uint32_T wordH;
       50         } words;
       51       } LittleEndianIEEEDouble;
       52
       53       union {
       54         LittleEndianIEEEDouble bitVal;
       55         real_T fltVal;
       56       } tmpVal;
       57
       58       tmpVal.bitVal.words.wordH = 0x7FF00000;
       59       tmpVal.bitVal.words.wordL = 0x00000000;
       60       inf = tmpVal.fltVal;
       61     }
       62
       63     return inf;
       64   }
       65
       66   /* Function: rtGetInfF ==================================================
       67    * Abstract:
       68    *	Initialize rtInfF needed by the generated code.
       69    *	Inf is initialized as non-signaling. Assumes IEEE.
       70    */
       71   real32_T rtGetInfF(void)
       72   {
       73     typedef struct {
       74       union {
       75         real32_T wordLreal;
       76         uint32_T wordLuint;
       77       } wordL;
       78     } IEEESingle;
       79
       80     IEEESingle infF;
       81     infF.wordL.wordLuint = 0x7F800000;
       82     return infF.wordL.wordLreal;
       83   }
       84
       85   /* Function: rtGetMinusInf ==================================================
       86    * Abstract:
       87    *	Initialize rtMinusInf needed by the generated code.
       88    *	Inf is initialized as non-signaling. Assumes IEEE.
       89    */
       90   real_T rtGetMinusInf(void)
       91   {
       92     size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
       93     real_T minf = 0.0;
       94     if (bitsPerReal == 32) {
       95       minf = rtGetMinusInfF();
       96     } else {
       97       typedef struct {
       98         struct {
       99           uint32_T wordL;
      100           uint32_T wordH;
      101         } words;
      102       } LittleEndianIEEEDouble;
      103
      104       union {
      105         LittleEndianIEEEDouble bitVal;
      106         real_T fltVal;
      107       } tmpVal;
      108
      109       tmpVal.bitVal.words.wordH = 0xFFF00000;
      110       tmpVal.bitVal.words.wordL = 0x00000000;
      111       minf = tmpVal.fltVal;
      112     }
      113
      114     return minf;
      115   }
      116
      117   /* Function: rtGetMinusInfF ==================================================
      118    * Abstract:
      119    *	Initialize rtMinusInfF needed by the generated code.
      120    *	Inf is initialized as non-signaling. Assumes IEEE.
      121    */
      122   real32_T rtGetMinusInfF(void)
      123   {
      124     typedef struct {
      125       union {
      126         real32_T wordLreal;
      127         uint32_T wordLuint;
      128       } wordL;
      129     } IEEESingle;
      130
      131     IEEESingle minfF;
      132     minfF.wordL.wordLuint = 0xFF800000;
      133     return minfF.wordL.wordLreal;
      134   }
      135
      136   #undef NumBitsPerChar
      137
      138   /* end rtGetInf.c */
      139
      140   /* File trailer for Real-Time Workshop generated code.
      141    *
      142    * [EOF]
      143    */