恭喜,你发布的帖子
发布于 2018-05-21 07:36:51
2楼
(*
计算每一个扫描周期的变化量。Bstart启动按钮,on_Bstart记录按钮状态,out_sav输出状态保存值,out输出值,deta每一个扫描周期的变化量,time_sp hmi输入的时间,cycle,扫描周期,最好是放到循环中断中,这样速度变化更平滑。
*)
if Bstart and not on_Bstart then//初始化,
out_sav:=out;
deta:=(out_sp-out)/(time_sp/cycle)
Bstart:=0
end_if;
out:=out+deta;
(*如果输出达到限制值,强制输出限制值*)
if out<out_min then
out:=out_min;
end_if;
if out>out_max then
out:=out_max;
end_if;
请填写推广理由:
分享
只看
楼主