#### File: D:\bobes\0 skola\_car4\my matlab\HIL - PID speed\firmware\Vejlupek_Car4_HIL_PIDSpeed_dspic\sources\rtGetNaN.c
        1   /*
        2    * File: rtGetNaN.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, NaN
       30    */
       31   #include "rtGetNaN.h"
       32   #define NumBitsPerChar                 8
       33
       34   /* Function: rtGetNaN ==================================================
       35    * Abstract:
       36    *	Initialize rtNaN needed by the generated code.
       37    *	NaN is initialized as non-signaling. Assumes IEEE.
       38    */
       39   real_T rtGetNaN(void)
       40   {
       41     size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar);
       42     real_T nan = 0.0;
       43     if (bitsPerReal == 32) {
       44       nan = rtGetNaNF();
       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 = 0xFFF80000;
       59       tmpVal.bitVal.words.wordL = 0x00000000;
       60       nan = tmpVal.fltVal;
       61     }
       62
       63     return nan;
       64   }
       65
       66   /* Function: rtGetNaNF ==================================================
       67    * Abstract:
       68    *	Initialize rtNaNF needed by the generated code.
       69    *	NaN is initialized as non-signaling. Assumes IEEE.
       70    */
       71   real32_T rtGetNaNF(void)
       72   {
       73     typedef struct {
       74       union {
       75         real32_T wordLreal;
       76         uint32_T wordLuint;
       77       } wordL;
       78     } IEEESingle;
       79
       80     IEEESingle nanF;
       81     nanF.wordL.wordLuint = 0xFFC00000;
       82     return nanF.wordL.wordLreal;
       83   }
       84
       85   #undef NumBitsPerChar
       86
       87   /* end rt_getNaN.c */
       88
       89   /* File trailer for Real-Time Workshop generated code.
       90    *
       91    * [EOF]
       92    */