beckhoff TE1200 — 4.2.1.5.17 SA0118: Initializations not using constants

Configuration | Rules nVar : LINT; END_UNION END_TYPE MAIN program: PROGRAM MAIN VAR uSample : U_Sample; // => SA0115 END_VAR 4.2.1.5.16 SA0117: Variables with data type BIT | SA0117: Variables with data type BIT Samples: Structure ST_sample: TYPE ST_Sample : STRUCT bBIT : BIT; // => SA0117 bBOOL : BOOL; END_STRUCT END_TYPE Function block FB_Sample: FUNCTION_BLOCK FB_Sample VAR bBIT : BIT; // => SA0117 bBOOL : BOOL; END_VAR 4.2.1.5.17 SA0118: Initializations not using constants | SA0118: Initializations not using constants Samples: Function F_ReturnDWORD: FUNCTION F_ReturnDWORD : DWORD MAIN program: PROGRAM MAIN VAR CONSTANT c1 : DWORD := 100; END_VAR VAR n1 : DWORD := c1; n2 :

DWORD := F_ReturnDWORD(); // => SA0118 n3 : DWORD := 150; n4 : DWORD := n3; // => SA0118 END_VAR TE1200 63 Version: 2.11.1 Function Determines declarations of variables of type BIT (possible within structure and function block definitions). Reason The IEC-61131-3 has no provision for data type BIT. The code becomes easier to port if BIT is not used. Importance Low Function Determines initializations that do not assign constants. Reason Initializations should be as consistent as possible and should not refer to other variables. In particular, you should avoid function calls during initialization, since this can lead to access to uninitialized data. Importance Medium