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.

4.35.1 Declaration<br />

tFrac16 GFLIB_AtanYX_F16(tFrac16 f16InY, tFrac16 f16InX);<br />

4.35.2 Arguments<br />

Table 4-45. GFLIB_AtanYX_F16 arguments<br />

Type Name Direction Description<br />

tFrac16 f16InY input The ordinate of the input vector (y coordinate).<br />

tFrac16 f16InX input The abscissa of the input vector (x coordinate).<br />

4.35.3 Return<br />

The function returns the angle between the positive x-axis of a plane <strong>and</strong> the direction of<br />

the vector given by the x <strong>and</strong> y coordinates provided as parameters.<br />

4.35.4 Description<br />

The function returns the angle between the positive x-axis of a plane <strong>and</strong> the direction of<br />

the vector given by the x <strong>and</strong> y coordinates provided as parameters. The first parameter,<br />

f16InY, is the ordinate (the y coordinate) <strong>and</strong> the second one, f16InX, is the abscissa (the<br />

x coordinate).<br />

Both the input parameters are assumed to be in the fractional range of [-1, 1). The<br />

computed angle is limited by the fractional range of [-1, 1), which corresponds to the real<br />

range of [- π, π). The counter-clockwise direction is assumed to be positive <strong>and</strong> thus a<br />

positive angle will be computed if the provided ordinate (f16InY) is positive. Similarly, a<br />

negative angle will be computed <strong>for</strong> the negative ordinate.<br />

The calculations are per<strong>for</strong>med in a few steps.<br />

Chapter 4 API References<br />

In the first step, the angle is positioned within the correct half-quarter of the<br />

circumference of a circle by dividing the angle into two parts: the integral multiple of 45<br />

deg (half-quarter) <strong>and</strong> the remaining offset within the 45 deg range. Simple geometric<br />

properties of the Cartesian coordinate system are used to calculate the coordinates of the<br />

vector with the calculated angle offset.<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. 249

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

Saved successfully!

Ooh no, something went wrong!