"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