SA0043: Use of a global variable in only one POU
Function | Determines global variables that are only used in one POU. |
Reason | A global variable that is only used at one point should also be declared at this point. |
Importance | Medium |
PLCopen rule | CP26 |
Sample:
The global variable nGlobal1 is only used in the MAIN program.
Global variables:
VAR_GLOBAL
nGlobal1 : INT; // => SA0043
nGlobal2 : INT;
END_VARProgram SubProgram:
nGlobal2 := 123;MAIN program:
SubProgram();
nGlobal1 := nGlobal2;