📄 rmp_cntl.c
字号:
/*=====================================================================================
File name: RMP_CNTL.C
Originator: Digital Control Systems Group
Texas Instruments
Description: Ramp control
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20
-------------------------------------------------------------------------------------*/
#include "dmctype.h"
#include "rmp_cntl.h"
void rmp_cntl_calc(RMPCNTL *v)
{
if (v->TargetValue != v->SetpointValue)
{
v->RampDelayCount += 1.0;
if (v->RampDelayCount >= v->RampDelayMax)
{
if (v->TargetValue >= v->SetpointValue)
{
v->SetpointValue += 0.0000305; // 0.0000305 is resolution of Q15
if (v->SetpointValue > v->RampHighLimit)
v->SetpointValue = v->RampHighLimit;
v->RampDelayCount = 0;
}
else
{
v->SetpointValue -= 0.0000305; // 0.0000305 is resolution of Q15
if (v->SetpointValue < v->RampLowLimit)
v->SetpointValue = v->RampLowLimit;
v->RampDelayCount = 0;
}
}
}
else v->EqualFlag = 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -