Configuration | Rules In TwinCAT 3 PLC it is not necessary for variables to be declared as external. The keyword exists in order to maintain compatibility with IEC 61131-3. Sample: Global variables: VAR_GLOBAL nGlobal : INT; END_VAR Program Prog1: PROGRAM Prog1 VAR nVar : INT; END_VAR nVar := nGlobal; // => SA0121 Program Prog2: PROGRAM Prog2 VAR nVar : INT; END_VAR VAR_EXTERNAL nGlobal : INT; END_VAR nVar := nGlobal; // no error 4.2.1.6.2 SA0122: Array index defined as expression | SA0122: Array index defined as expression Sample: PROGRAM MAIN VAR CONSTANT cSample : INT := INT#15; END_VAR VAR aSample1 : ARRAY[0..10] OF INT; aSample2 : ARRAY[0..10+5] OF INT; // => SA0122 aSample3 :
ARRAY[0..cSample] OF INT; aSample4 : ARRAY[0..cSample + 1] OF INT; // => SA0122 END_VAR 4.2.1.6.3 SA0123: Usages of INI, ADR or BITADR | SA0123: Usages of INI, ADR or BITADR Sample: PROGRAM MAIN VAR nVar : INT; pINT : POINTER TO INT; END_VAR pINT := ADR(nVar); // => SA0123 TE1200 65 Version: 2.11.1 Function Determines the use of expressions in the declaration of array boundaries. Reason Not all systems allow expressions as array boundaries. Importance Low Function Determines the use of the (TwinCAT-specific) operators INI, ADR, BITADR. Reason TwinCAT-specific operators prevent portability of the code. Importance Low