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.

void main(void)<br />

{<br />

// Setting parameters <strong>for</strong> integrator, Ts = 100e-4, E_MAX=U_MAX=1<br />

trMyIntegrator.f32C1 = FRAC32 (100e-4/2);<br />

trMyIntegrator.u16NShift = 0;<br />

}<br />

// input value = 0.5<br />

f32In = FRAC32 (0.5);<br />

// output should be 0x0051EB85<br />

f32Out = GFLIB_IntegratorTR_F32 (f32In, &trMyIntegrator);<br />

// output should be 0x0051EB85<br />

f32Out = GFLIB_IntegratorTR (f32In, &trMyIntegrator, Define F32);<br />

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

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

// as default<br />

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

// output should be 0x0051EB85<br />

f32Out = GFLIB_IntegratorTR (f32In, &trMyIntegrator);<br />

4.59 Function GFLIB_IntegratorTR_F16<br />

The function calculates a discrete implementation of the integrator (sum), discretized<br />

using a trapezoidal (Bilinear) trans<strong>for</strong>mation.<br />

4.59.1 Declaration<br />

tFrac16 GFLIB_IntegratorTR_F16(tFrac16 f16In, GFLIB_INTEGRATOR_TR_T_F16 *const pParam);<br />

4.59.2 Arguments<br />

Table 4-76. GFLIB_IntegratorTR_F16 arguments<br />

Type Name Direction Description<br />

tFrac16 f16In input Input argument to be integrated.<br />

GFLIB_INTEGRATOR_<br />

TR_T_F16 *const<br />

4.59.3 Return<br />

pParam input,<br />

output<br />

Pointer to the integrator parameters structure.<br />

The function returns a 16-bit value in <strong>for</strong>mat Q1.15, which represents the actual<br />

integrated value of the input signal.<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. 341

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

Saved successfully!

Ooh no, something went wrong!