Basic behavior of elements
-
Active step
An active step includes actions currently being executed. In online mode, CODESYS displays active steps in blue.
-
Init Step
In the first cycle after calling a POU in SFC, the initial step is automatically activated and the step action is executed.
-
CODESYS executes IEC actions at least two times. The first time is when the step is activated, and the second time when the step is deactivated (but not until the next cycle).
-
Alternative branches
If the step before the branch is active, then CODESYS passes the first transition of each alternative branch line from left to right. The next step is activated in the first branch line where CODESYS finds a transition which yields
TRUE
. -
Parallel branches
If the step before the branch (horizontal double line) is active and the transition before the branch yields
TRUE
, then CODESYS activates the first steps in every branch line. The branch lines are then processed at the same time. The step after the end of the branch (after the horizontal double line) is activated when all the last steps in the branch lines are active and the transition after the double line returnsTRUE
.
Processing order
-
Reset of IEC actions
CODESYS resets the internal action control flags of the action ⮫ qualifiers (
N
,R
,S
,L
,D
,P
,SD
,DS
, andSL
). These flags control an IEC action. However, flags are not reset when they are called within actions. -
Execute exit actions
CODESYS verifies whether all steps fulfill the condition for executing the exit action for each step. The order of verification follows the layout in the SFC chart, from top to bottom and from left to right.
CODESYS executes an exit action when the step is deactivated (after any entry and step actions have been executed in the preceding cycle and the condition for the subsequent step yields
TRUE
). -
Execute entry actions
CODESYS verifies whether all steps fulfill the condition for executing the entry action for each step. The order of verification follows the layout in the SFC chart, from top to bottom and from left to right. If the conditions are satisfied, then CODESYS executes the entry actions.
CODESYS executes an entry action as soon as the transition of the preceding step has been processed and yields
TRUE
, thus indicating that the step has been activated. -
Time check / Execute step actions
-
Execute IEC actions
CODESYS executes the IEC actions in alphabetical order. This is done in two passes through the list of actions. In the first pass, CODESYS executes the IEC actions for each step which was deactivated in the preceding cycle. In the second pass, the IEC actions of all steps are executed which are active.
-
Transition check / Activate next steps
The transitions are evaluated. If a step is active in the current cycle and the subsequent transition yields
TRUE
and any defined minimum time of the step has elapsed, then the subsequent step is activated.




NOTICE

Note the following when you execute actions:
An action can be executed multiple times within the same cycle if you use it in multiple SFC charts.
Example: A sequential function chart contains two IEC actions A
and B
, both of which are programmed in SFC, and both of which call an IEC action C
. In this case, C would be called two times.
If you use the same IEC action at the same time in different levels of an SFC chart, then this can lead to unpredictable results when processing. For this reason, CODESYS issues a corresponding error message. This error message can be displayed, for example, when you are working with projects which have been created in an earlier version of the development system.
Note: It is possible to use implicit variables to monitor the processing status of steps and actions and to control processing.