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.
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 !!