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.

Figure 4-32. GFLIB_Ramp functionality<br />

Note<br />

All parameters <strong>and</strong> states used by the function can be reset<br />

during declaration using the GFLIB_RAMP_DEFAULT<br />

macro.<br />

4.74.5 Re-entrancy<br />

The function is re-entrant.<br />

4.74.6 Code Example<br />

#include "gflib.h"<br />

tFrac16 f16In;<br />

tFrac16 f16Out;<br />

GFLIB_RAMP_T_F16 f16trMyRamp = GFLIB_RAMP_DEFAULT_F16;<br />

void main(void)<br />

{<br />

// increment/decrement coefficients<br />

f16trMyRamp.f16RampUp = FRAC16 (0.1);<br />

f16trMyRamp.f16RampDown = FRAC16 (0.03333333);<br />

// input value = 0.5<br />

f16In = FRAC16 (0.5);<br />

// output should be 0x0CCC ~ FRAC16(0.1)<br />

f16Out = GFLIB_Ramp_F16 (f16In, &f16trMyRamp);<br />

// output should be 0x0CCC ~ FRAC16(0.1)<br />

f16trMyRamp.f16State = 0;<br />

f16Out = GFLIB_Ramp (f16In, &f16trMyRamp, Define F16);<br />

Chapter 4 API References<br />

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

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

// as default<br />

// ##############################################################<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 />

Freescale Semiconductor, Inc. 391

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

Saved successfully!

Ooh no, something went wrong!