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.

4.89.4 Description<br />

The GFLIB_UpperLimit function tests whether the input value is below the upper limit.<br />

If so, the input value will be returned. Otherwise, if the input value is above the upper<br />

limit, the upper limit will be returned.<br />

The upper limit f16UpperLimit can be found in the parameters structure, supplied to the<br />

function as a pointer pParam.<br />

4.89.5 Re-entrancy<br />

The function is re-entrant.<br />

4.89.6 Code Example<br />

#include "gflib.h"<br />

tFrac16 f16In;<br />

tFrac16 f16Out;<br />

GFLIB_UPPERLIMIT_T_F16 f16trMyUpperLimit = GFLIB_UPPERLIMIT_DEFAULT_F16;<br />

void main(void)<br />

{<br />

// upper limit<br />

f16trMyUpperLimit.f16UpperLimit = FRAC16 (0.5);<br />

// input value = 0.75<br />

f16In = FRAC16 (0.75);<br />

}<br />

// output should be 0x4000 ~ FRAC16(0.5)<br />

f16Out = GFLIB_UpperLimit_F16 (f16In,&f16trMyUpperLimit);<br />

// output should be 0x4000 ~ FRAC16(0.5)<br />

f16Out = GFLIB_UpperLimit (f16In,&f16trMyUpperLimit,Define F16);<br />

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

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

// as default<br />

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

// output should be 0x4000 ~ FRAC16(0.5)<br />

f16Out = GFLIB_UpperLimit (f16In,&f16trMyUpperLimit);<br />

4.90 Function GFLIB_UpperLimit_FLT<br />

This function tests whether the input value is below the upper limit.<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 />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 437

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

Saved successfully!

Ooh no, something went wrong!