线下实训
HOME
线下实训
正文内容
plc编程 follow功能 pLC随动功能你学会了吗?如何用编码器控制其他伺服电机?
发布时间 : 2025-05-01
作者 : 小编
访问数量 : 23
扫码分享至微信

pLC随动功能你学会了吗?如何用编码器控制其他伺服电机?

PLC的随动功能指令什么时候用?我可不可以不用?有个粉丝就问这个问题,其实从我的观点来说完全是可以的,你可以用也可以不用。就分为两个点,第一个就是用外部接线来实现随动功能,第二个就是完全由PLC的程序指令来实现随动功能。

我们来讲一讲第一个用外部接线如何来控制随动。其实随动的功能的工作原理其实就是要读取接收脉冲,什么脉冲?编码器的脉冲信号,然后是驱动从动轴做相应的处理,或者从动轴旋转,或者从动轴带动丝杆前后移动都可以。

所以说知道这个原理之后它的方法就很多了,一个是物理的方法,一个是程序的方法。物理的方法接线,我直接编码器接到4伏电机的信号里边去可不可以?可以,一个是一个编码器信号或者一个PLC的脉冲信号给它分成几个,然后同时控制几个4伏电机,4伏电机的电子齿轮比,然后来改更改,然后实现水动功能。

可不可以?可以,大家有兴趣的可以去试一下,当然有些小技巧在里边,这里不细说。这是物理方面的一个解决方法。程序方面的解决方法我前面也讲了,基本上有三大功能。

·第一个是插补功能,就说你只要PLC能够实现插补功能,你就可以实现发热指令。

·第二个直接用follow指令读取编码器的脉冲数,高速计数器去读取。

·第三个是什么?电子凸轮,现在有很多复杂的运动都要用到电子凸轮,电子凸轮的作用很大,而且相对来说比较复杂一点,这个大家也可以去研究一下。

所以说follow这里到底用还是不用可以根据你的喜好去用,你可以去试验。如果说你仅仅是物理方面去处理这些信号,不需要PLC进行中间操作,或者中间读取或者中间运算的,你完全可以用物理的方法去尝试一下。如果说你PLC要进行复杂的运算操作,而且这些参数可以更改,比较方便的话,还是PLC来控制。

至于用哪一种插补,随动或者电子凸轮都可以。其实电子凸轮还包含了插补的功能,也包含了差谱的功能。插补只是直线插补和圆弧插补对吧?电子凸轮可以实现直线插补,还可以实现不规则的运动插补。

今天下班了,如果有想学习PLC的朋友,可以关注老王,老王每天可能会分享一些自己的经验,想法或者观点。如果喜欢的朋友,你可以点个关注,不喜欢的,你可以评论区可以开始喷了。感谢收看,我们下期再见。学习PLC不迷路。

PLC基本知识 -- 45 One-Shots 上升下降沿 (顺便学英文)

One-shots / 上升沿or下降沿

A one-shot is an interesting and invaluable programming tool. At first glance it might be difficult to figure out why such an instruction is needed. After we understand what this instruction does and how to use it, however, the necessity will become clear.

One-shot是一种有趣的、无价的编程工具。乍一看,很难理解为什么需要这样的指令。然而,在我们理解了这个指令的作用以及如何使用它之后,必要性就变得清楚了。

A one-shot is used to make something happen for ONLY 1 SCAN (you do remember what a scan is, right??) Most manufacturers have one-shots that react to an OFF to ON transition and a different type that reacts to an ON to OFF transition. Some names for the instructions could be difu/difd (differential up/down), sotu/sotd (single output up/down), osr (one-shot rising) and others. They all, however, end up with the same result regardless of the name.

One-shot是用来让某事只在一个扫描周期内发生(你还记得什么是扫描吧?)。大多数品牌的PLC有两种类型的One-shot指令,一种是在由OFF转换成ON时发生,另一种是在由ON转换成OFF时发生。这些指令的名称可以是DIFU/DIFD(differential up/down)、SOTU/SOTD(single output up/down)、或者OSR(one-shot rising)等等。然而,不管名称如何,它们最终得到的结果都是相同的。

One-shot Instruction / One-shot 指令(上升沿指令)

Above is the symbol for a difu (one-shot) instruction. A difd looks the same but inside the symbol it says "difd". Some of the manufacturers have it in the shape of a box but, regardless of the symbol, they all function the same way. For those manufacturers that don't include a differential down instruction, you can get the same effect by putting a NC (normally closed) instruction before it instead of a NO(normally open) instruction. (i.e. reverse the logic before the difu instruction)

上面是DIFU(One-shot)指令的符号,DIFD的符号看起来是和这一样的,但是在符号里面写着“DIFD”。有些品牌的PLC用的是盒子的形状,但不管它的符号是什么形状,它们的功能都是一样的。对于那些不包含DIFD(向下微分)指令的PLC,您可以通过在前面放置NC(常闭)指令而不是NO(常开)指令来获得相同的效果(即在DIFU指令前加反逻辑)。

