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.

Note<br />

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

declaration using the<br />

GFLIB_CONTROLLER_PIAW_R_DEFAULT_F16 macro.<br />

4.50.5 Re-entrancy<br />

The function is re-entrant.<br />

4.50.6 Code Example<br />

#include "gflib.h"<br />

tFrac16 f16InErr;<br />

tFrac16 f16Output;<br />

GFLIB_CONTROLLER_PIAW_R_T_F16 trMyPI = GFLIB_CONTROLLER_PIAW_R_DEFAULT_F16;<br />

void main(void)<br />

{<br />

// input error = 0.25<br />

f16InErr = FRAC16 (0.25);<br />

}<br />

// controller parameters<br />

trMyPI.f16CC1sc = FRAC16 (0.01);<br />

trMyPI.f16CC2sc = FRAC16 (0.02);<br />

trMyPI.u16NShift = 1;<br />

trMyPI.f16UpperLimit = FRAC16 (1.0);<br />

trMyPI.f16LowerLimit = FRAC16 (-1.0);<br />

// output should be 0x00A3<br />

f16Output = GFLIB_<strong>Control</strong>lerPIrAW_F16 (f16InErr, &trMyPI);<br />

// output should be 0x00A3<br />

f16Output = GFLIB_<strong>Control</strong>lerPIrAW (f16InErr, &trMyPI, Define F16);<br />

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

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

// as default<br />

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

// output should be 0x00A3<br />

f16Output = GFLIB_<strong>Control</strong>lerPIrAW (f16InErr, &trMyPI);<br />

4.51 Function GFLIB_<strong>Control</strong>lerPIrAW_FLT<br />

Chapter 4 API References<br />

This function calculates a st<strong>and</strong>ard recurrent <strong>for</strong>m of the Proportional-Integral controller,<br />

with integral anti-windup.<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. 313

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

Saved successfully!

Ooh no, something went wrong!