ABB AC500-S Safety User Manual page 218

Safety programmable logic controllers system
Hide thumbs Also See for AC500-S:
Table of Contents

Advertisement

Configuration and programming
CoDeSys Safety programming guidelines > Language-specific programming guidelines
size: REAL;
diameter: REAL;
END_VAR
size:= diameter * PI;
Also good:
VAR
size: REAL;
diameter: REAL;
END_VAR
size:= diameter * REAL#3.14;
4.4.3.9.3
Assignments
If assignments are used, the following programming guidelines should be followed:
n
For each instruction only one assignment is permitted. The expression assignments possible in CoDeSys
must not be used for safety-oriented applications.
Bad:
Res1 := Res2 := FunCall(1, C := D, 3);
Good:
C := D;
Res2 := FunCall(1, C, 3);
Res1 := Res2;
n
The implicit conversion between unsigned, signed and bit string types realised in CoDeSys and the
extension of smaller types to larger types during assignment should not be used. Explicit conversion
should be used instead.
4.4.3.9.4
Parentheses
Through definition of priorities for operators each expression is uniquely defined even without parentheses.
However, in order to avoid mistakes and improve readability the use of parenthesis is highly recommended
except in very familiar cases (multiplication/division before addition/subtraction).
Bad:
X := A < B AND NOT A > C + D OR E;
Good:
X := (A < B) AND NOT(A > (C + D)) OR E;
4.4.3.9.5
Bit access
Bit access (<variable>.<bit number>) is approved for creating safety-oriented applications and should also
be used instead of the regularly used multiple address allocation.
Bad:
VAR_GLOBAL
Flags AT %QW12: WORD;
Enable AT %QX12.0: BOOL;
END_VAR
218
AC500-S
30.03.2017

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents