PLC JSR De-energize

vinhn95

Member
Join Date
Jun 2016
Location
Vancouver
Posts
6
Hi Everyone,

I'm writing a program to control 2 motors depending on a switch selector position A or B. In POS A, motor 1 should be running while in POS B, motor 2 should be running.

I've tried using the JSR method so if the selector is in POS A, goes to Subroutine 1, run motor A, etc.

However, when pressing the stop button, the motor continues to run. I figured this is because the JSR is not de-energize and therefore the motor continues to run.

Reason I use a JSR is because there are many more requirements other than running the motor.

So question is, is it possible to de-energize their states if JSR is no called?

Thanks,
 
You could use an unlatch instruction in a different ladder that is being scanned to unlatch those bits when the JSR is not being scanned.
 
Hi Helliana,

Thanks for your prompt reply. Could you go into details how one would do that? I have multiple output states that were energized in the JSR, so how would one unlatch the whole outputs(Unlatching every output seems a bit repetitive).

Many thanks,
 
Suspending the scan of pieces of logic is troublesome for the reason you stated. So, within the routine being called by the JSR, perhaps the first rung should examine the "Start/Stop" condition, and if it equates to "Stop", unlatch the motor bit and exit the subroutine. That all would be on the first rung. If the "Stop" condition is not true, the remainder of the subroutine executes as always.
 
Why are you using a "JSR" (two subroutines) for this, just put the logic in the same subroutine.

Tell us more about the switch and what it is connected to (2 inputs? is the switch(es) NO or NC when in POS A or POS B.

If you insist on using 2 subroutines then make them unconditional and write the logic to prevent both pumps from running at the same time (if that is what you want).
 
Last edited:
However, when pressing the stop button, the motor continues to run. I figured this is because the JSR is not de-energize and therefore the motor continues to run.
It's the reverse. When you stop calling the subroutine there's nothing to tell the motor bit to turn off. Another option might be to put the outputs in an MCR zone.
 
Suspending the scan of pieces of logic is troublesome for the reason you stated. So, within the routine being called by the JSR, perhaps the first rung should examine the "Start/Stop" condition, and if it equates to "Stop", unlatch the motor bit and exit the subroutine. That all would be on the first rung. If the "Stop" condition is not true, the remainder of the subroutine executes as always.

Thanks, I'll try that.
 
Why are you using a "JSR" (two subroutines) for this, just put the logic in the same subroutine.

Tell us more about the switch and what it is connected to (2 inputs? is the switch(es) NO or NC when in POS A or POS B.

If you insist on using 2 subroutines then make them unconditional and write the logic to prevent both pumps from running at the same time (if that is what you want).

It's because there's more action required in the JSR when the switch is in POS A not just for running the motor, its NO.

I'm trying to reduce the length of the main program.

Thanks,
 
It's because there's more action required in the JSR when the switch is in POS A not just for running the motor, its NO.

I'm trying to reduce the length of the main program.

Thanks,

Don't use conditional subroutines. Use logic to make things happen.

Conditional subroutines cause all the problems you are having.
 

Similar Topics

Hi ALL Could someone please help me to understand what is happening with the following instruction I have a JSR with the following parameters...
Replies
6
Views
3,329
Hi, does it matters if I stop reading a subroutine (adding AFI instruction in front of the JSR) when he PLC is running. I verified and...
Replies
3
Views
2,454
Help! I've created extra files online with Logix500, but when I try to include them in the main (JSR) the PLC faults. Any suggestions?
Replies
1
Views
4,645
Hi all, looking to model old RR relays in PLC. Does anyone have any SPECIFIC examples on how to model a relay such as a polar relay, slow pickup...
Replies
0
Views
50
HelloI need software to download the program from PLC EH-A28DRP from an old machine whose manufacturer does not exist. It may be Ladder Editor for...
Replies
1
Views
41
Back
Top Bottom