RS Logix duplicate output

V@run

Member
Join Date
Oct 2016
Location
Union City
Posts
13
In RS Logix 5000, I have an OTE for an output in two different subroutines. One subroutine is active in main routine and another one is not. When I turn on the contact connected to the output in the active routine it turns on but it did not turn off when I turn the contact off. Is it because the rung of same output is True in the inactive subroutine?
 
Can't give the code its private but can give an overview
by following diagram. Please mind the drawing. Output_1 should be above coil and JSR above subroutine.

_______________
Bit_1 | JSR |
--[/]----------------------------------------------------------------| Subroutine1 |
| |
|_______________|


_______________
Bit_1 | JSR |
--[ ]-------------------------------------------------------------------| Subroutine2 |
| |
|_______________|


In Subroutine 1

Bit_2 Bit_3 Bit_4 Output_1
--[ ]----[ ]-----[ ]----------------------------------------------------------------( )-----


In Subroutine 2

Bit_2 Bit_3 Bit_5 Output_1
--[ ]----[ ]-----[ ]----------------------------------------------------------------( )-----


Here Bit_1 is True
Bit_2 and Bit_3 goes true
Bit 4 and Bit_5 go True at different Time
but output_1 stays ON in Subroutine 2 even if Bit_5 is False
 
Last edited:
Explain what you mean by "active", and "inactive" subroutines.

Are you saying that the JSR's are conditional, and only one subroutine can be scanned ?

Are you by any chance calling the subroutines with the same logical conditions that drive the output OTE ?

If you are, then each subroutine won't be able to turn the OTE off, because you aren't scanning it to do so.

Ceasing to JSR a subroutine will mean that all of the "non-retentive" type instructions immediately become "retentive", by "freezing" at the last state determined by the last scan. And this doesn't happen to just OTE instructions, it also applies to Timers, Counters, and any instructions that need to see a true-to-false rung transition can be affected.

Unless handled properly, switching subroutines in and out very nearly always leads to some form of improper action, and is, in many people's opinion, bad programming practice.

It can be done, of course, but it gets messy, and can make debugging a nightmare, especially if you are looking at a rung in an "inactive" subroutine that is false, but the driven OTE is ON, and vice versa.

As a general rule of thumb, I prefer not to have conditional subroutines for general control, only using them where applicable, e.g. Data Collection, Sorting, etc.

If you can let the forum see your program, there would ensue suggestions for correcting/improving it.
 
By active and inactive means the subroutines are connected through NO and NC contacts that have same tag bit. So by toggling the Bit we make one routine connected to main and other disconnected. Can't give the code its confidential. Can you explain what you are trying to say in terms of drawing that I have posted in my last reply. Means in terms of Bit_2, Bit_3, output_1, etc.
 
Last edited:
the only thing I can think looking at your posted sample is bit 1 is changing state before bit 5. thus ending the scanning of your subroutine, which would end its control over output1 since is no longer being scanned, so if bit 1 goes off followed by bit 5 it has no bearing on output 1 since the rung is no longer being scanned
 
You could also set up a trend that has bit_1, bit_2, bit_3, bit_4, bit_5 and output_1 in it. That could give you some good insight into things as well.

I would also try adding a new rung below output_1 in subroutine_2. It would look like this:

Code:
 bit_10                   output_10
--| |------------------------( )--

I would then manually toggle bit_10 and see if output_10 changes state as well. If it does not, that routine is no longer being called.

Is this an occasional or every single time?
 
Can't give the code its private but can give an overview
by following diagram. Please mind the drawing. Output_1 should be above coil and JSR above subroutine.


_____________
Bit_1 | JSR |
--[/]------------------------------| Subroutine1 |
| |
|_____________|
_____________
Bit_1 | JSR |
--[ ]------------------------------| Subroutine2 |
| |
|_____________|
In Subroutine 1

Bit_2 Bit_3 Bit_4 Output_1
--[ ]---[ ]---[ ]----------------------------------( )-----

In Subroutine 2

Bit_2 Bit_3 Bit_5 Output_1
--[ ]---[ ]---[ ]----------------------------------( )-----





Here Bit_1 is True
Bit_2 and Bit_3 goes true
Bit 4 and Bit_5 go True at different Time
but output_1 stays ON in Subroutine 2 even if Bit_5 is False

Firstly let me point out....

...output_1 stays ON in Subroutine 2...
--- is technically incorrect, output_1 is output_1. There is only one output_1, not a separate output for each subroutine. The ladder display simply shows the logic state of output_1 the last time it was read from the PLC, which is usually about 0.5 seconds update time.

Now let us deal with your statements for clarification, which leads to a few more questions.

Here Bit_1 is True
If bit_1 is true, then subroutine_2 must be executing. Is there anything driving bit_1 that can make it false when the JSR rung is executed, irrespective of what the ladder instruction highlighting says ? Use cross-reference to find that out.

Bit_2 and Bit_3 goes true
And must be true for output_1 to be turned on at all, in either subroutine.

Bit 4 and Bit_5 go True at different Time
output_1 stays ON in Subroutine 2 even if Bit_5 is False
In subroutine_2, Bit_5 is the only relevant bit to turn on output_1. If your latter statement is true, and there are no other rungs with output_1, then subroutine_1 must be executing to turn output_1 on again, since it can't be being turned on by subroutine_2.


It looks like you have a "bit-chase" situation, these can be hard to find, but your best tool is the cross-reference utility. Without a complete application, no-one is going to be able to help. You say you cannot post the whole of the code, so I recommend you Cross-Ref all the bits involved to see if there's anything you've missed.

Hint : in the cross-reference listing, double-click the header "Destructive". This sorts the list so that all the "driving" instructions, i.e. only those that can change the state of the tags, to the top of the list - ignore anything that is not "destructive".

Duplicate outputs is generally considered "bad practice", and I believe you are suffering one of the consequences.

Consider putting separate bits as outputs in the two subroutines, and then adding a new rung in a permanently scanned subroutine (or the "MainRoutine"), that OR's them together, to drive output_1.

Check your PM area also...


EDIT - formatting with {ladder}.{/ladder} delimiters doesn't work too well. I had tidied it up !!
 
Last edited:

Similar Topics

I have an application where I am sending emails and SMS text messages via an SMTP server, using MSG instructions. Everything works fine, except...
Replies
4
Views
1,220
Is there a way to find duplicate timers used in an application. Rung verification does not detect this.
Replies
7
Views
2,620
I have two copies of RSLogix 5000 open looking at two seperate Control Logix processors. Is there any way to copy a tag from one CLx and paste...
Replies
2
Views
12,142
Hello, I need guide to duplicate RSLogix activation disk.
Replies
22
Views
24,403
Hey all, first time poster here. I am wondering if anyone has tried using a Keyence SR-X300 barcode scanner to a Micrologix 1400. Keyence sent...
Replies
0
Views
30
Back
Top Bottom