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.

4.39.6 Code Example<br />

#include "gflib.h"<br />

tFloat fltInY;<br />

tFloat fltInX;<br />

tFloat fltAng;<br />

GFLIB_ATANYXSHIFTED_T_FLT Param;<br />

void main(void)<br />

{<br />

//dtheta = 69.33deg, thetaoffset = 10deg<br />

//KY = 1/(2*cos((69.33/2)/180*pi))= 0.6079089139<br />

//KX = 1/(2*sin((69.33/2)/180*pi))= 0.8790788409<br />

}<br />

//THETAADJ = 10*pi/180 = 0.1745329252<br />

Param.fltKy = (tFloat)(0.6079089139);<br />

Param.fltKx = (tFloat)(0.8790788409);<br />

Param.fltThetaAdj = (tFloat)(0.1745329252);<br />

// theta = 15 deg<br />

// Y = sin(theta) = 0.2588190<br />

// X = sin(theta + dtheta) = 0.9951074<br />

fltInY = (tFloat)(0.2588190);<br />

fltInX = (tFloat)(0.9951074);<br />

// Output angle should be 0.69228911 rad<br />

fltAng = GFLIB_AtanYXShifted_FLT (fltInY, fltInX, &Param);<br />

// Output angle should be 0.69228911 rad<br />

fltAng = GFLIB_AtanYXShifted (fltInY, fltInX, &Param, Define FLT);<br />

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

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

// implementation selected as default<br />

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

// Output angle should be 0.69228911 rad<br />

fltAng = GFLIB_AtanYXShifted (fltInY, fltInX, &Param);<br />

4.40 Function GFLIB_<strong>Control</strong>lerPIp_F32<br />

This function calculates a parallel <strong>for</strong>m of the Proportional-Integral controller, without<br />

integral anti-windup.<br />

4.40.1 Declaration<br />

Chapter 4 API References<br />

tFrac32 GFLIB_<strong>Control</strong>lerPIp_F32(tFrac32 f32InErr, GFLIB_CONTROLLER_PI_P_T_F32 *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 />

Freescale Semiconductor, Inc. 267

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

Saved successfully!

Ooh no, something went wrong!