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.

Function MLIB_Convert_F32FLT<br />

}<br />

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

f16In1 = FRAC16 (0.25);<br />

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

f16In2 = FRAC16 (0.5);<br />

// output should be FRAC32(0.125) = 0x10000000<br />

f32Out = MLIB_Convert_F32F16(f16In1, f16In2);<br />

// output should be FRAC32(0.125) = 0x10000000<br />

f32Out = MLIB_Convert (f16In1, f16In2, F32F16);<br />

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

f16In2 = FRAC16 (-0.5);<br />

// output should be FRAC32(0.5) = 0x40000000<br />

f32Out = MLIB_Convert_F32F16(f16In1, f16In2);<br />

// output should be FRAC32(0.5) = 0x40000000<br />

f32Out = MLIB_Convert (f16In1, f16In2, F32F16);<br />

4.126 Function MLIB_Convert_F32FLT<br />

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

4.126.1 Declaration<br />

tFrac32 MLIB_Convert_F32FLT(register tFloat fltIn1, register tFloat fltIn2);<br />

4.126.2 Arguments<br />

Table 4-163. MLIB_Convert_F32FLT arguments<br />

Type Name Direction Description<br />

register tFloat fltIn1 input Input value in single precision floating point <strong>for</strong>mat to be<br />

converted.<br />

register tFloat fltIn2 input Scale factor in single precision floating point <strong>for</strong>mat.<br />

4.126.3 Return<br />

Converted input value in 32-bit fractional <strong>for</strong>mat.<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 />

568 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!