Let's now setup an application to see how this instruction actually functions in a ladder. This instruction is most often used with some of the advanced instructions where we do some things that MUST happen only once. However, since we haven't gotten that far yet, let's set up a flip-flop circuit. In simple terms, a flip-flop turns something around each time an action happens. Here we'll use a single pushbutton switch. The first time the operator pushes it we want an output to turn on. It will remain "latched" on until the next time the operator pushes the button. When he does, the output turns off.

现在,让我们来设置一个应用程序,看看这个指令实际上是如何在梯形图中工作的。这个指令最常与一些高级指令一起使用,在这些高级指令中,我们用它来做一些必须只发生一次的事情。然而,由于我们还没有学得那么深,我们先设置一个触发器电路,简单地说,每次一个动作发生时,触发器都会发生一个状态变化。这里我们将使用一个单按钮开关,操作员第一次推它时,我们希望打开输出,这个输出将一直“锁定”在打开状态,直到下一次操作员按下那个单按钮开关,输出才会关闭。

Here's the ladder diagram that does just that: / 这是实现上述功能的梯形图

Now this looks confusing! Actually it's not if we take it one step at a time.

现在看起来是不是觉得很混乱!事实上,如果我们一步一步来,就不是这样的。

First Scan / 第一次扫描

Rung 1 - When NO (normally open) input 0000 becomes true DIFU 1000 becomes true.

Rung 1 - 常开触点0000变为“真”(True)时,DIFU 1000也变为“真”(True)。

Rung 2 - NO 1000 is true, NO 1001 remains false, NC 1001 remains true, NC 1000 turns false. Since we have a true path, (NO 1000 & NC 1001) OUT 1001 becomes true.

Rung 2 – 常开触点1000为“真”(True),常开触点1001为“假”(False),常闭触点1001 为“真”(True),常闭触点1000为“假”(False)。因为Rung 2中有一条路径是“真”(True)【即常开触点1000 & 常闭触点1001】 ,所以输出1001变成了“真”(True)。

Rung 3 - NO 1001 is true therefore OUT 0500 turns true.

Rung 3 – 常开触点1001为“真”(True),所以输出0500变为“真”(True)。

Next Scan / 第二次扫描

Rung 1 - NO 0000 remains true. DIFU 1000 now becomes false. This is because the DIFU instruction is only true for one scan. (i.e. the rising edge of the logic before it on the rung)

Rung 1 – 常开触点0000仍然是“真”(True),但DIFU 1000现在变成了“假”(False),这是因为DIFU指令的“真”(True)状态只能一个扫描周期有效(即逻辑的上升沿使Rung 1变成“真”)。

Rung 2 - NO 1000 is false, NO 1001 remains true, NC 1001 is false, NC 1000 turns true. Since we STILL have a true path, (NO 1001 & NC 1000) OUT 1001 remains true.

Rung 2 – 常开触点1000为“假”(False),常开触点1001为“真”(True),常闭触点1001为“假” (False),常闭触点1000为“真”(True)。因为Rung 2中有一条路径任然为“真”(True)【即常开触点1001 & 常闭触点1000】,所以输出1001仍然是“真”(True)。

Rung 3 - NO 1001 is true therefore OUT 0500 remains true.

Rung 3 – 常开触点1001是“真”(True),所以输出0500仍然保持为“真”(True)。

100 Scan / 第100次扫描

(NO 0000 turns off / 常开触点0000变为“假”)

