Hello. 1
Let's continue to learn structure takes basic structure and I will create a new project in programs 2
area. 3
I will create two program 4
One will be ladder diagram 5
and another will be structure text 6
and program is creating now and program zero in the ladder diagram area. 7
I will add LD M1 for example and plus D10 D12 to D14 multiplied by D14 D16 8
to D20. 9
So this is a ladder diagram example. 10
For example in here and how to write this ladder diagram. 11
Example as ST language. 12
So I will create a I already created a st language program area in here. 13
So let's write if M1 THEN and I will check one is it m1 or m0 m1. 14
That's okay. 15
And D10 multiplied D12 equals to D14 D14 multiplied by D16 to d20. 16
So the way is going to d20 what should we do. 17
We can say D20. 18
equals to D16 19
Multiply by D10 plus D12 END_IF 20
so let's take a look. 21
Is it correct 22
D20 equals to 16 multiplied by 14. 23
But already 14 is equals to 10 plus 12. 24
So let's check once ten plus twelve multiply by D16 equals to D20 25
Let's check once. 26
to. 27
Is it correct or not is it. 28
The project is compiling now. 29
I will send this code to my simulator and say transfer it's transferring now and transfer is finished. 30
Go program 0 and activate M1 and let's give to present value to D10 ,D10 equals to 5. 31
Okay. 32
And D12 equals two let's say two. 33
Okay and D16 will be equals to two. 34
That's okay. 35
And 36
that's okay. 37
Finished my cpu is stopped now. 38
So the result is zero. 39
I will say run plc it's run now. 40
-- 41
Set on and change present value because of it wasn't it was a stop. 42
position. 43
So the values are cleared now. 44
So D10 give a valued to a d12 will be for example five and D16 will be two then 45
output two plus five is equal to seven and seven multiplied by two fourteen and go to a ST program 46
in here you can see D20 is fourteen so that's okay change present value in here for example 47
D12 to for example ten and the result will be twelve multiply by two and twenty four. 48
That's okay. 49
Go offline and program zero delete this one and complete the ladder diagram is deleted and we will say 50
just only ST language section to our simulator and project is compiling and download this execution 51
code to simulator and transfer again 52
then go back to running state and if M1 that's ok and change present values. 53
D12 five and D10 will be five. 54
For example D16 will be five so five plus five equals to Ten Ten multiplied by five equals to 50. 55
So this is working and go off line and say else D20 will be zero and go online again if M1 is not 56
active or not high. 57
So D20 will be zero download this code to simulator and OK 58
and say yes m1 is active and then I will change these ones and D5 , D12 will be five 59
and D16 will be five. 60
So you see D20 is 50 now if M1 is set off 61
So because of else condition D20 equals to now zero and I will finish this video for a moment but first 62
of all I need to explain one more thing. 63
Structure of ST 64
-- 65
How is it. 66
So we need comment 67
Like I am writing now. 68
This is a. 69
When we put when we want to put a comment like here we can say this is 70
is comment like this structure of st equals to we have a comment in here. 71
That's okay and we need keyword and we need expression and we need again. 72
Keyword. 73
And we have substatement 74
and we have keyword again. 75
So let's check this one we didn't used comment. 76
That's okay but keyword is in here. 77
If ->if is keyword, expression is M1 and the keyword again then and the keyword again. 78
END_IF; , and keyword again ELSE sub-statement is this one this is substatement and this is for example keyword 79
and this is our expression and this is our keyword again. 80
This is our keyword again like this. 81
This is how to create ST language programming examples how to write a a ST language and how 82
to structure of ST or how to adopt your structure text programming language in the plcs 83
but we will learn if and repeat and while and for and case loops and also the usage of the structure 84
texts in plc like and conditions or conditions or parenthesis and everything but for the moment I 85
am finished for this video. 86
See you in the next video.