6.5.5.2 Assign a Conditional Code to a Transition
This paragraph explains how to specify a condition through a piece of code, and how to assign it to a transition.Start by creating a transition code: select Scheme>Code object>New transition code; or select [New transition] from the context menu of the SFC POU in the Workspace.In either case, GF_ProjectVX code displays a dialog box similar the one shown in the following picture.
Note that you can use any language except SFC to code a condition. Select one of the languages and type the name of the new condition in the text box at the bottom of the dialog box. Then either confirm by pressing OK, or quit by clicking Cancel.Now the transition code is added to the project tree; you can open its editor by double-clicking it, or by opening its context menu and selecting Edit source.Note that you are not allowed to declare new local variables, as the module you are now editing is a component of the original SFC module, which is the POU where local variables can be declared. The scope of local variables extends to all the actions and transitions making up the SFC diagram.To assign the transition code to the transition element, double-click the transition element in the SFC editor. This causes the following dialog box to appear.
Select Code, and then choose the name of the condition you want to assign to this transition from the list. Then confirm by pressing OK.