Hello. 1
Let's continue to create a function blocks with AS332 Delta Cpu and come here to create a new project. 2
I said OK 3
but don't forget we selected AS332 Plc type and come here to function block and new and the pou 4
name will be FB0. 5
That's okay. 6
And I will say okay to use this function block in the program we need to create at least one program 7
section so come here say new and program 0. 8
That's okay with the ladder diagram. 9
It's okay. 10
First of all we need to know for example we are writing a ladder diagram example like this for example 11
and with one input one output and the second input LD X0.1 and the second output. 12
And now 13
this is 0.0 or 0.1 14
It is a according to AS Series CPUs, for example for the DVP Cpu we are using just X0, X1 .. 15
X2,X3 or as output Y0,Y1,Y2..,Y7 16
etc. but for the AS CPU for Delta plcs the structure is changed so you need to use 17
it like X0.0 , X0.1 , X0.2 .. etc. 18
It will be like this add one more network and LD X0.2 and out Y0.2 and one more 19
network for example ld x0.3 and out Y0.3 20
So this is your program. 21
Imagine like this and it is taking a lot of area. 22
A lot of networks from you but we can put them all in just one function block so let's create our function 23
block according to these LD SM400 24
So this is always on contact and ld in here. 25
what we gonna write we need to create our identifiers our texts identify for example start 26
motor1 will be bool and the class will be variable input and start motor 2 will be bool and the variable 27
input and start motor 3 will be will and variable input and the fourth one again start motor 4 and type 28
will be bool and this will be variable input and motorone forward and bool will be variable output and 29
motor two forward will be bool and variable output. 30
And the third one motor three forward will be bool and this is will be variable output also and motor 31
four forward will be bool and this will be variable output. 32
And one more thing. 33
Let's create our speed. 34
Speed motors from 35
HMI will be word. 36
This will be variable input and in here motor speed to drive leave it like this will be word and this 37
will be variable output and let's create our project LD . 38
Start motor 1 and out motor 1. 39
Forward again motor 2 forward I will add contact here start motor two again Motor3 forward. 40
And here. 41
Start motor 3 and add one more motor four. 42
Forward and start motor. 43
Four and also in here. 44
I will use add or move instruction and I will say speed motors from HMI motorspeedtodrive 45
-- 46
-- 47
Like this Also we can. 48
We can do in here for example multiplication we can say multiply 49
speed motors from 50
HMI for example with 10 and speedmotorsfromHMI like this. 51
So let's compile our project and let's take a look just in here we have a problem. 52
I'm just looking it . 53
This is not correct. 54
That's okay because this should be lower. 55
And I'm looking okay. 56
Again compile 57
speed motors from HMI 58
that's okay. 59
That's okay. 60
Data type doesn't match. 61
This is the error 62
but for a moment forget it doesn't matter. 63
To understand function block I will create. 64
I created this and I will close them all and I will delete them all and I will put my function block 65
to here. 66
With the drag and drop method 67
that's okay. 68
The identifier of these function blocks or the name of this function block FB00. 69
That's okay. 70
So the class variable or variable retained this is just a variable for the. 71
If you want to retain the values of this function block you can select the variable retained but I will 72
just say this is a variable function block just we are learning now this is just for testing. 73
So add here x0.0, x0.1 , x0.2, x0.3 74
And like this and in here 75
Y0.0 , Y0.1 , Y0.2 , Y0.3 and for example D10 the just 76
put your fixed speed let's say it will be D5 and compile our project and go online to simulator 77
and yes we want to do a download this code to our plc or simulator and status of plc run. 78
Doesn't matter. 79
And okay. 80
So force release all this is the not forced device list just release like this. 81
So this is our function block and assign a value to D5 82
For example we want to send 100 value to our drives from the HMI like this. 83
And it is equals to 100. 84
So output is one hundred. 85
So you press start motor two and force and set on so motor 2 is turning forward is set on and force 86
for example three motor. 87
So this is output. 88
So look now in just one network. 89
And it is really easily understandable or you can really easy understand this function 90
block just here and here here on here and the complete for example you are wasting just five network 91
for this code. 92
But now in just one network in just one function block you can see them all. 93
You can monitor them all and you can adopt them all. 94
So this is how to use function blocks in delta plcs 95
So you can put a lot of inputs put a lot of outputs to a function block also inside your function block 96
you can create variables just like you are writing program sections in program sections you are using 97
for example auxiliary replace a lot of you can use them all in here with just a variable you can adopt 98
it not a variable input or variable output you can select it just a variable you can use them all in 99
here and then you need to just put your function block with drag and drop method to here that's all. 100
So this is the function block usage this as the function block how can we use it. 101
How can we created in the next videos we will do a lot of exercises or applications about the function 102
blocks for this video I am finished here. 103
See you in the next video.