تدريب Shadowing: PLC Programming Tutorial - Ladder Logic #1: Binary & Boolean Operations - تعلم التحدث بالإنجليزية مع YouTube

C1
⏸ متوقف مؤقتاً
What's up, Automation Nation?
270 جمل
إذا كانت الجمل قصيرة أو طويلة جدًا، انقر على Edit لتعديلها.
1
What's up, Automation Nation?
2
Welcome back to LeMaster Tech.
3
In today's video, we are kicking off a new beginner to intermediate, Ladder Diagram PLC Programming Series.
4
Today being part one means we're going to be covering operations that involve true false boolean conditions.
5
And just because we're dealing with true false conditions does not mean
6
that you can't do a lot of cool stuff here or that it's not incredibly important.
7
For this tutorial series, I'm using a Siemens S7 -1200 PLC, which I can leave a link to in the description of this video.
8
This is a very common piece of hardware found in industry, but it is a little bit pricey for the hobbyist who's just dipping their toes in this field.
9
but you get a 21 -day trial license after which time you need to pay.
10
There are free software such as the Arduino PLC IDE, the CodeAssist platform, Bekoff TwinCat, or the Open PLC IDE,
11
where you can follow along with many of the concepts we're doing in these videos for completely free.
12
I'm using Siemens because Siemens is the most common worldwide PLC platform, and so I think for maximum utility of this series, this is a good platform to teach on.
13
Most of learning how to Bradley, Beckoff, Siemens, Omron, Kienz, Mitsubishi, Panasonic.
14
It doesn't matter what PLC platform you're developing on.
15
Every platform is just different flavors of fundamentally the same language.
16
Just before we start the tutorial, industrial automation and controls tutorials aren't that common or that good on the internet.
17
And I believe it's because the hardware tends to run expensive.
18
The software tends to run expensive.
19
If you're going to show things like hands -on wiring and integration of real sensors into a system, that hardware gets expensive as well.
20
I'm committed to bringing the highest quality level automation and controls tutorials to YouTube, but if you want to help me do more of it and do it faster, please leave a like on the video, subscribe to the channel, drop a comment,
21
letting me know that you find this useful and what you want to see next.
22
And if you really love what we're doing here on the channel, you can check out my Patreon in the description below.
23
Now let's get into the tutorial.
24
So I have a PLC that I am already online with this
25
video is not a series on how to get online with the PLC or how to create a new Siemens PLC project.
26
We're going to focus on ladder diagram, understanding it and writing logic.
27
So I'll try to drop tidbits about PLC programming setup while I go, but we're going to mainly focus on ladder diagram.
28
So I'm going to make my main routine, which is just going to by default get called when I'm the program starts up.
29
But all the actual logic is going to happen in a function that we're going to call ladder tutorials, binary.
30
Okay, so I make a new function.
31
And that's where I'm going to drop all of the code that we write.
32
But one tidbit about PLCs in general is you typically have to call your routines from a main routine
33
or they won't get triggered.
34
So this is basically in any form of programming, you have your if name equals main kind of condition checking if you're in the main routine,
35
and then you call all the sub functions that you want to scan.
36
So we're going to write all of our code here in ladder tutorials binary, but we added it to the main just to get out in front of that.
37
Now to talk about the physical setup
38
that we're going to use here I'm going to create two tags for input hand switches
39
and then four outputs for lights so I'm going to say hand switch One...
40
And hand switch two are going to be address input zero dot zero and 0 .0 one.
41
And they might be mad because I've previously used this PLC, but once I download that, it'll just work.
42
And one thing, depending on the platform you're on, again, how you define your inputs and outputs does vary.
43
But in general, they're all pretty similar in the sense that you need to find where your hardware input and output tags, which on Allen Bradley, you'll have I's and O's.
44
On Siemens, most of the European and international standard, O's look a lot like zeros.
45
Well, they also do in the U .S.
46
So they've decided to use Q's instead of O's.
47
So for outputs, you have Q0 .0, referring to the first relay output on the front of my PLC.
48
out my hardware in just a minute.
49
so that everything we're doing in this tutorial makes sense when you see the outcome.
50
But I do think if you're just following along to understand the ladder logic, you're still going to take a lot away from this series.
51
I'm just gonna go through there quickly.
52
And I use the first four outputs on my PLC to be four output lights.
53
And I use the two hand switches to be two inputs.
54
And I'm going to download this to the PLC.
55
And again, I think we could actually fill like a whole tutorial episode on what compiling is, what downloading is, what uploading is, how to go online, how to go offline.
56
I want to focus on the latter in this one and the actual PLC programming, which we still haven't started doing.
57
So just drop a comment if you have questions and
58
if you think a specific concept would be useful for a future video.
59
Now, like I said, we're going to do binary operations in this video, which means we're going to look at all the true or false things, and not really all of them,
60
the most common and most important ones that you need in PLC programming.
61
So we're going to start with a normally open contact.
62
Okay.
63
And again, per PLC platform, they may call this something different.
64
But the origin of ladder is basically they used a lot of the
65
visual tools that show up in electrical schematics and relay logic.
66
So on a relay where a thin strip of metal switches back
67
and forth between one contact and another based on an electrically isolated signal on the other side of a coil,
68
on that relay you have a common wire switching between normally open and normally closed.
69
And so in ladder you basically have normally open and normally closed contacts.
70
the same visual except it's a software block now.
71
If you come from a programming background or it's easier for you to think of it this way, this is basically an if statement.
72
You're checking if a condition equals one.
73
So we could say if hand switch one is true.
74
Then Ladder is kind of naturally then.
75
So just the nature of this PLC branch existing is us saying, hey, energy, if you want to think of it this way,
76
electricity comes in on the left side of your screen, checks if hand switch one is equal to one.
77
And if we put this coil over here and say output light one active,
78
then this rung of code reads as if hand switch one, then turn on out light output light one.
79
But it also implicitly has a second condition in here, which is if not hand switch one,
80
then turn off output light one that's something special about these momentary coils here
81
every plc platform has this distinction between a momentary only energized when the left side is true
82
versus set and reset or in rockwell it's called latch and unlatch otu and otl in siemens it's which this energize only
83
while true is more like a momentary push button where you have to be holding
84
that button in the whole time for a light to be on.
85
So we should be able to test this and I should be able to show you physically what this means.
86
But this is a valid ladder logic rung right here.
87
We're checking if an input from the real world, which is a hand switch is turned on.
88
then we're going to turn on a light.
89
So let's go ahead and download that and let's see
90
if I can get the box on screen in a way that doesn't look stupid.
91
So like I kind of alluded to while punching in the tickets, I have this old control box from a different thing I did a while ago that has two hand switches.
92
And actually that's cool.
93
So the second switch does nothing.
94
I have four lights up top.
95
I don't even remember which wire I put into which one.
96
But when I turn hand switch one on, you can see the LED on this light turns on.
97
And if I turn off, it turns off.
98
Now I should have had something here, which is the glasses and the monitoring.
99
Every major PLC platform has a version of this.
100
They
101
in here and it's lit up green
102
and then you can see with the dashed line where energy code energy processing power has not processed
103
because the hand switch is not turned on.
104
But if I turn the hand switch on, you can see the energy gets to the output light now.
105
Energy as I'm using it is basically code saying it's true.
106
So you should do thing.
107
that is not fundamentally the same as 24 volts, or 120 volts, or any other amount of power.
108
That's because inputs and outputs vary wildly in industry based on the need, based on what you're hooking up to them.
109
And so you it's very important in automation and controls
110
that you know your hardware and you know your use case for
111
that reason despite the fact we've only written one very basic line of ladder logic.
112
I want to take a pause and explain the wiring of my system.
113
Okay on a piece of din rail.
114
I have a 24 volt power supply which is taking wall outlet in
115
and it's transforming a hundred and twenty volts
116
and into 24 volts dc from there my plc is powered with 24 volts dc
117
and i run zero volts dc down to the line on the relay outputs i'll talk about
118
that in just a second but it's easier to talk about the hand switch first
119
so in my control box both of my hand switches just
120
are think of them as a strip of metal that's either not making contact with the terminal
121
or making contact with the terminal
122
And so I have two inputs coming back to my PLC that are either connected to 24 volts
123
or connected to nothing based on the state of the hand switch.
124
So that's how I read a 1 or a 0 from those two hand switches.
125
The thing that might be less intuitive is I'm actually connecting the outputs when I turn them on or turn them off.
126
to zero volts dc to get the lights to turn on
127
or turn off
128
because i have the positive wire of all of my lights directly connected to 24 volts dc
129
but when the outputs are not active i've created an open wire condition
130
because these are relay outputs
131
so i was talking a little bit earlier about the idea of a relay
132
which is some electro mechanical piece of equipment that makes contact or breaks For a light to turn on,
133
both the positive terminal and the negative terminal have to be connected to create an electrically continuous loop.
134
So just by having a relay output not active, that means this red wire for example will not make contact with zero volts DC,
135
it won't be able to complete the loop and the light won't turn on.
136
But then when it is active, this red wire basically pulls in and makes contact with zero volts DC, power can flow through that light and the light turns on.
137
Which is why an output being energized in our PLC program
138
is not the exact same thing as us turning voltage on if that makes sense.
139
It's important to understand in automation and controls You're writing code that controls the real world.
140
One does not always equal 24 volts.
141
Zero does not always equal zero volts.
142
I apologize for the segue into the real world.
143
But frankly, if you learn about ladder logic programming, and you don't learn about the sensors and inputs and outputs that you're controlling, you have half of a skill.
144
Okay, so now, armed kind of with this basic input and basic output condition, let's do a very quick example of how to use both
145
of these hand switches to control all four of the lights in kind of an interesting state.
146
So let's say when Both hand switches are off.
147
that we want the first light to turn on.
148
And then we'll say when we're going to basically do the logic gates that you do in college, if you have a microcontroller class,
149
and then we're going to say when hand switch one is on, and hand switch two is off, that'll be the condition they'll turn output light two on.
150
And then we're going to say when two is on, and one is off.
151
That'll be what turns three on.
152
And then, hey, if they're both on...
153
Let's go ahead.
154
and turn four on.
155
Thank you.
156
Okay, and so this is kind of fun because two inputs
157
that have binary conditions actually have a total of four potential output states here.
158
So if I grab the box again, I don't know why I keep putting it behind me.
159
- Thank you.
160
If I grab the box again, and I download this code to the PLC.
161
Alright, so right now with both hand switches off, the...
162
I can't do bottom left or right right now.
163
So right now with both hand switches off, this light is on.
164
If I turn one on, I get the second light if I turn the other one on I get the third light, And then what condition haven't I had yet?
165
This one?
166
Yep, I get the fourth light.
167
Okay, so there you can see our code in action.
168
You can see that there's four total possible combinations of these hand switches being on or off.
169
And we have them controlling the four different lights based on that.
170
So this is really an excellent first dive into binary ladder logic programming.
171
If you understand these momentary outputs, I do want to reiterate the thing that is happening with these
172
conditions is you're saying as long as the conditions to the
173
left of this coil are true then this coil is going to be energized
174
but the second these conditions are not true
175
that coil falls to de -energized so you basically have an
176
if else statement in the same line of code you have if hand switch one and two are off
177
then turn on light one.
178
But you also have the statement of if hand switch one or hand switch two is on, then turn off output light one.
179
That's the nature of these coils.
180
So our next practical example is what if I don't want that to be the case?
181
What if I want something that triggers something to turn on, but I don't want the second that condition goes away to turn off?
182
So what if I said I want when hand switch one turns on, Right this condition that we've talked about.
183
I want that to turn on output light one
184
but I want it to stay on even if I turn hand switch one back off and
185
that is when we want to use this set bit that we talked about before.
186
So in this case, if I just go ahead and download this real quick, in this case, and don't mind that a light is still on from our previous example, if I turn the hand switch on,
187
Output light one turns on and even now
188
if I turn hand switch one back off Output light one stays on
189
and that's because I set it on
190
but until something resets it off It's going to stay energized kind of like
191
that blue light is energized
192
because nothing turned it off after I deleted the code the partner Condition to
193
that obviously like we've said is a reset block
194
and what's cool is I can have it tied to a completely different input going to be what turns off.
195
Output light one.
196
So now that you can see these two conditions, you can see hand switch one letting me turn on the light and and handswitch 1 can turn back off.
197
and the light stays on but hand switch to will turn off the light.
198
And what's interesting is if they're both on Here you actually see an interesting dynamic of PLC programming,
199
which is PLCs read top to bottom and left to right, just like you're reading a book.
200
So even though both hand switches are on, it's getting set and then on the very next rung, it's getting reset.
201
So by the time the PLC finishes a cycle of processing, it just sees that the tag is off because in the same rung,
202
it gets turned on and then turned off in the same network.
203
line had the R and then the bottom line had the S
204
that light would have been turning on with both hand switches on.
205
So that's just a useful PLC programming nugget to know about.
206
So we're making really tremendous progress in a very small amount of time.
207
And hopefully you're learning a lot and finding this very useful.
208
Let's combine these set and reset conditions with one more super useful binary function, which is one shots.
209
So this block if and this counterpart block, if not, are looking at a binary condition continuously.
210
So they continue evaluating and they I continue processing over and over and over again.
211
So every time this hand switch is off, I'm trying to set the light to turn on.
212
And every time this hand switch is on, I'm trying to tell that hand switch to turn back off.
213
But what if I want, When a switch gets turned on, I want to try to turn on the light once.
214
and then move on with my day.
215
Well, that's when you want something called a one shot.
216
In Alan Bradley and Rockwell, you type in O -N -S and a special character called a one shot pops up.
217
In Siemens, in many European and Asian vendors, they have rising edge and falling edge momentary triggers.
218
So this is P for positive edge trigger.
219
But if I look at the positive edge trigger of the hand switch, I now have to give it a second tag, which is the memory.
220
is it can only track statuses over time if it has somewhere to put that status over time.
221
So every scan of the PLC, it's live evaluating the input for whether it's true or false but it needs a new tag.
222
to basically put the state of the hand switch in memory.
223
So we're going to say hand switch one memory.
224
And I'm going to go ahead and define a tag.
225
And this is a Siemens function, but all PLC sort of have inputs, outputs, and then they can do program tags or local tags.
226
or global memory tags, which are taking a permanent memory address.
227
So similar to the eyes for inputs, and queues for outputs.
228
you can use M's for memory tags that are internal logic tags.
229
For small systems, things that you're writing on like an RSLogix 500 system or a Siemens S12,
230
S7 1200, it's totally fine to use memory tags.
231
If you're doing really large systems with complicated functions, you usually want to be looking at using databases for more of your memory.
232
But anyways, this tag HS1 mem is going to be the bit
233
that tracks the last state of the hand switch so we know if it was a rising edge trigger or not.
234
Now if I say on
235
positive edge for hand switch one
236
and for falling edge negative edge for hand switch two and I give HS2 mem and It's own tag, I have caps lock on.
237
Thank you.
238
And I give that its own tag as well, global memory.
239
Define.
240
Now what we'll see when I get my box out
241
and let's use output light too just so I can get that blue light to turn off finally.
242
So now what you can see is when I turn on switch one, it turns on and when I turn on switch to stays on
243
because we're waiting for the negative edge of switch to so if I turn switch to back off, The light turns back off.
244
But now what's cool is even though light two is off
245
and you can see that the switch up top still says true.
246
If I trigger it again with switch two off, the light still turns on because I'm only evaluating that line once.
247
It's a one shot that happens when that condition is met.
248
So you can think of this in a process where someone hits a start button.
249
You might check to see if the system is healthy to start up a bunch of pumps and things like that.
250
But you usually wouldn't want to like trigger a start condition
251
when that button is pressed momentarily that is locked into place
252
so that if two hours later the process clears and is ready to start running stuff starts running.
253
So you might only want to evaluate something once
254
when a condition is true and then stop evaluating it until that condition happens again.
255
So every time I turn on a hand switch, I turn the light on, but then every time this switch turns off, it turns off.
256
This is also how you get around some of those race conditions where you could have two things
257
that turn something on or two things that turn something off.
258
Thank you.
259
And so if you use positive and negative rising edge bits, you have a way of handling that.
260
Okay, so that was a action packed introduction to binary ladder logic ladder diagram programming.
261
If you have any thoughts on the tutorial format, ways that it could be more useful, things you want to see more of or less of,
262
things you feel like I covered too quickly or didn't cover deep enough, or just additional topics you want clarification on.
263
Let me know about in the comments below.
264
I will adapt this series to the interest of the crowd as it goes on.
265
I have really been enjoying all of the enthusiasm behind automation and controls I have found on the channel lately.
266
So It's super cool to have all these automation enthusiasts here.
267
This is going to do it for today's video.
268
Thank you so much for watching and see you next time.
269
Thanks.
270
Bye.

