At a Glance

Step by step mode consists in executing the application program rung by rung. For rungs containing sub-routine (SR) or user function block (DFB) calls, step by step can be written into the code used to implement them.

This mode is launched by a breakpoint which will have been set in advance. It is used to examine the behavior of the code, and the value of the variables.

It is implemented in online mode. The section executed in step by step mode stops the corresponding task, and the links are no longer animated.

Three commands can be used for step by step mode. These are:

  • the Step Into command,

    • if the current element is a rung which does not contain an SR call or a DFB instance call, this command executes the rung and moves onto the next rung,

    • if the current element is a rung which does contain an SR call or a DFB instance call, this command executes the start of the rung and moves to the first SR or DFB call.

    • if the current element is an SR or DFB instance call, this command can be used to step into the code and go to the first element.

  • the Step Over command,

    • if the current element is a rung, this command executes it in its entirety and moves onto the next rung,

    • if the current element is an SR or DFB instance call, this command executes it in its entirety as if it were a straightforward element and moves onto the next element.

  • the Step Out command.

    • if the current element is part of the code of an SR or DFB instance, this command can be used to execute all the elements of the SR or the DFB and to move onto the next element after the SR or DFB call,

    • if the current element is an SR call or a DFB instance call, this command executes the remainder of the current rung in its entirety and moves onto the next rung,

    • if the current element is a rung, this command executes the current section in its entirety and moves onto the start of the next section.

From step by step mode, if you want to relaunch the execution of the task in order to return to the breakpoint you set earlier, select the Debug->Go command from the menu, or click on Go in the toolbar:

Step Into, Step Out and Step Over

Example:

Description of step by step from the breakpoint reached :

Step

Action

1

Clicking on the Step Into button moves execution of the program to the SR1 call.

2 or 2’ or 2’’

If you click on:

  • Step Into (2) execution of the program moves onto %MW1:=0

  • Step Out (2’) the rung is executed and execution of the program moves onto the next rung.

  • Step Over (2’’) SR1 is executed and execution of the program moves on to call SR2.

3

Clicking on Step Out while in SR1 executes SR1 in its entirety and moves execution of the program on to call SR2.

4 or 4’ or

If you click on:

  • Step Into (4) execution of the program moves onto %MW2:=0

    Clicking on Step Into moves execution of the program onto %MW3:=5, and so on if you want to use step by step in SR2.

  • Step Out (4) the rung is executed and execution of the program moves onto the next rung,

5

Clicking on Step Out while in SR2 executes SR2 in its entirety and moves execution of the program onto the next rung.

NOTE: When program execution is over an instruction, it will not yet have been executed. It will be executed after a command is pressed.

Specific Case of Step Out

If you want to perform step by step section by section, execute the Step Out command from the first element of each section.

NOTE: If the next section is an SFC section or a section implementing an action or a transition (mandatory in the Mast task), this is skipped unless a language element has a breakpoint.

Rule

In step by step mode the task manager will not detect a watchdog overflow for the task currently being debugged. It will, however, detect infinite loops.