/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename    : MC1.h
**     Project     : ProcessorExpert
**     Processor   : MC56F84789VLL
**     Component   : MC_PIController
**     Version     : Component 01.019, Driver 01.03, CPU db: 3.50.001
**     Compiler    : Metrowerks DSP C Compiler
**     Date/Time   : 2012-03-28, 15:39, # CodeGen: 4
**     Abstract    :
**          This bean encapsulate the API for standard controllers (e.g., PI and PID)
**          for use in motor control applications in general.
**     Settings    :
**          This bean has no settings.
**     Contents    :
**         controllerPItype1 - Word16 MC1_controllerPItype1(Word16 DesiredValue, Word16 MeasuredValue,...
**
**     (c) Freescale Semiconductor
**     2004 All Rights Reserved
**
**     Copyright : 1997 - 2012 Freescale Semiconductor, Inc. All Rights Reserved.
**     
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/

#ifndef __MC1
#define __MC1

/* MODULE MC1. */

/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
/* Include inherited beans */

#include "Cpu.h"

typedef struct
{
    Frac16 ProportionalGain;
    /* The scaled gain of the proportional controller portion */
    Frac16 IntegralGain;
    /* The scaled gain of the integral controller portion */
    Frac32 IntegralPortionK_1;
    /* The integral portion in k-1 step */
    Frac16 PositivePILimit;
    /* The limitation of the positive controller output
       and the integral portion */
    Frac16 NegativePILimit;
    /* The limitation of the negative controller output
       and the integral portion */
    Word16 ProportionalGainScale;
    /* Scaling coefficient of the proportional controller portion  */
    Word16 IntegralGainScale;
    /* Scaling coefficient of the integral controller portion */
}mc_sPIparams1_limitSc;

#define controllerPItype1_asmSc(DesiredValue, MeasuredValue, pParams) MC1_controllerPItype1_asmSc(DesiredValue, MeasuredValue, pParams)
asm Frac16 MC1_controllerPItype1_asmSc(Frac16 DesiredValue,Frac16 MeasuredValue,mc_sPIparams1_limitSc *pParams);
/*
** ===================================================================
**     Method      :  MC1_controllerPItype1 (component MC_PIController)
**
**     Description :
**         This function calculates the PI (Proportional-Integral)
**         algorithm.
**     Parameters  :
**         NAME            - DESCRIPTION
**         DesiredValue    - Desired value.
**         MeasuredValue   - Measured value.
**       * pParams         - Pointer to variable containing
**                           controller parameters and the integral
**                           portion in k-1 step.
**     Returns     :
**         ---             - This function returns the value
**                           representing the controller output in step
**                           k. The output value is limited by using
**                           PositivePILimit and NegativePILimit values.
** ===================================================================
*/

/* END MC1. */

#endif /* ifndef __MC1 */
/*
** ###################################################################
**
**     This file was created by Processor Expert 5.3 [05.01]
**     for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
