File: C:\Users\SLUG\Documents\MATLAB\SLUG_Autopilot\Stable\controlMCUSlugsMKII_dspic\sources\rtGetInf.c1 /* 2 * File: rtGetInf.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, Inf 30 */ 31 #include "rtGetInf.h" 32 #define NumBitsPerChar 8U 33 34 /* 35 * Initialize rtInf needed by the generated code. 36 * Inf is initialized as non-signaling. Assumes IEEE. 37 */ 38 real_T rtGetInf(void) 39 { 40 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar); 41 real_T inf = 0.0; 42 if (bitsPerReal == 32U) { 43 inf = rtGetInfF(); 44 } else { 45 union { 46 LittleEndianIEEEDouble bitVal; 47 real_T fltVal; 48 } tmpVal; 49 50 tmpVal.bitVal.words.wordH = 0x7FF00000U; 51 tmpVal.bitVal.words.wordL = 0x00000000U; 52 inf = tmpVal.fltVal; 53 } 54 55 return inf; 56 } 57 58 /* 59 * Initialize rtInfF needed by the generated code. 60 * Inf is initialized as non-signaling. Assumes IEEE. 61 */ 62 real32_T rtGetInfF(void) 63 { 64 IEEESingle infF; 65 infF.wordL.wordLuint = 0x7F800000U; 66 return infF.wordL.wordLreal; 67 } 68 69 /* 70 * Initialize rtMinusInf needed by the generated code. 71 * Inf is initialized as non-signaling. Assumes IEEE. 72 */ 73 real_T rtGetMinusInf(void) 74 { 75 size_t bitsPerReal = sizeof(real_T) * (NumBitsPerChar); 76 real_T minf = 0.0; 77 if (bitsPerReal == 32U) { 78 minf = rtGetMinusInfF(); 79 } else { 80 union { 81 LittleEndianIEEEDouble bitVal; 82 real_T fltVal; 83 } tmpVal; 84 85 tmpVal.bitVal.words.wordH = 0xFFF00000U; 86 tmpVal.bitVal.words.wordL = 0x00000000U; 87 minf = tmpVal.fltVal; 88 } 89 90 return minf; 91 } 92 93 /* 94 * Initialize rtMinusInfF needed by the generated code. 95 * Inf is initialized as non-signaling. Assumes IEEE. 96 */ 97 real32_T rtGetMinusInfF(void) 98 { 99 IEEESingle minfF; 100 minfF.wordL.wordLuint = 0xFF800000U; 101 return minfF.wordL.wordLreal; 102 } 103 104 /* File trailer for Real-Time Workshop generated code. 105 * 106 * [EOF] 107 */ 108 |