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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Function GFLIB_Sign_F32<br />

4.75.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltIn;<br />

tFloat fltOut;<br />

GFLIB_RAMP_T_FLT flttrMyRamp = GFLIB_RAMP_DEFAULT_FLT;<br />

void main(void)<br />

{<br />

// increment/decrement coefficients<br />

flttrMyRamp.fltRampUp = (tFloat)(0.1);<br />

flttrMyRamp.fltRampDown = (tFloat)(0.03333333);<br />

// input value = 0.5<br />

fltIn = (tFloat)(0.5);<br />

}<br />

// output should be 0.1<br />

fltOut = GFLIB_Ramp_FLT (fltIn, &flttrMyRamp);<br />

// output should be 0.1<br />

flttrMyRamp.fltState = 0;<br />

fltOut = GFLIB_Ramp (fltIn, &flttrMyRamp, Define FLT);<br />

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

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

// implementation selected as default<br />

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

// output should be 0.1<br />

flttrMyRamp.fltState = 0;<br />

fltOut = GFLIB_Ramp (fltIn, &flttrMyRamp);<br />

4.76 Function GFLIB_Sign_F32<br />

This function returns the signum of input value.<br />

4.76.1 Declaration<br />

tFrac32 GFLIB_Sign_F32(tFrac32 f32In);<br />

4.76.2 Arguments<br />

Table 4-97. GFLIB_Sign_F32 arguments<br />

Type Name Direction Description<br />

tFrac32 f32In input Input argument.<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 />

394 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!