0:16
hi everyone welcome to automation
0:18
community In this session we are going
0:20
to see about screens in Omrron PLC So
0:24
before entering into the topic kindly
0:26
like and subscribe our channel for more
0:28
updates and videos sub routine So it's
0:32
functions in you know software
0:35
programming like in Python or C C++ and
0:38
all we will be writing the function
0:40
Whenever you want to repeat some task
0:42
you will be writing that in the function
0:44
and whenever you want you will be
0:45
calling that function Same like that in
0:48
ladder logic we can able to write a set
0:51
of you know instruction or a task inside
0:54
one uh subroin and whenever you want you
0:58
can call that subroin Okay So it's like
1:01
a function in ladder logic All right So
1:04
we have subroin and subroin entry and
1:07
subroin return So all these three
1:09
instructions are combined If you if you
1:12
want to use a sub routine concept you
1:14
have to use all three instruction in
1:18
logic So the instruction will be looking
1:20
like this And how to find out which
1:23
subruine you are referring to by using
1:26
the subruine number So we have to assign
1:30
the subruine number for the each subroin
1:32
and whenever you want you can call by
1:38
Okay So first we have to use the sub
1:41
routine okay SBS and you have to call
1:44
that by using some run condition over
1:47
here and if this number n is matching
1:51
with the subroin it will perform the
1:54
task which is inside this subruine okay
1:57
and you have to end the subroin using
2:01
function So by using this subroin region
2:05
you can able to fix okay this is the
2:08
function we have to perform if it is
2:10
called like that All right So let's see
2:18
logic Okay So I'm going
2:21
to have some run before calling the sub
2:25
routine It's like our normal uh you know
2:30
task It's like a normal run Okay So now
2:33
you are going to call the sub
2:36
routin So to call the sub routin we have
2:39
to use sbs n the number of your sub
2:44
routin Okay I'm assigning that sub
2:53
zero Okay All right So now you have
3:02
routin So for that you have to enter it
3:05
Enter into the sub routine first SBN is
3:16
Enter Okay And now you can write the
3:21
function You can do some addition
3:23
subtraction what and all you want You
3:25
can write as of now I'm going to perform
3:41
have and here you can end it done you
3:46
can write multiple lines also ex for
3:49
example only I'm just explaining this so
3:52
I'm ending my function That's it Okay
4:04
simulation Okay Now so now we are going
4:11
perform this function See just turn on
4:17
is on Why because I have used both the
4:24
I just change that first because your
4:27
sub routine is called so it is
4:44
performing Now if you turn on this 0.06
4:48
your output will not be in on condition
4:54
your output is off because the function
4:57
is not called yet calling in the sense
5:00
what you have to make this condition
5:01
true that's it that's what I'm meaning
5:03
that as calling see once you called that
5:09
on for example you turn off this and you
5:14
turn off this your output will not go to
5:16
off condition because you cannot able to
5:19
turn on and turn off until the function
5:21
is called Okay if you call the function
5:25
automatically output will go off because
5:27
your input condition is off Okay so this
5:30
is how sub routine will work And how
5:35
this this will be working as normal
5:39
RAM Whenever you want you can turn on
5:41
Whenever you want you can turn off This
5:45
independent Okay So this is how subroin
5:52
in home run PNC and what if if you are
5:59
condition let's see compile it and you
6:04
see there is error here look at this
6:08
invalid SBN end in SBN so return is must
6:13
without that you cannot able to perform
6:16
wrong Okay What if you have not called
6:23
function I have cut the SBS the calling
6:27
of the function i have done
6:31
the I have edited See there is a zero
6:35
error That means what the program is
6:37
accepting the way you have written
6:41
But when it comes to the operation it
6:44
will not turn on your output because you
6:48
have not called the function Simple
6:50
right this is not throwing an error that
6:53
you have to put SBS before SBN But it's
6:56
not showing there is an
7:03
So SBS is also mandatory one
7:08
What if you have not entered the
7:12
function now it will show an
7:16
error See error SBN is not
7:20
defined Okay So like this you can
7:24
understand the working of sub routine
7:28
and what you can use the nested sub
7:31
also So I'll show you how to use that
7:53
bntor So write any condition
8:00
here Just connect some output
8:17
return and for this calling I'm going to
8:20
put inside that sub routine Before that
8:23
we have written one sub routine Oh I'm
8:45
PS one I'm going to call here This is
9:04
my I'll turn on this second subutance uh
9:08
function Your output is
9:10
off because it's not called yet correct
9:14
so let's call this SBS1 Let's call
9:19
this let's call this but still your
9:22
output is off Why because you have given
9:26
the sub routine inside the sub routine
9:28
So you have to call this sub routine
9:31
first Correct you call this
9:37
is automatically getting update Okay
9:40
This is called as nested sub
9:45
See I have put the sub routine here You
9:49
have to put the different number All
9:53
right So this return is for the first
9:55
sub routine you have used So the return
9:58
you have used first return you have used
10:00
is for sub subruine zero The second
10:04
return is for the second subruine you
10:06
have declared All right So this is how
10:09
sub routine will be working in home run
10:11
PLC I hope you have understood the
10:13
concept Kindly like and subscribe our
10:15
channel for more videos and updates I'll
10:18
meet you in the next session Thank you