恭喜,你发布的帖子
发布于 2017-05-16 11:56:37
5楼
#RE_B2(CLK := #B2);
#RE_Run(CLK := #Start_stop);
#FE_Run(CLK := #Start_stop);
#Gone_3m(IN := (#State = #RunP12) and not #Reset,
PT := T#3M);
if #Gone_3m.Q then
#Light := true;
end_if;
if #Reset then
#Light := false;
end_if;
case #State of
#Ready:
if #RE_Run.Q then
#State := 1;
end_if;
#Idle:
#P1 := #P2 := false;
if #FE_Run.Q then
#State := #Ready;
elsif #RE_B2.Q and not #P1_Last then
#State := #RunP1;
elsif #RE_B2.Q and #P1_Last then
#State := #RunP2;
elsif #B3 then
#State := #RunP12;
end_if;
#RunP1:
#P1 := true;
#P1_Last := true;
if (not #B1) or #B3 or #FE_Run.Q then
#State := #Idle;
end_if;
#RunP2:
#P2 := true;
#P1_Last := false;
if (not #B1) or #B3 or #FE_Run.Q then
#State := #Idle;
end_if;
#RunP12:
#P1 := #P2 := true;
if (not #B1) or #FE_Run.Q then
#State := #Idle;
end_if;
end_case;
搞了两天状态机,跟着学了一下,分别用3S和倍福软件,感受了一下。谈下西门子的SCL的总体感受:
比起S7-300下SCL要好太多。但还有改进的空间。。。
1, 不支持枚举。在这里我用常量代替。不是很完美。。。
2, IDE的提示做的比较好,把光标放变量上,会提示变量的类型。
。
3, 和IEC61131-3标准相比,有些差距,不支持面向对象的编程。。
4, IDE上,不支持中间换行。。就是光标在字符中间,安Shift+Enter键,直接新起一行,
希望这个功能加快实现,其它IDE基本都有这个功能,当然不是指3s和倍服。是PC编程。。
5,在变量声明区,不支持手写声明,手写要快很多,其它的都支持两种声明,很方便。
6, 可以格式化代码,V13版的格式代码好像有问题,V14改进了,绝对比其它的要好,就是没有快捷键。
7, 在SCL编辑区,false和true常量不会自动转换为大些,这个好像差了些。
状态机现在用的比较多了吗,你们是哪个行业的?
请填写推广理由:
分享
只看
楼主