The built-in standard functions that represent a subset of the standard IEC functions are called operators. User-defined functions cannot be created in the safety programming.
The operators have the same semantics as in CODESYS Standard.
They can be connected to both SAFExxx and Data types Standard.
The operators are inserted using the Insert Box or Insert Empty Box command.
The operators can also be added from the toolbox in the ToolBox view. The toolbox in the Safety FBD Editor contains the following categories:
-
Boolean operators
-
Mathematical operators
-
Other operators
The following categories are displayed for operators in the Input Assistant:
-
Operators
-
Conversions (not in the Basic Level)
Operators extendable by additional inputs
-
AND -
OR -
ADD(only in the Extended Level) -
MUL(only in the Extended Level) -
MUX(only in the Extended Level)
The EQ, LT, LE, GT, and GE operators, which are likewise extendable in accordance with IEC, can be used only with two inputs (as in the case of standard ).
The Insert Input command adds a further input to an extendable operator box.
Boolean operators
-
AND(2 inputs) -
AND(3 inputs) -
OR(2 inputs) -
OR(3 inputs)
All operands of the OR must be SAFEBOOL.
Boolean operators
-
AND(2 inputs) -
AND(3 inputs) -
OR(2 inputs) -
OR(3 inputs) -
XOR -
NOT
|
Important |
|---|---|
|
The careless use of the The Programming rule: The |
Mathematical operators
-
ADD(2 inputs): ArithmeticADDoperator -
ADD(3 inputs): Addition with three inputs -
SUB: Subtraction -
MUL: Multiplication -
DIV: Division -
EQ: Comparison for equality -
NE: Comparison for inequality -
LT: Comparison for "less than" -
LE: Comparison for "less than" or "equal to" -
GT: Comparison for "greater than" -
GE: Comparison for "greater than" or "equal to"
Other operators
-
SEL -
MUX
Conversions
-
BOOL_TO_INT -
BOOL_TO_DINT -
BOOL_TO_TIME -
BOOL_TO_WORD -
BYTE_TO_INT -
BYTE_TO_DINT -
BYTE_TO_TIME -
BYTE_TO_WORD -
DINT_TO_BOOL -
DINT_TO_BYTE -
DINT_TO_INT -
DINT_TO_TIME -
DINT_TO_WORD -
DINT_TO_DWORD -
DWORD_TO_DINT -
DWORD_TO_TIME -
INT_TO_BOOL -
INT_TO_BYTE -
INT_TO_DINT -
INT_TO_DWORD -
INT_TO_TIME -
INT_TO_WORD -
TIME_TO_BOOL -
TIME_TO_BYTE -
TIME_TO_INT -
TIME_TO_DINT -
TIME_TO_WORD -
TIME_TO_DWORD -
WORD_TO_BOOL -
WORD_TO_BYTE -
WORD_TO_DINT -
WORD_TO_INT -
WORD_TO_TIME -
WORD_TO_DWORD
The characteristics of some operators specific to are described in the following sections
-
Runtime error in case of operator overrange in the Extended Level
|
Important |
|---|---|
|
It is the developers responsibility to design the program logic such that no runtime errors occur. |
Reacts to the following overranges with a runtime error, as a result of which the application is stopped and a log entry is generated.
|
Level |
Language element |
Runtime error in case of |
|---|---|---|
|
Extended |
|
Division by 0 |
|
Extended |
|
Call with first input with a negative value or with a value N that is greater than the number of inputs minus 1. Example: |
|
Extended |
|
Output value is not in the value range of the target type: When converting between two
likewise
|
|
Tip |
|---|---|
|
The standard behavior of |