Return at end of function block

mass89

Member
Join Date
Oct 2017
Location
England
Posts
77
Just wondering what the consensus is on this,
50% of programs I see, function blocks are ended with a return instruction, though if it wasnt there the program would return anyway.
Is this just a good practice or is it actually needed in some cases at the end of the block?
 
I've been using FBD language for nearly 30 years and in Logix since shortly after it became available and have never one used a Return block.


I agree with L D[AR2,P#0.0], it seems like it should only be used if you need to jump out of the FBD early, I can't think of a reason to do this but that doesn't mean other can't. I'm not sure exactly how it works, but it could be incredibly frustrating for someone adding changes if their changes were after the Return without their knowledge. Likely the only way to know would be to have the block execution order option turned on, which I never see at customer sites and seldom do myself.
 
This is what I thought, the fact it works without tells me that its not needed but I see it often enough to question it. I used to program a lot of C and that was the same deal, only return instruction when returning early.
Thanks for the sanity check (y)
 
Many will disagree with me, but I have found the plc programs run better with the return statement in every subroutine.


no, it doesn't make since, but, that's my 2 cents and I have this statement on all subroutines.


james
 
I took ownership of a plc5 and some slc 500 plc's years, ago.
lots of subroutines with no end statements.
the programs seemed to be very slow at times and even appeared to pause during a cycle. I started adding return statements to the logic at the end of the subroutines on several of the plc's and the programs reacted faster and the pause in the cycles went away. since that time, I add the return statements to all subroutines.


James
 

Similar Topics

Why is it good practice to put a return at the end of Subroutines? Most Ladders will work fine with or without it. I have to confess that...
Replies
14
Views
3,590
I have a Type C to RS485 adapter connect to my Siemens RWF55. I use modscan to scan it to get a value from the Siemens controller. In the...
Replies
4
Views
89
This is for editing HMI texts en masse in Excel. My problem is that in my HMI texts, some are in multiple lines, even if they are single texts...
Replies
26
Views
9,091
Hello, I have been tasked to create routines that has a JSR with zero return parameters to go to a routine with a RET with zero parameters. Is...
Replies
2
Views
1,394
Hi all, I have a PIDE block (Logix5000) where I am introducing interlocks. I am using the ProgOverrideReq to set the CV to 0% (shut a control...
Replies
3
Views
1,622
Back
Top Bottom