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_F16<br />

GFLIB_LIMIT_T_F32 f32trMyLimit = GFLIB_LIMIT_DEFAULT_F32;<br />

void main(void)<br />

{<br />

// upper/lower limits<br />

f32trMyLimit.f32UpperLimit = FRAC32 (0.5);<br />

f32trMyLimit.f32LowerLimit = FRAC32 (-0.5);<br />

}<br />

// input value = 0.75<br />

f32In = FRAC32 (0.75);<br />

// output should be 0x40000000 ~ FRAC32(0.5)<br />

f32Out = GFLIB_Limit_F32 (f32In, &f32trMyLimit);<br />

// output should be 0x40000000 ~ FRAC32(0.5)<br />

f32Out = GFLIB_Limit (f32In, &f32trMyLimit, Define F32);<br />

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

// Available only if 32-bit fractional implementation selected<br />

// as default<br />

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

// output should be 0x40000000 ~ FRAC32(0.5)<br />

f32Out = GFLIB_Limit (f32In, &f32trMyLimit);<br />

4.62 Function GFLIB_Limit_F16<br />

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

4.62.1 Declaration<br />

tFrac16 GFLIB_Limit_F16(tFrac16 f16In, const GFLIB_LIMIT_T_F16 *const pParam);<br />

4.62.2 Arguments<br />

Table 4-79. GFLIB_Limit_F16 arguments<br />

Type Name Direction Description<br />

tFrac16 f16In input Input value.<br />

const<br />

GFLIB_LIMIT_T_F16<br />

*const<br />

4.62.3 Return<br />

pParam input Pointer to the limits structure.<br />

The input value in case the input value is below the limits, or the upper or lower limit if<br />

the input value is above these limits.<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 />

348 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!