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_AtanYX_F16<br />

In comparison to the GFLIB_Atan_F32 function, the GFLIB_AtanYX_F32 function<br />

correctly places the calculated angle within the whole fractional range of [-1, 1), which<br />

corresponds to the real angle range of [- π, π).<br />

Note<br />

The function calls the GFLIB_Atan_F32 function. The<br />

computed value is within the range of [-1, 1).<br />

4.34.5 Re-entrancy<br />

The function is re-entrant.<br />

4.34.6 Code Example<br />

#include "gflib.h"<br />

tFrac32 f32InY;<br />

tFrac32 f32InX;<br />

tFrac32 f32Ang;<br />

void main(void)<br />

{<br />

// Angle 45 deg = PI/4 rad<br />

f32InY = FRAC32 (0.5);<br />

f32InX = FRAC32 (0.5);<br />

}<br />

// output should be close to 0x20001000<br />

f32Ang = GFLIB_AtanYX_F32 (f32InY, f32InX);<br />

// output should be close to 0x20001000<br />

f32Ang = GFLIB_AtanYX (f32InY, f32InX, Define F32);<br />

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

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

// as default<br />

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

// output should be close to 0x20001000<br />

f32Ang = GFLIB_AtanYX (f32InY, f32InX);<br />

4.35 Function GFLIB_AtanYX_F16<br />

This function calculate the angle between the positive x-axis <strong>and</strong> the direction of a vector<br />

given by the (x, y) coordinates.<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 />

248 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!