Pausing the execution of a PLC program

Jim Yeary

Member
Join Date
Dec 2002
Location
West Palm Beach, Fla.
Posts
9
For practice I am writing some code. In this code I want to be able to press a button and "Pause" the execution of the PLC until I press a different button. My question is if there is a command that does this. I am using an inexpensive Automation Direct PLC that my boss allowed me to by for training. There is a "Pause" command but it only turns off a range of outputs. Am I trying to do the impossible?

Thank You Gentlemen

JIM
 
There is rarely a good reason to pause the execution of a PLC program. While the PLC is paused, outputs are frozen in their last state, and no longer controlled by the PLC.

You could set up your program as a series of subroutine calls and use the switch to control whether or not any or all of the subroutine calls are executed.
 
Jim:

You're trying to do the impossible.

PLCs are designed to continually execute their code, over and over and over. When the Final Trump sounds, there will be PLCs cranking away.

One of the handiest troubleshooting tools in VB is the BREAK and STEP features outside of VB. There is no equivalent in a PLC.

If you pause the PLC program, it not only stops scanning the code, but also stops scanning the I/O. If this were a VB environment, you would be doing the equivalent of pausing the keyboard or the monitor. Or maybe Windows itself.

"KEYBOARD ENTRY PAUSED. PRESS ANY KEY TO CONTINUE"

If the PLC program is stopped "by pressing a button", how is the PLC supposed to make decisions when the different button is pressed?

You need to get out of the VB mindset and start thinking like a PLC. It's hard to make the leap, and many good VB programmers can't. You've GOT TO understand about scan. That EVERY rung is evaluated each scan. That actions done this scan may affect the next. That --( ) instructions don't just turn things on, they turn things off, too.

Start with Phil's book (top of the page - "CLICK HERE | BUY THE BOOK | FREE SHIPPING")
 
You could wire a switch to an input that scans your program file when the input is on. When the input is off, scan a different program file that will command the outputs in a safe state.

I have never had cause to do something like this though. What's on your mind to do this sort od thing??
 
"Pause" the execution of the PLC

From the other posts you may have come to what I think you really want to do which is to make it appear that the PLC is paused. This is different than actually Pausing the scan.

Then you have to define what this pause means. The whole kit and kabootle of PLC's can be summed up in one sentence: "What are the outputs doing now?" So, by pausing, do you mean to turn all outputs off, freeze the state of the outputs or put them into some "paused" state and then go back to their previous state when you resume?

Indeed, if the scan actually stopped, the plc would never "see" the change of state of the input to restart it.

In the parlance of machine control you would probably be talking about putting the machine in a mode. Most machines have at least a manual mode and an automatic mode (which are mutually exclusive). Manual mode would be as expected, where the operator has manual control over the machine elements and in automatic mode, the machine will performs its predefined sequence of events to process the parts it is designed to make. Several other modes or variations are possible.

A very simplified set of output rungs to control a double acting valve piped to a cylinder might look like this:

MANUAL Extend PB Extend Solenoid
-----] [------] [-----------------+---------------( )-----
|
Auto Auto |
AUTOMATIC Step 5 Step 7 |
-----] [---------] [------]/[-----+



MANUAL Retract PB Retract Solenoid
-----] [------] [-----------------+---------------( )-----
|
Auto Auto |
AUTOMATIC Step 7 Step 8 |
-----] [---------] [------]/[-----+



.

When the machine is in AUTOMATIC, the PB's have no effect (as it should be). Again, this is a pretty simplified example. Elsewhere there will also be rungs to switch between Manual and Automatic and to ensure that they don't come on at the same time.

Your PAUSE mode would just add more logic to these same output rungs so, for instance, if you want to make sure all outputs off when the program is in pause mode the above would look like:

MANUAL Extend PB PAUSED Extend Solenoid
-----] [------] [-----------------+----]/[--------------( )-----
|
Auto Auto |
AUTOMATIC Step 5 Step 7 |
-----] [---------] [------]/[-----+


MANUAL Retract PB PAUSED Retract Solenoid
-----] [------] [-----------------+----]/[--------------( )-----
|
Auto Auto |
AUTOMATIC Step 7 Step 8 |
-----] [---------] [------]/[-----+



.

If you want them to do something else, then you would place a parallel branch with a normally open PAUSED contact and other conditions for each rung:

MANUAL Extend PB Extend Solenoid
-----] [------] [-----------------+-------------( )-----
|
Auto Auto |
AUTOMATIC Step 5 Step 7 |
-----] [---------] [------]/[-----+
|
|
PAUSED |
-----] [---------] [------] [-----+



MANUAL Retract PB Retract Solenoid
-----] [------] [-----------------+-------------( )-----
|
Auto Auto |
AUTOMATIC Step 7 Step 8 |
-----] [---------] [------]/[-----+
|
|
PAUSED |
-----] [---------] [------] [-----+



.

"Freezing" the state of the outputs, as others have stated is probably most easily done by placing all the output rungs in a program file and then not calling that file (think function or subroutine) when in paused mode.

Remembering the output states and bringing them back after pause mode is gone is more advanced than this discussion should be right now but would be a really cool exercise :)

So, to coin an old acting phrase, "The scan must go on!" It's all about what you do with it.

Hope this helps
 
Update on question

