SA0166: Max. number of input/output/in-out variables...Permalink

Detects whether or not a defined number of input variables (‎VAR_INPUT‎), output variables (‎VAR_OUTPUT‎) or ‎VAR_IN_OUT‎ variables is exceeded in a POU. In the “Project Settings”, double-click the rule entry to open a dialog where you define the maximum number.

Justification: This is about checking individual programming guidelines. Many programming guidelines provide for a maximum number of POU parameters. Too many parameters make the code unreadable and the POUs difficult to test.

Importance: Medium

PLCopen rule: CP23

Example

In the project settings, for Rule 166, you have defined a maximum number of ‎1‎ for ‎VAR_IN_OUT‎ variables.

FUNCTION_BLOCK FB1
VAR_INPUT
 xIn    : BOOL;
END_VAR
VAR_IN_OUT      
 xInOut1 : BOOL;
	xInOut2 : BOOL;
END_VAR

--> SA0166: Too many VAR_IN_OUT variables in POU 'FB1'