0
1
00:00:21,180 --> 00:00:22,040
Hello.
1

2
00:00:22,110 --> 00:00:27,070
In this video we are going to continue to if loop examples 
2

3
00:00:27,180 --> 00:00:28,500
I will create a new project
3

4
00:00:31,940 --> 00:00:34,250
in the programs area.
4

5
00:00:34,250 --> 00:00:43,590
I will say new as ST language I will select it and say okay and then we will write a ladder
5

6
00:00:43,590 --> 00:00:44,920
diagram first.
6

7
00:00:45,120 --> 00:00:48,440
I will add one more program to here.
7

8
00:00:48,500 --> 00:00:55,440
And according to ladder diagram we will adopt it as structure text programming
8

9
00:00:58,090 --> 00:01:01,890
new program is creating now and now it's created.
9

10
00:01:01,900 --> 00:01:07,180
So let's continue with a ladder diagram programming LD M10
10

11
00:01:07,360 --> 00:01:20,260
If M 10 that means so what happens mov for example 1 to d0 and the second network if ld m1 is
11

12
00:01:20,470 --> 00:01:21,040
M10
12

13
00:01:21,040 --> 00:01:33,370
Sorry not active or not okay then move for example 2 to D0 but let's put here one more contact
13

14
00:01:33,670 --> 00:01:51,010
and add M11 and then if LDI M10 and also normally close M11 that moment mov 0 to D0
14

15
00:01:51,250 --> 00:02:04,130
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

16
00:02:04,250 --> 00:02:13,140
if somebody pressed for example M11 2 will be in D0 if m10 is not active and M11
16

17
00:02:13,140 --> 00:02:20,880
is not activated by you or by operator that moment zero is going to be inside of D0.
17

18
00:02:20,880 --> 00:02:22,750
So let's  write.
18

19
00:02:23,160 --> 00:02:29,220
plc project according to this ladder diagram as st language in here.
19

20
00:02:29,790 --> 00:02:33,080
I will start if m 10.
20

21
00:02:33,270 --> 00:02:35,160
Then what will happen now.
21

22
00:02:35,210 --> 00:02:37,620
1 will be inside D0
22

23
00:02:37,630 --> 00:02:40,300
So  what can we write here.
23

24
00:02:40,320 --> 00:02:46,340
D0 is going to be 1 and ELSIF  this is not
24

25
00:02:46,350 --> 00:02:47,590
else this is.
25

26
00:02:47,590 --> 00:02:52,040
Elsif and we will put second option to here.
26

27
00:02:52,050 --> 00:03:07,480
ELSIF M11 THEN but also we can say ELSIF M11 and not m10 then that moment what
27

28
00:03:07,480 --> 00:03:08,510
will happen.
28

29
00:03:08,590 --> 00:03:16,080
D0 is going to be 2 and else that moment.
29

30
00:03:16,230 --> 00:03:26,360
0M  is not active and also M11  is not active and also it is not M10 is not suitable for this
30

31
00:03:26,360 --> 00:03:40,310
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

32
00:03:40,670 --> 00:03:54,640
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

33
00:03:54,640 --> 00:04:07,460
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

34
00:04:07,460 --> 00:04:08,300
ladder diagram
34

35
00:04:11,120 --> 00:04:13,850
I will activate M10 set on.
35

36
00:04:13,910 --> 00:04:24,920
So D0 is one and set off that moment D0 is zero M11 set on so d0 is two and set
36

37
00:04:25,160 --> 00:04:35,250
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

38
00:04:35,320 --> 00:04:44,030
two set off now we are at the beginning position go to st program M10 is set on so you can see D0
38

39
00:04:44,030 --> 00:04:51,850
is 1 and set off and then activate M11 in here set on.
39

40
00:04:51,860 --> 00:04:57,400
So d0  equals two, and set oFf it is still zero.
40

41
00:04:57,410 --> 00:05:00,620
So it is working this is equals to
41

42
00:05:03,440 --> 00:05:11,270
this one this is the second example of the ıf loopinstruction or if instruction for the structure
42

43
00:05:11,270 --> 00:05:12,530
text programming.
43

44
00:05:12,530 --> 00:05:14,170
See you in the next video.
