Configuration | Rules 4.2.1.3.6 SA0047: Access to direct addresses | SA0047: Access to direct addresses Samples: PROGRAM MAIN VAR bBOOL : BOOL; nBYTE : BYTE; nWORD : WORD; nDWORD : DWORD; END_VAR bBOOL := %IX0.0; // => SA0047 %QX0.0 := bBOOL; // => SA0047 %QW2 := nWORD; // => SA0047 %QD4 := nDWORD; // => SA0047 %MX0.1 := bBOOL; // => SA0047 %MB1 := nBYTE; // => SA0047 %MD4 := nDWORD; // => SA0047 4.2.1.3.7 SA0048: AT declarations on direct addresses | SA0048: AT declarations on direct addresses Samples: PROGRAMM MAIN VAR b1 AT%IX0.0 : BOOL; // => SA0048 b2 AT%I* : BOOL; // no error END_VAR 4.2.1.3.8 SA0051: Comparison operations on BOOL variables | SA0051:
Comparison operations on BOOL variables Sample: PROGRAM MAIN VAR b1 : BOOL; b2 : BOOL; bResult : BOOL; END_VAR bResult := (b1 > b2); // => SA0051 bResult := NOT b1 AND b2; bResult := b1 XOR b2; TE1200 42 Version: 2.11.1 Function Determines direct address access operations in the implementation code. Reason Symbolic programming is always preferred: A variable has a name that can also have a meaning. An address does not provide an indication of what it is used for. Importance High PLCopen rule N1/CP1 Function Determines AT declarations on direct addresses. Reason The use of direct addresses in the code is an error source and leads to poorer readability and maintainability of the code.
We therefore recommend using the placeholders %I* or %Q*, for which TwinCAT automatically carries out flexible and optimized addressing. Importance High PLCopen rule N1/CP1 Function Determines comparison operations on variables of type BOOL. Reason TwinCAT allows such comparisons, but they are rather unusual and can be confusing. The IEC-61131-3 standard does not provide for these comparisons, so you should avoid them. Importance Medium