File: C:\Users\SLUG\Documents\MATLAB\SLUG_Autopilot\Stable\controlMCUSlugsMKII_dspic\sources\rtGetNaN.c

    1   /*
    2    * File: rtGetNaN.c
    3    *
    4    * Real-Time Workshop code generated for Simulink model controlMCUSlugsMKII.
    5    *
    6    * Model version                        : 1.714
    7    * Real-Time Workshop file version      : 7.5  (R2010a)  25-Jan-2010
    8    * Real-Time Workshop file generated on : Tue Nov 23 13:12:51 2010
    9    * TLC version                          : 7.5 (Jan 19 2010)
   10    * C source code generated on           : Tue Nov 23 13:12:52 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 Blake Mills                              |
   18    *                     University of Colorado-Boulder           |
   19    *                                                              |
   20    *   Written by Lubin KERHUEL -  http://www.kerhuel.eu          |
   21    *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
   22    *   Version 3.3a                              22-Nov-2010      |
   23    *   For Matlab 7.10            R2010a                          |
   24    *--------------------------------------------------------------
   25    */
   26   
   27   /*
   28    * Abstract:
   29    *      Real-Time Workshop function to intialize non-finite, NaN
   30    */
   31   #include "rtGetNaN.h"
   32   #define NumBitsPerChar                 8U
   33   
   34   /*
   35    * Initialize rtNaN needed by the generated code.
   36    * NaN is initialized as non-signaling. Assumes IEEE.
   37    */
   38   real_T rtGetNaN(void)
   39   {
   40     size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
   41     real_T nan = 0.0;
   42     if (bitsPerReal == 32U) {
   43       nan = rtGetNaNF();
   44     } else {
   45       union {
   46         LittleEndianIEEEDouble bitVal;
   47         real_T fltVal;
   48       } tmpVal;
   49   
   50       tmpVal.bitVal.words.wordH = 0xFFF80000U;
   51       tmpVal.bitVal.words.wordL = 0x00000000U;
   52       nan = tmpVal.fltVal;
   53     }
   54   
   55     return nan;
   56   }
   57   
   58   /*
   59    * Initialize rtNaNF needed by the generated code.
   60    * NaN is initialized as non-signaling. Assumes IEEE.
   61    */
   62   real32_T rtGetNaNF(void)
   63   {
   64     IEEESingle nanF;
   65     nanF.wordL.wordLuint = 0xFFC00000U;
   66     return nanF.wordL.wordLreal;
   67   }
   68   
   69   /* File trailer for Real-Time Workshop generated code.
   70    *
   71    * [EOF]
   72    */
   73