Thanks so far for the replies. I am new to this but I do realize that the PLC will not stop scanning. Let us say we have a production automated machine. The operator has a reason to enter the enclosure, I want to be able to enter the unit and have the operator safe from any moving tooling. Therefore what I want is for all the ouputs to stay in thier current state until the operator is clear and presses a continue button. Here is an idea I am thinking about. Have the main body of the ladder logic inside a "Master Line Set" command. I would use the state of the "Pause/Continue" buttons to set an internal relay which would active the "MLS" instruction for normal operation and turn it off in the pause mode. This way in the pause mode the PLC is only scanning a small portion of the logic monitoring the state of the "Pause/Continue" buttons. Does this sound logical or crazy?

Thanks
 
Last edited:
The MC and MCR logic is suitable for this purpose. Remember to hard wire safety switches so it drops out the control wiring as well. Never rely on just the PLC for this. If the operator doesnt press the halt button and goes into the enclosure to work on the machine............
 
That seems to be a mixture of PAUSE and E-STOP.

Whether the operator pushes an E-Stop/Pause Button or simply opens the door to the enclosure, power to the devices is turned off. You might or might not have the E-Stop/Pause cut power to the PLC itself... that depends on what's reasonable, practical and expedient (in that order).

You have to be careful of how you design your device controls.
That is, "What happens to the device when the specific controller is disabled?"

If an E-Stop is pressed or a door to the enclosure is opened, what do you want that moving air cylinder to do? Retract? Extend? Stop?
The result you want indicates the type of air-valve you need - the air-valve you have determines the resulting action you get - do you really want to cut the air-supply to the system? Choose wisely!

Another thing to consider...
A lot of programs are written as nothing more than glorified "switch handlers" - they are strictly reactionary - a knee-jerk response sorta thing. Those programs are usually not mindful of what is happening at the Process-Level! "Process-Level" is higher than "Function-Level".

Function-Level is where a drill is actually turned ON or OFF, Extended or Retracted - the physical stuff. The Process-Level is where the Drill Function is told how fast to run, how far to extend, and when to do so!

While in "STASIS", the PLC might or might not know what you have done to the process! When you "resume" running, you have to consider what assumptions the program might be making at both the Function-Level and the Process-Level.

This might or might not be an issue - in any case, it has to be considered.
 
Do yourself a favor and do not count on the PLC to for Human safety. A million things could happen in the PLC from program an error to an output failing. Hard wire the access door (or whatever) to your safety circuit.

Jim
 
Hi, I am doing a mini project which requires me to pause(freeze) a sequence using stop button and pressing start button will resume the sequence.

My question is how to acheive above condition using the ladder diagram.
 
Thanks so far for the replies. I am new to this but I do realize that the PLC will not stop scanning. Let us say we have a production automated machine. The operator has a reason to enter the enclosure, I want to be able to enter the unit and have the operator safe from any moving tooling. Therefore what I want is for all the ouputs to stay in thier current state until the operator is clear and presses a continue button. Here is an idea I am thinking about. Have the main body of the ladder logic inside a "Master Line Set" command. I would use the state of the "Pause/Continue" buttons to set an internal relay which would active the "MLS" instruction for normal operation and turn it off in the pause mode. This way in the pause mode the PLC is only scanning a small portion of the logic monitoring the state of the "Pause/Continue" buttons. Does this sound logical or crazy?

Thanks

Jim, this is a safety function and certainly not to be performed by a normal PLC (a safety PLC yes, but not a standard one)

Before you can continue, for this type of operation, you would need to do a risk assessment before you can even design your safety circuit.

At the risk of sounding dramatic, if anyone health depends on this cheap PLC performing its task correctly in a real world situation, you probably need to get professional advice immediately, as you are going about it in totally the wrong way.
 
old thread alert ...

new user alert ...

to Chew_mj ... welcome to the forum ... the best way to get an answer to your question is to start a new thread of your own - rather than attaching to the end of a thread which is about 14 years old ... in your new thread, you should attach some of your existing code (the stuff that runs the sequence) and then tell us where you want the code to "pause" ... I'm sure that you'll get some helpful answers - if you can give us enough details to work with ...

good luck with your project ...
 
Last edited:
Do yourself a favor and do not count on the PLC to for Human safety. A million things could happen in the PLC from program an error to an output failing. Hard wire the access door (or whatever) to your safety circuit.

Jim

Right... Because nothing can go wrong with a hardwired circuit. No possibility of poor circuit design or component failure there -- especially if you've done a risk assessment and used the red colored components.

Sorry. Just feeling a little snarky this morning. ;)
 

Similar Topics

There was no great way to describe the behavior this temperature input is demonstrating, so I attached a video. It ramps, then hesitates, then...
Replies
17
Views
5,254
At issue: I'm trying to get multiple trends to pause (and also hopefully navigate) at the same time from one set of buttons on a display. This is...
Replies
0
Views
1,213
Hello, To make it short, the current system setup is a compact logic with a high speed counter 1769-HSC input module reading pulses from a flow...
Replies
12
Views
1,987
Hello, To make it short, the current system setup is a compact logic with a high speed counter 1769-HSC input module reading pulses from a flow...
Replies
0
Views
1,096
Hello, I am new to the forum. I have been using the Redlion Crimson 3.0 software for about 3 years. I have never had any luck pausing a timer...
Replies
3
Views
1,871
Back
Top Bottom