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

4.148.6 Code Example<br />

#include "mlib.h"<br />

tFrac16 f16In1;<br />

tFrac16 f16In2;<br />

tFrac16 f16In3;<br />

tFrac16 f16Out;<br />

void main(void)<br />

{<br />

// input1 value = 0.25<br />

f16In1 = FRAC16 (0.25);<br />

}<br />

// input2 value = 0.15<br />

f16In2 = FRAC16 (0.15);<br />

// input3 value = 0.35<br />

f16In3 = FRAC16 (0.35);<br />

// output should be FRAC16(0.3025) = 0x26B8<br />

f16Out = MLIB_MacSat_F16(f16In1, f16In2, f16In3);<br />

// output should be FRAC16(0.3025) = 0x26B8<br />

f16Out = MLIB_MacSat (f16In1, f16In2, f16In3, Define F16);<br />

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

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

// as default<br />

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

// output should be FRAC16(0.3025) = 0x26B8<br />

f16Out = MLIB_MacSat (f16In1, f16In2, f16In3);<br />

4.149 Function MLIB_Mul_F32<br />

This function multiplies two input parameters.<br />

4.149.1 Declaration<br />

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

4.149.2 Arguments<br />

Table 4-186. MLIB_Mul_F32 arguments<br />

Type Name Direction Description<br />

register tFrac32 f32In1 input Oper<strong>and</strong> is a 32-bit number normalized between [-1,1).<br />

register tFrac32 f32In2 input Oper<strong>and</strong> is a 32-bit number normalized between [-1,1).<br />

Table continues on the next page...<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 />

612 Freescale Semiconductor, Inc.

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

Saved successfully!

Ooh no, something went wrong!