/** ###################################################################
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : MC1.H
**     Project   : bldc_hall_demo
**     Processor : MC56F8006_48_LQFP
**     Beantype  : MC_PIController
**     Version   : Bean 01.016, Driver 01.03, CPU db: 3.00.177
**     Compiler  : Metrowerks DSP C Compiler
**     Date/Time : 28.11.2008, 16:30
**     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_asmSc - asm Frac16 MC1_controllerPItype1_asmSc(Frac16 DesiredValue, Frac16...
**
**     (c) Freescale Semiconductor
**     2004 All Rights Reserved
**
**     (c) Copyright UNIS, a.s. 1997-2008
**     UNIS, a.s.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.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;                /* General types, primary used in PI and other controllers.<br><br> */

#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_asmSc (bean MC_PIController)
**
**     Description :
**         This function calculates PI controller algorithm with
**         fractional data format..
**     Parameters  :
**         NAME            - DESCRIPTION
**         DesiredValue    - Desired value for
**                           controller.
**         MeasuredValue   - Actual value, input
**                           error = DesiredValue - MeasuredValue.
**       * pParams         - Pointer to the structure of the
**                           PI controller parameters.
**     Returns     :
**         ---             - This function returns controller output
**                           in fractional data format (16 bit).
** ===================================================================
*/

/* END MC1. */

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