تنزيل التطبيق

Everything you need to speak fluently

AI PronunciationScore every sentence
IPA PracticeMaster every sound
VocabularyBuild your word bank
Vocab GameLearn while playing

السياق والخلفية

في عصر تتطور فيه تكنولوجيا الأتمتة بسرعة، يعد تعلم برمجة PLC (برامج التحكم المنطقي القابلة للبرمجة) مهارة حيوية. غالباً ما تُستخدم هذه التقنية في الصناعات المختلفة، وإتقانها يمكن أن يفتح آفاقًا جديدة في مجالات متعددة. في حلقة اليوم، سنقدم لك تجربة تعليمية فعالة من خلال المفاهيم الأساسية المتعلقة بخوارزميات منطقية بسيطة متعلقة بالحالة الحقيقية أو الزائفة، مما يسهل على المبتدئين أن يفهموا كيفية تطبيق هذه الأفكار في ممارستهم العملية. يعتبر هذا الدليل خطوة مهمة في رحلتك لتحسين مهاراتك في الممارسة العملية لبرمجة PLC.

أهم 5 عبارات للتواصل اليومي

  • "What's up, Automation Nation?" - تعبير غير رسمي لبدء المحادثة.
  • "Get online with the PLC." - توجيه مفيد للمبتدئين.
  • "Now let's get into the tutorial." - إشارة إلى بدأ الشرح بشكل فعلي.
  • "You can check out my Patreon." - دعوة لدعم المحتوى التعليمي.
  • "This is just the beginning." - توضيح للمرحلة التي يتواجد فيها المتعلم.

