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.

tFrac32 f32In;<br />

tFrac32 f32Out;<br />

GFLIB_HYST_T_F32 f32trMyHyst = GFLIB_HYST_DEFAULT_F32;<br />

void main(void)<br />

{<br />

// Setting parameters <strong>for</strong> hysteresis<br />

f32trMyHyst.f32HystOn = FRAC32 (0.1289);<br />

f32trMyHyst.f32HystOff = FRAC32 (-0.3634);<br />

f32trMyHyst.f32OutValOn = FRAC32 (0.589);<br />

f32trMyHyst.f32OutValOff = FRAC32 (-0.123);<br />

f32trMyHyst.f32OutState = FRAC32 (-0.3333);<br />

// input value = -0.41115<br />

f32In = FRAC32 (-0.41115);<br />

}<br />

// output should be 0x8FBE76C8 ~ FRAC32(-0.123)<br />

f32Out = GFLIB_Hyst_F32 (f32In,&f32trMyHyst);<br />

// output should be 0x8FBE76C8 ~ FRAC32(-0.123)<br />

f32trMyHyst.f32OutState = FRAC32 (0);<br />

f32Out = GFLIB_Hyst (f32In, &f32trMyHyst, Define F32);<br />

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

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

// as default<br />

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

// output should be 0x8FBE76C8 ~ FRAC32(-0.123)<br />

f32trMyHyst.f32OutState = FRAC32 (0);<br />

f32Out = GFLIB_Hyst (f32In, &f32trMyHyst);<br />

4.56 Function GFLIB_Hyst_F16<br />

This function implements the hysteresis functionality.<br />

4.56.1 Declaration<br />

tFrac16 GFLIB_Hyst_F16(tFrac16 f16In, GFLIB_HYST_T_F16 *const pParam);<br />

4.56.2 Arguments<br />

Table 4-73. GFLIB_Hyst_F16 arguments<br />

Type Name Direction Description<br />

tFrac16 f16In input Input signal in the <strong>for</strong>m of a 16-bit fixed point number,<br />

normalized between [-1, 1).<br />

GFLIB_HYST_T_F16<br />

*const<br />

pParam input,<br />

output<br />

Chapter 4 API References<br />

Pointer to the structure with parameters <strong>and</strong> states of the<br />

hysteresis function. Arguments of the structure contain fixed<br />

point 16-bit values, normalized between [-1, 1).<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. 333

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

Saved successfully!

Ooh no, something went wrong!