方向逻辑PLC
如何使用 PLC 梯形图确定输入方向?意思是,如何保存之前的状态?
输入的先前状态。我需要确定光束被激活的方向……向前或向后。如果它们被反向激活,则执行一项操作。如果它们向前激活,请执行不同的操作。输入标记为 1 到 6。法线方向为 1 到 6。
How do you determine direction of inputs using ladder diagrams with a PLC? Meaning, how do you save the previous state?
Previous state of inputs. I need to determine direction that photobeams were activated.. forward or reverse. If they are activated in reverse, perform one action. If they are activated forwards, perform a different action. Inputs labeled 1 through 6. Normal direction is 1 through 6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是梯形逻辑中锁存器的简单实现:
这是您可以重置输出的一个:
它们构成了梯形逻辑中内存的基本构建块。我不确定,但这就是您要找的吗?
通常,实现梯形逻辑的语言将具有实现存储器的更高级别元素,例如 D 和 T 触发器。阅读梯形图逻辑实现的文档以查看它们是否可用。
好的,从您的评论来看,您想要的是:
这假设传感器靠近在一起,以便转换为 10->11->01,这样当项目同时触发时,您无法检测到行进方向传感器。以声明方式编写此内容:
这意味着:
现在您可以使用反向检测到的信号来执行您想要的操作。如果你的梯形语言有锁存器,你可以这样做更干净:
Here's a simple implementation of a latch in ladder logic:
and here's one where you can reset the output:
These form the fundamental building blocks for memory in ladder logic. I'm not sure but is this what you're looking for?
Usually a language implementing ladder logic will have higher level elements that implement memory such as D and T flip-flops. Read the documentation of your ladder logic implementation to see if they're available.
OK, from your comments it looks like what you want is:
This assumes the sensors are close together such that the transition is 10->11->01 such that you can't detect the travel direction while the item is triggering both sensors. Writing this declaratively:
Which translates to:
Now you can use the reverse detected signal to do what you want. If your ladder language has latches you can do this cleaner:
使用 DirectLogic 可编程控制器,有一个差分输入可以使这变得非常容易。我敢打赌大多数 PLC 都有类似的指令。
然而,如果您使用 DirectLogic PLC,它们的 RLL-Plus 阶段编程将是梯形逻辑领域内“状态”编程的更清晰的实现。
当输入从低电平变为高电平时,正差分将用于执行输出逻辑。它仅适用于一个周期,因此您可能需要接合锁存器或使用“设置”。这取决于光电管重叠:
在这种情况下,如果 2 开启且 1 变高,则设置或锁存反向检测位。如果您关心这些事情,则对每个可能的反转(2 变高而 3 开启)输入逻辑进行或操作会将其保持在单个梯级。
我不清楚光电管是否有重叠。如果不重叠,我可能会这样做更像 slebetman 的答案:
来自 手册 :
Using the DirectLogic programmable controllers, there is a differential input that would make this very easy. I would be willing to bet that most PLC's have similar instructions.
However, if you are using DirectLogic PLC's, their RLL-Plus stage programming would be a much clearer implementation of "stateful" programming within the ladder logic realm.
The positive differential would be used to execute output logic when the input goes from low to high. It is only true for one cycle, so it is possible you would need to engage a latch or utilize a "set". This depends on the photocells being overlapping:
In this case, if 2 is on, and 1 goes high, you set or latch the reverse detection bit. Or'ing the input logic with each possible reversal ( 2 goes high while 3 is on) would keep this down to a single rung if you care about such things.
I wasn't clear on whether or not there is overlap in the photocells. If not overlapping, I might do this more like slebetman's answer:
From the Manual:
对于仅两个传感器 i0 和 i1
O3 = OFF => 前进方向
O3 = ON => 反向
下面的梯形图显示了逻辑:
梯形图
For just two sensors i0 and i1
O3 = OFF => forward direction
O3 = ON => reverse direction
The following ladder diagram shows the logic:
ladder diagram