SA0037: Write access to input variablePermalink

Detects input variables (VAR_INPUT) that are accessed with write permission within the POU

Justification: According to the IEC 61131-3 standard, an input variable must not be changed within a POU. This kind of access is also a cause for errors and makes the code poorly maintainable. This is an indication that a variable is used as both an input variable and an auxiliary variable. This kind of dual use should be avoided.

Importance: Medium

Example

VAR_GLOBAL
	g_xGlob AT %QX0.0 : BOOL; 	
END_VAR

PROGRAM PLC_PRG
VAR_INPUT
	xVarIn1:BOOL;
	xVarIn2:BOOL;
END_VAR
VAR
	iCondition : INT;
END_VAR

iCondition := iCondition + INT#1;
CASE iCondition OF
	INT#1:
	g_xGlob := xVarIn1;
	INT#2:
	g_xGlob := xVarIn2;
ELSE
	g_xGlob := FALSE;
		xVarIn1 := FALSE; 	// SA0037
END_CASE

--> SA0037: Write access to input variable 'xVarIn1'