variables
{
mstimer Timer;
float amplitude = 5; //设置振幅为5
float frequency = 10; //设置频率为0.2Hz
float offset = 0;
float slope1 ; //计算斜率
}
on start
{
setTimer(Timer,10);
}
on timer Timer
{
t++;
slope1= amplitude /(1000/frequency/2);
j =offset + slope1 * t; //输出斜波
putValue(Targete,j);
if(abs(j)< abs(amplitude)) //保持
{
putValue(Target,j);
}
else
{
putValue(Target,amplitude );
putValue(Curve_Type,0);//面板回到数值0
}
setTimer(Timer,10);
}
CAPL实现斜率上升
于 2023-10-21 14:28:33 首次发布