دليل خطوة بخطوة لممارسة التظليل

إذا كنت طالبًا تسعى إلى تحسين مهارات المحادثة الإنجليزية لديك من خلال تقنية التظليل، إليك خطوات تفصيلية للتغلب على التحديات التي قد تواجهها عند متابعة هذا الفيديو:

  1. استعد لتسجيل صوتك: قم بتجهيز نقطة تسجيل بحيث يمكنك تقليد نطق المتحدث.
  2. استمع بتركيز: عند بدء الفيديو، انتبه للتعبيرات والنبرة المستخدمة بينما يتحدث المدرب.
  3. استخدم تقنية تظليل الخطاب: حاول تكرار ما يقوله المتحدث مباشرة عقب سماعه. يمكنك استخدام أسلوب طريقة التظليل في الإنجليزية لتقليد العبارات والنغمة.
  4. لاحظ المفردات: خلال الفيديو، اكتب العبارات أو المفردات الجديدة وتأكد من فهم معانيها في السياق.
  5. قم بالممارسة المستمرة: كرر هذه العملية عدة مرات حتى تشعر بالراحة مع العبارات المستخدمة، وحاول دمجها في محادثاتك اليومية.

استخدام shadowspeaks يساعدك على تعزيز مهاراتك اللغوية بشكل فعّال، لذا احرص على ممارسة المحادثة الإنجليزية باستمرار عبر منصات مثل shadowing site لتنمية ثقتك في الحديث والتفاعل.

ما هي تقنية التظليل الصوتي؟

التظليل الصوتي (Shadowing) تقنية تعلم لغة مدعومة علمياً، طُورت أصلاً لتدريب المترجمين الفوريين المحترفين. الطريقة بسيطة لكنها قوية: تستمع لصوت إنجليزي أصلي وتكرره فوراً بصوت عالٍ — كظل يتبع المتحدث بتأخير 1-2 ثانية. تُظهر الأبحاث تحسناً كبيراً في دقة النطق والتنغيم والإيقاع وربط الأصوات والاستماع والطلاقة.