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

#include "mlib.h"<br />

tF32 f32In1, f32In2;<br />

tFloat fltOut;<br />

void main(void)<br />

{<br />

// input value = 0.25 = 0x2000<br />

f32In1 = FRAC32 (0.25);<br />

}<br />

// scale value = 0.5 = 0x4000<br />

f32In2 = FRAC32 (0.5);<br />

// output should be 0.125<br />

fltOut = MLIB_Convert_FLTF32(f32In1, f32In2);<br />

// output should be 0.125<br />

fltOut = MLIB_Convert (f32In1, f32In2, FLTF32);<br />

// scale value = -0.5 = 0xC000<br />

f32In2 = FRAC32 (-0.5);<br />

// output should be 0.5<br />

fltOut = MLIB_Convert_FLTF32(f32In1, f32In2);<br />

// output should be 0.5<br />

fltOut = MLIB_Convert (f32In1, f32In2, FLTF32);<br />

4.131 Function MLIB_ConvertPU_F32F16<br />

This function converts the input value to different representation without scale.<br />

4.131.1 Declaration<br />

tFrac32 MLIB_ConvertPU_F32F16(register tFrac16 f16In);<br />

4.131.2 Arguments<br />

Table 4-168. MLIB_ConvertPU_F32F16 arguments<br />

Type Name Direction Description<br />

Chapter 4 API References<br />

register tFrac16 f16In input Input value in 16-bit fractional <strong>for</strong>mat to be converted.<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. 577

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

Saved successfully!

Ooh no, something went wrong!