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,324
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,453
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,644
HI everyone, i am new to Siemens plc programming and i am in need of some help. yesterday we had an S7-1200 CPU 1214C fail to turn on an output to...
Replies
0
Views
1
Hello, I have a Mitsubishi FX3G 14M PLC and a E615 HMI from Mitsubishi/Beijer. I'm using GXWorks 2 to do the programming and I have no problem...
Replies
3
Views
52
Back
Top Bottom