Creating a POU in SFC
-
Select an application in the device tree.
-
Click “Project Add Object POU”.
The “Add POU” dialog opens.
-
Specify a name and select the “Sequential Function Chart (SFC)” implementation language.
Click “Add”.
CODESYS adds the POU to the device tree and opens it in the editor.
Adding a step-transition
-
Select the transition after the initial step.
The transition is marked in red.
-
Click “SFC Insert Step-Transition After”.
CODESYS inserts the “Step0” step and the “Trans0” transition.
-
Select the “Trans0” transition and click “SFC Insert Step-Transition”.
CODESYS inserts the “Trans1” transition and the “Step1” step before the “Trans0” transition.
You can also drag the “Step” and “Transition” elements into the diagram from the “Toolbox” view.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding an entry action
-
Select the “Step0” step.
-
Click “SFC Add Entry Action”.
By default, you are prompted to select the duplication mode for the step actions. You decide whether the reference information about the existing step action objects is copied when the step is copied, or the objects are embedded. Embedding results in new step action objects being created when the step is copied. The duplication mode is defined in the “Duplicate when copying” step property. When this property is deactivated, the copied steps call the same actions as the current step.
You can deactivate the prompt completely in the SFC properties.
The display of embedded objects in the “Devices” and “POUs” views can be deactivated by means of a menu command.
-
For this example, accept the “Copy reference” default setting and click “OK” to confirm.
The “Add Entry Action” dialog opens.
-
Enter the name "Step0_entry" and select the “Structured Text (ST)” implementation language. Click “Add”.
CODESYS inserts the “Step0_entry” action below the POU in the device tree and opens the action in the editor.
In the
Step0_entry
entry action, you program statements to be executed one time when the “Step0” step becomes active. -
Close the editor of
Step0_entry
.The “Step0” step is now marked with an “E” in the lower left corner. Double-click this marker to open the editor.
The entry action
Step0_entry
is now available in the properties of the step in “Entry action”. Other actions can also be selected there as needed. -
Select the “Step0” step. Press [Ctrl]+[V] to copy the step.
The same entry actions inserted above are available In the inserted copy of the step. The new step then calls the same exact action.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding an exit action
-
Select the “Step0” step.
-
Click “SFC Insert Exit Action”.
By default, you are prompted to select the duplication mode for the step actions of the step. See above for adding an entry action. Then the “Insert Exit Action” dialog opens.
-
Enter the name "Step0_exit" and select the “Structured Text (ST)” implementation language. Click “Add”.
CODESYS inserts the “Step0_exit” action below the POU in the device tree and opens the action in the editor.
In the
Step0_exit
exit action, you program statements to be executed one time before the “Step0” step becomes inactive. -
Close the editor of
Step0_exit
.The “Step0” step is now marked with an “X” in the lower right corner. Double-click this marker to open the editor.
You can define the exit action in the properties of the step in “Exit action”. Other actions can also be selected there.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding an action
-
Double-click the “Step0” step.
By default, you are prompted to select the duplication mode for the step actions of the step. See above for adding an entry action. The “Add Action” dialog opens.
-
Type in the name "Step0_active" and select the “Structured Text (ST)” implementation language. Click “Add”.
CODESYS inserts the “Step0_active” action below the POU in the device tree and opens the action in the editor.
In the
Step0_active
step action, you program statements to be executed as long as the step is active. -
Close the editor of
Step0_active
.The “Step0” step is now marked with a black triangle in the upper right corner.
You can define the action in the properties of the step in “Step action”. Other actions can also be selected there.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding an alternative branch
-
Select the “Step1” step.
-
Click “SFC Insert Branch Right”.
CODESYS inserts the “Step2” step to the right of “Step1”. The steps are connected as a parallel branch signified by two pairs of double lines.
-
Select one of the double lines.
The double line is marked red.
-
Click “SFC Alternative”
CODESYS converts the branch into an alternative branch. The double lines change into a single line.
You can click “SFC Parallel” to convert an alternative branch into a parallel branch.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding a jump
-
Select the “Step2” step.
-
Click “SFC Insert Jump After”.
CODESYS inserts the “Step” jump after the “Step2” step.
-
Select the “Step” jump destination.
You can type the jump destination manually or select it by using the Input Assistant
. Select
Step0
.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding a macro
-
Select the “Step1” step.
-
Click “SFC Insert Macro After”.
CODESYS inserts the “Macro0” macro after the “Step1” step.
-
Double-click the “Macro0” element.
The macro opens in the implementation section of the editor. The name "Macro0" is displayed in the caption.
-
Click “SFC Insert Step-Transition”.
CODESYS inserts a step-transition combination.
-
Click “SFC Zoom out of Macro”.
The implementation section returns to the main diagram.
See also
-
linktarget doesn't exist but @y.link.required='true'
Adding an association
-
Select the “Step2” step.
-
Click “SFC Insert Action Association”.
CODESYS inserts an association to the right of the “Step2” step.
-
Click in the left field of the association to select the qualifier.
You can enter the qualifier manually or use the Input Assistant
. Select "P".
-
Click in the right field of the association to select the action.
You can type the action or select it by using the Input Assistant
.
See also
-
linktarget doesn't exist but @y.link.required='true'
-
linktarget doesn't exist but @y.link.required='true'
Using the library 'analyzation.library' for the analyzation of expressions
The library analyzation.library
allows for the analyzation of expressions. It can be used, for example, in the SFC
diagram to examine the result of the flag SFCError
. This flag is used to monitor timeouts in the SFC diagram.
See also
-
linktarget doesn't exist but @y.link.required='true'
See also
-
linktarget doesn't exist but @y.link.required='true'