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.73.5 Re-entrancy<br />

The function is re-entrant.<br />

4.73.6 Code Example<br />

#include "gflib.h"<br />

tFrac32 f32In;<br />

tFrac32 f32Out;<br />

GFLIB_RAMP_T_F32 f32trMyRamp = GFLIB_RAMP_DEFAULT_F32;<br />

void main(void)<br />

{<br />

// increment/decrement coefficients<br />

f32trMyRamp.f32RampUp = FRAC32 (0.1);<br />

f32trMyRamp.f32RampDown = FRAC32 (0.03333333);<br />

// input value = 0.5<br />

f32In = FRAC32 (0.5);<br />

}<br />

// output should be 0x0CCCCCCC ~ FRAC32(0.1)<br />

f32Out = GFLIB_Ramp_F32 (f32In, &f32trMyRamp);<br />

// output should be 0x0CCCCCCC ~ FRAC32(0.1)<br />

f32trMyRamp.f32State = 0;<br />

f32Out = GFLIB_Ramp (f32In, &f32trMyRamp, Define F32);<br />

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

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

// as default<br />

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

// output should be 0x0CCCCCCC ~ FRAC32(0.1)<br />

f32trMyRamp.f32State = 0;<br />

f32Out = GFLIB_Ramp (f32In, &f32trMyRamp);<br />

4.74 Function GFLIB_Ramp_F16<br />

The function calculates the up/down ramp with the step increment/decrement defined in<br />

the pParam structure.<br />

4.74.1 Declaration<br />

tFrac16 GFLIB_Ramp_F16(tFrac16 f16In, GFLIB_RAMP_T_F16 *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 />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 389

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

Saved successfully!

Ooh no, something went wrong!