After 100 scans, NO 0000 turns off (becomes false). The logic remains in the same state as "next scan" shown above. (difu doesn't react therefore the logic stays the same on rungs 2 and 3)

假设经过100次扫描后,常开触点0000变为了“假”(False),梯形图的逻辑任然会保持与上面所示的“第二次扫描”相同的状态(由于DIFU没有反应,因此逻辑状态在Rung 2和Rung 3都保持不变)。

101 Scan / 第101次扫描

(NO 0000 turns on again / 常开触点0000点再次变为“真”)

Rung 1 - When NO (normally open) input 0000 becomes true DIFU 1000 becomes true.

Rung 1 - 当常开触点0000为“真”(True)时,指令DIFU 1000变为“真”(True)。

Rung 2 - NO 1000 is true, NO 1001 remains true, NC 1001 becomes false, NC 1000 also becomes false. Since we no longer have a true path, OUT 1001 becomes false.

Rung 2 – 常开触点1000为“真”(True),常开触点1001为“真”(True),常闭触点1001为“假“(False),常闭触点1000也为“假”(False)。由于在Rung2横档上不再有一条路径是“真”(True),所以输出1001变成了“假”(False)。

Rung 3 - NO 1001 is false therefore OUT 500 becomes false.

Rung 3 – 常开触点1001变为“假”(False),因此输出0500变为了“假”(False)。

In the example above, each time the operator pushes button 0000 the DIFU instruction turns on (becomes true) FOR ONE SCAN. Notice that it turns on (becomes true) at the rising edge of input 0000. In other words, when input 0000 initially turns on (becomes true) the DIFU instruction is true.

在上面的例子中,每次操作员按下0000按钮,DIFU1000指令就会变为“真(Ture)”并持续一个扫描周期。注意,DIFU1000是在输入0000的上升沿时处于ON状态(变为True)。换句话说,只是在输入0000打开(变为“真”)的初始阶段,DIFU1000指令变为“真”(True)。

When an input initially becomes true its called the leading or rising edge. When it initially turns off (becomes false) its called the trailing or falling edge.

当一个输入变为“真”(True)时,那个初始阶段我们称它为上升沿;当一个输入变为“假”(False)时,那个初始阶段我们称它为下降沿。

If after viewing the animation you still find it difficult to understand, don't feel bad. You're just an idiot and should give up!!! No not really. Just try to remember how its scanned by the plc. Think it through one instruction at a time from top to bottom, then left to right. (i.e. in this order: NO 0000, DIFU 1000, NO 1000, NO 1001, NC 1001, NC 1000, OUT 1001, NO 1001, OUT 500) While executing each instruction is it true or false?

如果看完上面的动画演示后你仍然觉得难以理解,不要难过。你就是个白痴,应该放弃!!不,不,绝对不是,只要记住这段程序是如何被PLC扫描的,挨个指令地去想,从上到下,从左到右(即按这个顺序:NO 0000,DIFU 1000,NO 1000,NO 1001,NC 1001,NC 1000,OUT 1001,NO 1001,OUT 500),看执行每一指令时它是“真”(True)还是“假”(False)。

Rung 2(it has 5 instructions) is the confusing part for most of us. To make it easier lets break it into sections. NO 1000 and NO 1001 are in parallel. In other words they form an "or" circuit. Call this section 1. If 1000 OR 1001 is true then this mini section is true. Next we have another section in parallel. This section is NC 1001 and NC 1000. Again these 2 are in parallel. Call this section 2. If NC 1001 OR NC 1000 is true then this section is true. Finally, those 2 parallel sections (sections 1 and 2) are in series with each other. This means that if section 1 AND section 2 are BOTH true then the rung is true and output 1001 must be true.

Rung 2(它有5个指令)对我们大多数人来说是令人困惑的部分。为了使它更简单,我们把它拆分成几个部分:常开触点1000和常开触点1001是并行的,换句话说,它们形成一个“或”电路,我们将此部分称为Section 1,如果常开触点1000或常开触点1001其中一个为“真”(True),那么这个Section 1部分就为“真”(True);接下来我们来看另一个平行的部分,这个部分是常闭触点1001和常闭触点1000,这两个也是平行的,我们把这部分称为Section 2部分,如果常闭触点1001或常闭触点1000其中一个为“真”(True),那么这个Section 2部分就为“真”(True)。最后,这两个并行部分(Section 1和Section 2)彼此串联,这就意味着,如果Section 1和Section 2两个部分都为“真”(True),那么Rung 2就为“真”(True),输出1001也必须为“真”(True)。

Now its much easier to understand, isn't it? We also just learned about OR and AND logic, commonly called parallel and series logic.

现在它理解起来更容易了吧,不是吗?在这里我们还顺便学了“或”(OR)和“与”(AND)逻辑,通常我们称之为“并联逻辑”和“串联逻辑”。

Executing the program 1 instruction at a time makes this and any program easy to follow. Actually a larger program that jumps around might be difficult to follow but a pencil drawing of the registers sure does help!

执行程序时一次执行一个指令使程序较容易跟踪。实际上,一个更大的程序要这样跳来跳去的跟踪是很困难的,但一个图形化寄存器视图肯定有帮助的吧!

相关问答

智通有菲林制作培训

[回答]请找内行人陪同来咨询!请看好、想好!不管到哪家培训咨询都要慎重,看清它的强项,看清是在培训者自己的单位实习,还是把学员拉到外面去?!看它有没有自...

 林耀焕  光彩年华 
王经理: 180-0000-0000(微信同号)
10086@qq.com
北京海淀区西三旗街道国际大厦08A座
©2025  上海羊羽卓进出口贸易有限公司  版权所有.All Rights Reserved.  |  程序由Z-BlogPHP强力驱动
网站首页
电话咨询
微信号

QQ

在线咨询真诚为您提供专业解答服务

热线

188-0000-0000
专属服务热线

微信

二维码扫一扫微信交流
顶部