03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Function GFLIB_Limit_F32<br />

4.60.5 Re-entrancy<br />

The function is re-entrant.<br />

4.60.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltIn;<br />

tFloat fltOut;<br />

// Definition of one integrator instance<br />

GFLIB_INTEGRATOR_TR_T_FLT trMyIntegrator = GFLIB_INTEGRATOR_TR_DEFAULT_FLT;<br />

void main(void)<br />

{<br />

// Setting parameters <strong>for</strong> integrator, Ts = 100e-4,<br />

trMyIntegrator.fltC1 = (tFloat)(100e-4/2);<br />

// input value = 0.5<br />

fltIn = 0.5;<br />

// output should be 2.5e-3<br />

fltOut = GFLIB_IntegratorTR_FLT (fltIn, &trMyIntegrator);<br />

// output should be 2.5e-3<br />

fltOut = GFLIB_IntegratorTR (fltIn, &trMyIntegrator, Define FLT);<br />

// ##############################################################<br />

// Available only if single precision floating point<br />

// implementation selected as default<br />

// ##############################################################<br />

// output should be 2.5e-3<br />

fltOut = GFLIB_IntegratorTR (fltIn, &trMyIntegrator);<br />

4.61 Function GFLIB_Limit_F32<br />

This function tests whether the input value is within the upper <strong>and</strong> lower limits.<br />

4.61.1 Declaration<br />

tFrac32 GFLIB_Limit_F32(tFrac32 f32In, const GFLIB_LIMIT_T_F32 *const pParam);<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

346 Freescale Semiconductor, Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!