Non duplicate OTE staying on in subroutine

RazzlDazzl

Member
Join Date
Sep 2011
Location
Mackay,Gladstone, cairns
Posts
6
Hello all,
I like many people are fairly new to this, here is my quandary.

I have a main routine and 20 odd subroutines, when I activate subroutine then an OTE at the end of the subroutine ( It switches 2 XIC items on the main routine) the OTE ENERGIZES and stays on.
So, I have checked to make sure it's not a case of DCS ( double coil syndrome). I even deleted the extra XIC so that one instruction per OTE. didn't work.
Being fairly new to this can you guys point me in the right direction
I am using rslogix 5000 with an AB controller run off an AB panel view
 
Welcome!
Can you post your code and tell us which OTE? Zipped first forum rules and if you can post the PanelView file.
 
Are you still reading the subroutine after you energize this output. If you have a subroutine that is not being read (IE you are bypassing it in the main routine) then everything inside that subroutine stays in its last state. If you do not scan that subroutine then nothing is telling that output to turn off.
 
Another thing to check when you have an OTE that appears to be stuck on is to make sure that the subroutine containing the OTE instruction is actually scanning.

If you open the subroutine on line, and it is not actually being called, and that memory bit had been left on, it will continue to stay on.

Another silly one is, and I've done it myself more than once, is to "assume" your online when actually your offline. Because the highlights still remain on the screen you may be fooled into thinking you are still looking at live data.

EDIT: Clay beat me to it!!
 
Ooops - will attach and send

G'day BOB,
thanks for the quick reply, I will get the code and attach it as soon as I can (I am working off my iPhone for Internet at the moment As I am on site)

Quickly, also to use a JSR Do you need a subroutine label at the top of a subroutine and a RET?

Regards
Ryan
 
If the subroutine is conditional then any bits written to by an OTE instruction will remain in their last state.

OTE is a computer instruction. It is not a device. The operation of OTE is
IF RUNG IS TRUE THEN WRITE A 1 TO THE ADDRESS, ELSE WRITE A 0 TO THE ADDRESS.

If the OTE instruction does not get executed because the subroutine is not executed then the state of the addressed bit will remain in whatever state it was last time the instruction was executed.


The SBR label is only necessary when passing parameters to the subroutine. If you are not passing parameters (an advanced topic) then its is not necessary.

RET is necessary for returning parameters or if you want to conditionally terminate the subroutine early. If neither of those apply then it is not necessary and may be omitted.


Edit BTW, welcome to the forum.
 
Last edited:
Quickly, also to use a JSR Do you need a subroutine label at the top of a subroutine and a RET?

I believe that they're not required with RSLogix5000 unless you're passing parameters

A JSR will call the beginning of the routine whether or not the SBR marker is present. At the end of the routine, if the END instruction is reached, it will act the same as a RETurn.

This is also the case with RSLogix500. With RSLogix5, I believe its the same thing, optional unless passing parameters.
 
I'm so glad you guys have got my back

Hey all,
Thanks for the replies, I just got this dumped in my lap ( I am a sparky wiringing up the project) when the boss said," oh hey can you program the plc aswell" urgh. So I really appreciate the help.

So my next question is, how do I ensure a subroutine continues to scan throughout the process, is it a simple matter of making sure the JSR is "energized" In the main routine?

Ryan
 
Last edited:
...
how do I ensure a subroutine continues to scan throughout the process, is it a simple matter of making sure the JSR is "energized"?
Ryan

I would be able to say yes with the smaller families, but with Logix, it can become tricky with multiple tasks and priorities, and potential interrupt routines.

zipping and posting the .acd file will help, but being able to monitor the system while running and understand the programs/routines and how they're prioritized, scheduled, and executing will need to be done in person.

Once the gurus here look at your code, they should be able to tell you what to look at while online.
 
A very common structure for a PLC program is to have a "Main Routine" that contains nothing but a bunch of unconditional JSR instructions, where the subroutines are just used to break up the program for readability.
 
Changing to non conditional sub routines

Ok my next course of action is going to be to attach the sub routines to the main branch with no conditions ( I.e. Only the sub routine on the rung)
I lost the whole system last night :-( now it's repair time

** I'll get my code up asap because I know with out that there are a few variables, no Internet connection for my laptop where I am

I really can't thank you guys enough
 
Yes, conditional subroutines are not really suitable for normal relay ladder logic (setting bits with "coil" instructions)m due to the need to JSR to them after the transition to false in order to execute the OTE instruction one last time...

General relay logic needs to run all the time.

Search routines, sorting and inserting record in a file, and odd ball side tasks like that can be conditional, but typically consist of MOV or COP or MSG or other file type operations.

You can get fancy with OTL and OTU for direct or indirect control of real I/O wtih conditonal subroutines, but it will clutter, bloat and ofuscate what is simpler as good old fashion unconditional start stop logic.
 
Wow guys thanks!!!

Ok ok guys a massive thanks to everyone!!

Now, I won't go on with how everyones input ( pardon the input pun) helped to get things running.

Fault: OTE's staying on in subroutines even when rung in subroutine is false.

Cause: me mainly,Checking that I'm online aswell! Especially if there is a controller fault!! but conditional subroutines not scanning once conditions had changed. So the routine would scan the first time( and switch OTE's on) then it would leave the subroutine and not Rescan it thus not checking that the rung in the sub routine was now false and de-energizing those OTE's.

REPAIR: coffee, slap myself, seriously though got online first by getting rid of a controller fault.
1: Made subroutines on the main routine unconditional ( I.e. Having them on a rung by themselves in the main routine.). This allowed them to be scanned more than once and allowed now false rungs to switch off OTE's
2: Eliminated duplicate OTE's. Yeah I started this program being given to me with 20 routine each with 29 duplicate warnings.
3: checked and tested for anything I forgot to rename

Thanks to everyone that posted to help me out.
Ryan
 

Similar Topics

if we need to take back up of Siemens CPU(s7300 /s7400) with non siemens slave profibus nodes without their gsd files and when we restore it in...
Replies
0
Views
67
Hi all, I have installed a SICK AFM60A-S4IB018x12 encoder to Allen-Bradley CompactLogix PLC and configured its parameters via AOI provided by...
Replies
0
Views
82
Hi, I'm trying to understand a couple of things with a feedback signals that are used in a SRP/CS that I'm working with. Quick disclaimer: I'm...
Replies
2
Views
492
Hello, has anyone ever been caught in this situation? You have redundant CPUs, fieldbus is PROFINET, there are some devices which don't have the...
Replies
0
Views
501
Looking to see if there is any sort of publication or details on if I can tie a 1794 AENT module to a 3rd party eth/ip scanner (happens to be opto...
Replies
2
Views
682
Back
Top Bottom