EQ
Function Name |
EQ (Equal To) |
---|---|
Description |
Outputs a True value when its inputs are equal in value. |
Arguments |
Input 1 to Input n {ANY} For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Output {BOOL} The output is True only if the input values are equal in value. |
Example:
Function Block Diagram - EQ:
An EQ function has 2 inputs (in this case, 2 constant values). Both of the constants are set to 2, and so are equal. As the EQ's inputs are the same, its output is True.
If the top input was changed to 4, the EQ function would output a False value—it can only output a True value if all of its inputs are exactly the same.
ST Program - EQ:
The syntax for an EQ function in an ST Program is:
- Output := EQ (Input 1, Input n);
Where Output, Input 1 and Input n are defined as variables earlier in the ST program. Each input is separated by a comma and is a Boolean. The Output value is also a Boolean.
Alternatively, you can use an operator:
- Output := (Input 1=Input n);
This syntax is more commonly used with IF statements, for example, IIF (Input 1 = Input 2).