📄 mc2.c
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : MC2.C
** Project : vvvf_56F8346
** Processor : 56F8346
** Beantype : MC_Ramp
** Version : Bean 01.005, Driver 01.02, CPU db: 2.87.097
** Compiler : Metrowerks DSP C Compiler
** Date/Time : 2008-3-7, 11:06
** Abstract :
** The Ramp Generation Algorithm generates the acceleration ramp.
** The RampGetValue function computes the next value of acceleration
** ramp related to the current acceleration ramp direction.
** Settings :
** This bean has no settings.
** Contents :
** rampGetValue - Frac16 MC2_rampGetValue(Frac16 incrementUp,Frac16 incrementDown,Frac16...
**
** (c) Freescale Semiconductor
** 2004 All Rights Reserved
**
** (c) Copyright UNIS, spol. s r.o. 1997-2005
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE MC2. */
#include "MC2.h"
/*
** ===================================================================
** Method : MC2_rampGetValue (bean MC_Ramp)
**
** Description :
** The function performs a linear Ramp generation determined
** by input parameters.
** Parameters :
** NAME - DESCRIPTION
** incrementUp - Increment up.
** incrementDown - Increment down.
** * p_actualValue - Pointer to variable
** containing actualValue.
** * p_requestedValue - Pointer to
** variable containing requestedValue.
** Returns :
** --- - If the requestedValue is greater than
** actualValue, the rampGetValue function
** returns actualValue + incrementUp until
** the maximum is reached, (maximum is
** requestedValue), at which point it will
** return requestedValue. If the
** requestedValue is less than actualValue,
** the rampGetValue function returns
** actualValue - incrementDown until the
** minimum is reached, (minimum is
** requestedValue), at which point it will
** return requestedValue.
** ===================================================================
*/
Frac16 MC2_rampGetValue(Frac16 incrementUp,Frac16 incrementDown,Frac16 *p_actualValue,Frac16 *p_requestedValue)
{
/* is there space to increment ? */
if (*p_actualValue <= (*p_requestedValue - incrementUp)) {
return(*p_actualValue + incrementUp); /* increment up */
}
/* is there space to decrement ? */
if (*p_actualValue >= (*p_requestedValue + incrementDown)) {
return(*p_actualValue - incrementDown); /* increment down */
}
else return(*p_requestedValue); /* saturation */
}
/* END MC2. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.97 [03.74]
** for the Freescale 56800 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -