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.162.1 Declaration<br />

tU16 MLIB_Norm_F16(register tFrac16 f16In);<br />

4.162.2 Arguments<br />

Table 4-199. MLIB_Norm_F16 arguments<br />

Type Name Direction Description<br />

register tFrac16 f16In input The first value to be normalized.<br />

4.162.3 Return<br />

The number of left shift needed to normalize the argument. For the input "0" returns "0".<br />

4.162.4 Description<br />

Depending on the sign of the input value the function counts <strong>and</strong> returns the number of<br />

the left shift needed to get an equality between input value <strong>and</strong> the maximum fractional<br />

values "1" or "-1".<br />

Note<br />

Due to effectivity reason this function is implemented as inline<br />

<strong>and</strong> thus is not ANSI-C compliant.<br />

4.162.5 Re-entrancy<br />

The function is re-entrant.<br />

4.162.6 Code Example<br />

#include "mlib.h"<br />

tFrac16 f16In;<br />

tU16 u16Out;<br />

void main(void)<br />

{<br />

// first input = 0.00005<br />

f16In = FRAC16 (0.00005);<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 />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 641

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

Saved successfully!

Ooh no, something went wrong!