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_<strong>Control</strong>lerPIrAW_F16<br />

during the calculation). There<strong>for</strong>e, if the limitation occurs, the controller output is clipped<br />

to its bounds <strong>and</strong> the wind-up occurrence of the accumulator portion is avoided by<br />

saturating the actual sum.<br />

Note<br />

All controller parameters <strong>and</strong> states can be reset during<br />

declaration using the<br />

GFLIB_CONTROLLER_PIAW_R_DEFAULT_F32 macro.<br />

4.49.5 Re-entrancy<br />

The function is re-entrant.<br />

4.49.6 Code Example<br />

#include "gflib.h"<br />

tFrac32 f32InErr;<br />

tFrac32 f32Output;<br />

GFLIB_CONTROLLER_PIAW_R_T_F32 trMyPI = GFLIB_CONTROLLER_PIAW_R_DEFAULT_F32;<br />

void main(void)<br />

{<br />

// input error = 0.25<br />

f32InErr = FRAC32 (0.25);<br />

}<br />

// controller parameters<br />

trMyPI.f32CC1sc = FRAC32 (0.01);<br />

trMyPI.f32CC2sc = FRAC32 (0.02);<br />

trMyPI.u16NShift = 1;<br />

trMyPI.f32UpperLimit = FRAC32 (1.0);<br />

trMyPI.f32LowerLimit = FRAC32 (-1.0);<br />

// output should be 0x00A3D70A<br />

f32Output = GFLIB_<strong>Control</strong>lerPIrAW_F32 (f32InErr, &trMyPI);<br />

// output should be 0x00A3D70A<br />

f32Output = GFLIB_<strong>Control</strong>lerPIrAW (f32InErr, &trMyPI, Define F32);<br />

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

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

// as default<br />

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

// output should be 0x00A3D70A<br />

f32Output = GFLIB_<strong>Control</strong>lerPIrAW (f32InErr, &trMyPI);<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 />

308 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!