ABB AC500-S Safety User Manual page 179

Hide thumbs Also See for AC500-S:
Table of Contents

Advertisement

VAR CONSTANT
EnableBit: INT := 0;
END_VAR
VAR
Flags AT %QW12: WORD;
END_VAR
Flags := 0;
Flags.EnableBit := TRUE;
4.4.3.9.6
Conversions
No implicit type conversions should be used for assignment and mixed types, i.e., only explicit
conversions should be used.
Bad:
VAR
A: BYTE;
B: INT;
C: DWORD;
END_VAR
C := A + B;
Good:
VAR
A: BYTE;
B: INT;
C: DWORD;
END_VAR
C := INT_TO_DWORD(B + BYTE_TO_INT(A));
An even better solution in such cases is to reflect on type allocation.
4.4.3.10
Operators
The following table indicates the suitability of operators for creating safety applications.
Keyword
AND, OR, NOT, XOR
+, -, *, /, MOD
=, <>, >, >=, <, <=
SQRT, SIN, COS, TAN,
ASIN, ACOS, ATAN, LOG,
LN, EXPT, EXP
MIN, MAX, LIMIT
MUX, SEL
2020/06/19
CODESYS Safety programming guidelines > Language-specific programming guidelines
Suitable (yes / to a limited extent / no) (comment)
Yes
Yes. (Division should include an explicit test for divisor <> 0.)
Yes
To a limited extent. (Prone to error through rounding errors.)
Yes
Yes. (Please note: branches that are not selected are not executed. This can lead
to problems if functions calling system libraries are used.)
3ADR025091M0208, 12, en_US
Configuration and programming
179

Advertisement

Table of Contents
loading

Table of Contents