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.160.6 Code Example<br />

#include "mlib.h"<br />

tFrac16 f16In;<br />

tFrac16 f16Out;<br />

void main(void)<br />

{<br />

// input value = 0.25<br />

f16In = FRAC16 (0.25);<br />

}<br />

// output should be FRAC16(-0.25) = 0xA000<br />

f16Out = MLIB_NegSat_F16(f16In);<br />

// output should be FRAC16(-0.25) = 0xA000<br />

f16Out = MLIB_NegSat (f16In, Define F16);<br />

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

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

// as default<br />

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

// output should be FRAC16(-0.25) = 0xA000<br />

f16Out = MLIB_NegSat (f16In);<br />

4.161 Function MLIB_Norm_F32<br />

This function returns the number of left shifts needed to normalize the input parameter.<br />

4.161.1 Declaration<br />

tU16 MLIB_Norm_F32(register tFrac32 f32In);<br />

4.161.2 Arguments<br />

Table 4-198. MLIB_Norm_F32 arguments<br />

Type Name Direction Description<br />

register tFrac32 f32In input The first value to be normalized.<br />

4.161.3 Return<br />

Chapter 4 API References<br />

The number of left shift needed to normalize the argument. For the input "0" returns "0".<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. 639

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

Saved successfully!

Ooh no, something went wrong!