Inserting POUs with EN/ENO
Inserting POUs with EN/ENO formal parameters by default
The default settings for inserting POUs with or without EN/ENO formal parameters into FBD/ST code worksheets is made under the 'EN/ENO > EN/ENO Settings' category in the 'Extras > Options' dialog. By default, new POUs are inserted into FBD/LD worksheets with EN/ENO formal parameters when the corresponding checkbox 'Insert functions with EN/ENO in ...' is checked.
With activated checkboxes, all newly inserted blocks in FBD will have EN/ENO formal parameters (EN/ENO pins). In ST, the tooltip shows two prototypes of the function (with EN/ENO and without EN/ENO) when typing the function name.
Example for the function insertion in ST
Observe the following when changing the default settings:
- Existing POUs with EN/ENO formal parameters are not affected (see also the description below). They remain unchanged and the election control by EN/ENO remains active even after you have deactivated the EN/ENO checkboxes.
- The settings in the 'Options' dialog only control the editor behavior when inserting new POUs into the code. The conditional execution feature, i.e., the use of EN/ENO formal parameters is always activated in the application, independently of the settings made in the 'Options' dialog.
Adding/removing EN/ENO formal parameters for particular POUs
Independent of the default settings made in the 'Options' dialog, you can add or remove the EN/ENO formal parameters for particular POUs that support EN/ENO. In FBD, this is done by selecting the block symbol (multiselection is possible) and clicking the 'Toggle EN/ENO' in-place button as shown in the following example:
(To remove connected EN/ENO formal parameters, first disconnect the formal parameters and then remove them via the 'Toggle EN/ENO' in-place button.)
In ST, manually enter the EN/ENO formal parameters and the associated variables into existing call statements (as shown in the following example) or delete them.
Result1:=TO_SINT(EN:=Enable, ENO=>Enabled, UINT#255);
Note
Toggling the EN/ENO formal parameters is only possible for function POUs. This is not possible for user-defined FUs/FBs because the in-/outputs are implemented by the developer of the FU/FB. |