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.

Function GFLIB_Cos_F32<br />

result is saddled by cumulative error. To enumerate the<br />

computation error in one calculation cycle, the internal<br />

accumulator is not used <strong>for</strong> testing purposes <strong>and</strong> is replaced by<br />

output from the previous calculation step of the reference<br />

model.<br />

4.51.5 Re-entrancy<br />

The function is re-entrant.<br />

4.51.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltInErr;<br />

tFloat fltOutput;<br />

GFLIB_CONTROLLER_PIAW_R_T_FLT trMyPI = GFLIB_CONTROLLER_PIAW_R_DEFAULT_FLT;<br />

void main(void)<br />

{<br />

// input error = 0.25<br />

fltInErr = (tFloat)(0.25);<br />

}<br />

// controller parameters<br />

trMyPI.fltCC1sc = (tFloat)(0.01);<br />

trMyPI.fltCC2sc = (tFloat)(0.01);<br />

trMyPI.fltUpperLimit = (tFloat)(1.0);<br />

trMyPI.fltLowerLimit = (tFloat)(-1.0);<br />

// output should be 5e-3<br />

fltOutput = GFLIB_<strong>Control</strong>lerPIrAW_FLT (fltInErr, &trMyPI);<br />

// output should be 5e-3<br />

fltOutput = GFLIB_<strong>Control</strong>lerPIrAW (fltInErr, &trMyPI, Define FLT);<br />

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

// Available only if single precision floating point implementation<br />

// selected as default<br />

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

// output should be 5e-3<br />

fltOutput = GFLIB_<strong>Control</strong>lerPIrAW (fltInErr, &trMyPI);<br />

4.52 Function GFLIB_Cos_F32<br />

This function implements polynomial approximation of cosine function.<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 />

316 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!