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.

4.164.6 Code Example<br />

#include "mlib.h"<br />

tFrac16 f16In1;<br />

tFrac16 f16Out;<br />

tU16 u16In2;<br />

void main(void)<br />

{<br />

// first input = 0.5<br />

f16In1 = FRAC16 (0.5);<br />

// second input = 13<br />

u16In2 = 13;<br />

}<br />

// output should be 0x6000 ~ FRAC16(0.75)<br />

f16Out = MLIB_Round_F16(f16In1,u16In2);<br />

// output should be 0x6000 ~ FRAC16(0.75)<br />

f16Out = MLIB_Round (f16In1,u16In2,Define F16);<br />

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

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

// as default<br />

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

// output should be 0x6000 ~ FRAC16(0.75)<br />

f16Out = MLIB_Round (f16In1,u16In2);<br />

4.165 Function MLIB_ShBi_F32<br />

This function shifts the first argument to left or right by number defined by second<br />

argument.<br />

4.165.1 Declaration<br />

tFrac32 MLIB_ShBi_F32(register tFrac32 f32In1, register tS16 s16In2);<br />

4.165.2 Arguments<br />

Table 4-202. MLIB_ShBi_F32 arguments<br />

Type Name Direction Description<br />

register tFrac32 f32In1 input First value to be shift.<br />

register tS16 s16In2 input The shift amount 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 />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 645

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

Saved successfully!

Ooh no, something went wrong!