0
1
00:00:21,190 --> 00:00:26,180
In this video we are going to do if loop example.
1

2
00:00:26,390 --> 00:00:31,940
I will create a new project in the program area.
2

3
00:00:32,000 --> 00:00:37,520
I will create firstly ladder diagram and say new and OK
3

4
00:00:41,860 --> 00:00:44,300
a new project is created.
4

5
00:00:44,300 --> 00:01:05,130
This is the first example and then I will add LD M0 out m0 and also I will add set m1 and also reset
5

6
00:01:05,610 --> 00:01:08,580
m2 this will be like this.
6

7
00:01:08,580 --> 00:01:10,350
So what's happening in here.
7

8
00:01:10,350 --> 00:01:15,110
If m0 is active that moment we are resetting M2.
8

9
00:01:15,300 --> 00:01:22,650
We are setting M1 and we are giving a pulse while the m0  is active but this is something wrong
9

10
00:01:22,680 --> 00:01:33,530
in here because m 0 is used in here m1 n2 and we can say to M3 then how can we write this
10

11
00:01:33,530 --> 00:01:35,380
code as ST language.
11

12
00:01:35,390 --> 00:01:43,460
So in the programs area right click and say new and structure text selected and say OK
12

13
00:01:46,930 --> 00:01:55,480
and ST  programming area is open so we can just write our variables in here.
13

14
00:01:55,480 --> 00:02:01,990
If m 0 then so what was it.
14

15
00:02:02,000 --> 00:02:14,300
Remember the output was m2 was resetted m1 set and M3 was just according to m3 condition
15

16
00:02:14,540 --> 00:02:16,690
it will be on or off.
16

17
00:02:16,700 --> 00:02:18,750
So how can we write it.
17

18
00:02:18,920 --> 00:02:23,980
We can write it like this m2
18

19
00:02:30,010 --> 00:02:38,560
was should be false M1 should be true.
19

20
00:02:38,680 --> 00:02:46,460
This is what I remember in our example M1  is set m2 reset 
20

21
00:02:46,500 --> 00:02:48,360
So what we did in here
21

22
00:02:51,090 --> 00:02:56,830
M2 is going to be false that means  reset m1 is going to be true.
22

23
00:02:56,830 --> 00:03:02,740
So that means it is going to be set after m0 becomes high.
23

24
00:03:03,130 --> 00:03:11,410
And I will say and if so and loop is finished in here but one more thing that we need to put here we
24

25
00:03:11,440 --> 00:03:12,620
forgot M3.
25

26
00:03:12,820 --> 00:03:21,550
So M3 will be equals to M0 according to our example.
26

27
00:03:21,640 --> 00:03:23,950
We should put it to here.
27

28
00:03:23,960 --> 00:03:29,390
So firstly I will go online to my simulator.
28

29
00:03:29,390 --> 00:03:37,910
This project is compiling and this project is compiled and say execution code going to be transferred
29

30
00:03:37,910 --> 00:03:39,270
to simulator.
30

31
00:03:39,470 --> 00:03:42,540
And now it is  send simulator stopped.
31

32
00:03:42,580 --> 00:03:45,580
so say Run Okay.
32

33
00:03:45,680 --> 00:03:49,930
Now M0 is set on what's happened M2 is false.
33

34
00:03:50,010 --> 00:03:53,300
And m1 set and M3 is active.
34

35
00:03:53,310 --> 00:04:05,600
So m0 is gone or off so M1 is still set M3 is off M2 still of that I will say set off to it and
35

36
00:04:06,580 --> 00:04:15,740
I will go offline and I will delete it .
36

37
00:04:15,840 --> 00:04:27,860
Then let's focus to ST program that we write go on line say OK the project is compiling that we
37

38
00:04:27,860 --> 00:04:32,680
are on line but it needs to do a transfer again say OK
38

39
00:04:35,420 --> 00:04:48,650
then m 0 it set on you can see M0 is active M2 is still false and what is true at M3 is active m 0 is
39

40
00:04:48,770 --> 00:04:56,750
set off then m2 is still false M3 is off but M1 still active.
40

41
00:04:56,750 --> 00:05:01,050
So this is equals to our ladder diagram example.
41

42
00:05:01,640 --> 00:05:06,610
In the end if you want to reset our M1 how can we do it.
42

43
00:05:06,620 --> 00:05:17,170
I will go on line edit so we can say at this point for example in here or in here we can say else for
43

44
00:05:17,170 --> 00:05:29,730
example M1 it goes to false then update it it is updating now update the programme line it is going
44

45
00:05:29,730 --> 00:05:37,230
to send source code and Okay m0  we are going to say set on
45

46
00:05:40,340 --> 00:05:51,970
but it is not allowing to it, I will go now set on m1 is true m2 is still false m3
46

47
00:05:51,970 --> 00:05:57,170
is active m 0 is set off that moment all of them is off.
47

48
00:05:57,260 --> 00:06:05,780
So this is our first if loop example in the next video I will continue to second example.
