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_F16F32<br />

}<br />

fltIn2 = 2;<br />

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

f32Out = MLIB_Convert_F32FLT(fltIn1, fltIn2);<br />

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

f32Out = MLIB_Convert (fltIn1, fltIn2, F32FLT);<br />

4.127 Function MLIB_Convert_F16F32<br />

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

4.127.1 Declaration<br />

tFrac16 MLIB_Convert_F16F32(register tFrac32 f32In1, register tFrac32 f32In2);<br />

4.127.2 Arguments<br />

Table 4-164. MLIB_Convert_F16F32 arguments<br />

Type Name Direction Description<br />

register tFrac32 f32In1 input Input value in 32-bit fractional <strong>for</strong>mat to be converted.<br />

register tFrac32 f32In2 input Scale factor in 32-bit fractional <strong>for</strong>mat.<br />

4.127.3 Return<br />

Converted input value in 16-bit fractional <strong>for</strong>mat.<br />

4.127.4 Description<br />

This inline function returns converted input value. The input value is considered as 32-bit<br />

fractional data type <strong>and</strong> output value is considered as 16-bit fractional data type thus both<br />

values represent the values in unity model. The second value represents the scale factor<br />

<strong>and</strong> is considered as 32-bit fractional data type. The sign of the second value represents<br />

the scale mechanism. In case the second value is positive the first input value is<br />

multiplied with the second one <strong>and</strong> converted to the output <strong>for</strong>mat. In case the second<br />

value is negative, the first input value is divided by absolute value of second input value<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 />

570 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!