Hello. 1
In this video we are going to continue to if loop examples 2
I will create a new project 3
in the programs area. 4
I will say new as ST language I will select it and say okay and then we will write a ladder 5
diagram first. 6
I will add one more program to here. 7
And according to ladder diagram we will adopt it as structure text programming 8
new program is creating now and now it's created. 9
So let's continue with a ladder diagram programming LD M10 10
If M 10 that means so what happens mov for example 1 to d0 and the second network if ld m1 is 11
M10 12
Sorry not active or not okay then move for example 2 to D0 but let's put here one more contact 13
and add M11 and then if LDI M10 and also normally close M11 that moment mov 0 to D0 14
what will happen if somebody press 2 and 10 1 will be inside to the 0 if m m 10 is not active but 15
if somebody pressed for example M11 2 will be in D0 if m10 is not active and M11 16
is not activated by you or by operator that moment zero is going to be inside of D0. 17
So let's write. 18
plc project according to this ladder diagram as st language in here. 19
I will start if m 10. 20
Then what will happen now. 21
1 will be inside D0 22
So what can we write here. 23
D0 is going to be 1 and ELSIF this is not 24
else this is. 25
Elsif and we will put second option to here. 26
ELSIF M11 THEN but also we can say ELSIF M11 and not m10 then that moment what 27
will happen. 28
D0 is going to be 2 and else that moment. 29
0M is not active and also M11 is not active and also it is not M10 is not suitable for this 30
line else we can put here D0 it calls to 0 END_IF; but also we can say in here ELSIF not m 10 31
and not M11 then we can put it like this so let's compile our project and there is no error I will go 32
on line to my plc and I will say send it to plc and say OK and OK we are ready first in the 33
ladder diagram 34
I will activate M10 set on. 35
So D0 is one and set off that moment D0 is zero M11 set on so d0 is two and set 36
oFf that moment it is zero it is working and again set on is one set off and set on it is equals to 37
two set off now we are at the beginning position go to st program M10 is set on so you can see D0 38
is 1 and set off and then activate M11 in here set on. 39
So d0 equals two, and set oFf it is still zero. 40
So it is working this is equals to 41
this one this is the second example of the ıf loopinstruction or if instruction for the structure 42
text programming. 43
See you in the next video.