Return

randy

Supporting Member
Join Date
Apr 2002
Posts
158
Why would you need this Subroutine?

rmonroe

Bild2.jpg
 
they probably didn't NEED it at all ... best guesses:

it's a "place holder" for code that might be needed in the future ...

it's part of a "cookie cutter" format program that SOMETIMES needs this code - but didn't need it for the application at hand ...
 
It could also be that the maintainer / previous person tried to take it out and couldn't because they also took out the END instruction.

In DirectSoft5 for A/D PLCs, you MUST have an END instruction as the last line or the program will fail. Even a dummy PLC controlled completely by MOSBUS commands has to have a one-line END program burned in, or it just won't work. Technically, the END has to be before any SBRs, but the idea may be the same in RSL.

I don't know if it applies to RSLogix, but it may be similar.
 
You can't add or delete a ladder file in RUN mode, so those are both good reasons to start out with, and/or end up with a spare one.

I usually add at least one extra file, labeled SPARE, and don't JSR to it until I need it.

Paul
 
Same here (except in controllogix, you can add routines in run mode). I usually add a couple of blank uncalled subroutines. I also make my files much larger than I need and I often put in a subroutine that I name SCRATCH just for experimenting and developing/testing new bits of code.
 
1. The subroutine does nothing - waste of time calling it.

2. Assume it's a "we might need this" placeholder, and assume it is called, there is no need for the RET instruction, it is always optional in A-B PLCs, only needed if you are passing parameters back to the calling routine (same thing with the SBR instruction).

3. Assume it's a "we might need this" placeholder, and also assume it isn't yet called, so why put any code at all (i.e. the RET instruction) in a routine that isn't scanned?

4. If I assume you are looking at code that has been left with you after commissioning, then I'd say the programmer has just confused you with unnecessary code in the PLC. These sort of coding "gaffes" should have been removed once the subroutine was no longer needed.

5. I might go along with the "cookie cutter" idea, except this falls down because there isn't a corresponding (redundant) SBR instruction. I would expect auto-generation to have put this in.

I have to conclude this is just an example of either sloppy programming (I'm not being nasty - I just mean "less than ideal"), or incomplete commissioning, which should have removed this redundant code.

Recognise it for what it is - totally redundant - and either live with it or deal with it.
 

Similar Topics

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
112
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,214
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,433
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,653
I am using Indusoft Version 8.1, and trying to use the VBScript button command to find a string in a column in a MySql database, and return all...
Replies
36
Views
8,781
Back
Top Bottom