Topic: DMD0146

Help File Version: 2.9.4.37

EXIT - Exit This Program


The Exit This Program (EXIT) instruction will cause the Program that contains the EXIT instruction to immediately stop running when this instruction is executed. Any ladder logic between the EXIT and the end of the Program will not be executed.

 

Once a Program has been started with the Run Program (RUN) instruction it will continue to run as long as the PLC remains in Run mode. In cases where the Program can determine that it needs to stop running, placing one or more EXIT instructions at the appropriate points in the Program is the proper method to stop the Program from running. A good example is a Program that is handling communicating with an external device. This Program could have one exit condition for when communication successfully completes and a separate exit condition when errors are detected. When the Program exits, its associated structure will be initialized (this includes resetting the Stages, clearing internal flags, counters, etc.) in preparation for the next time it is run.

 

When the Program exits, the Termination LogicThe additional processing that an instruction has that is run when the code block that contains the instruction is disabled. For example, it is the termination logic of an Output (OUT) coil in a stage that turns OFF the coil when that stage is disabled by a Jump or Stage Reset instruction. for the Program will run. During its termination scan, the Program will run the termination logic for each individual instruction that is contained within the Program, then will run its own termination logic. All of the Output Coil (OUT) instructions, and any output coil in any instruction that has one as a parameter (for example TIMEPROP) are turned OFF. All of the Timers and Counters are reset. If the Program contains Stage (SG) instructions, all of the Stages in that Program will be disabled. The Program's associated structure will be initialized (clearing internal flags, counters, etc.) in preparation for being restarted.

 

 

Note: an EXIT instruction cannot be placed in $Main.

 


Parameters:

This instruction has no parameters.

 


Status Display:

 

The green triangle in the upper left corner indicates this is a Skipping instruction.

 


See Also:

CALL - Call Subroutine

 

ENTASK - Enable Task

 

RUN - Run Program

 

EXIT - Exit This Program

 

HALT - Halt Program or Task

 

RESTART - Restart Program or Task

 

STOP - Switch to Program Mode

 


Related Topics:

Overview of Code Blocks (Programs, Tasks, Subroutines and Interrupt Service Routines)

 

Modifying the Execution Order of Programs and Tasks

 

Termination Scan Behavior

 


Rung Example: