EQ block

Short summary

Name

EQ

→POU type

→function

Category

IEC-block, Compare

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/error.svg currently restricted
(IEC demands data type ANY_ELEMENTARY for the inputs, hence the following data types are demanded as well: LTIME, WSTRING, WCHAR, LDATE_AND_TIME, LTIME_OF_DAY and LDATE. Currently, these data types are not supported for the block.)

Graphical interface

images/download/thumbnails/414780855/EQ-version-1-modificationdate-1534926877009-api-v2.png

Available since

  • version 1.0.0 (for logi.CAD 3) – initial variant

  • version 1.11.0 (for logi.CAD 3) – enhancement: DATE_AND_TIME and TIME_OF_DAY for IN1, IN2, ... IN16

  • version 1.91.0 (for logi.CAD 3) – enhancement: STRING and CHAR for IN1, IN2 ... IN16

Functionality

The block is a comparator regarding equality ("EQuals to").

Enter the values at the inputs, those values are to be compared. The block returns value TRUE (or an equivalent), if all values connected to the inputs are equal – hence, if: ( IN1=IN2) & (IN2=IN3) & ... & (IN15=IN16)

Bitstring values (= ANY_BIT values ; see →generic data type} are treated like unsigned →integer values by the block. This behavior is a specification according to the →IEC-standard.

Inaccuracies for floating-point numbers

Due to the internal representation of floating-point numbers (affects the data types REAL and LREAL) there might be inaccuracies when processing such values. Such inaccuracies might result in a not expected result when comparing such values.

Inputs, return value


Identifier

→Data type

Description

Inputs:

IN1

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE or TIME_OF_DAY

1st value

IN2

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE or TIME_OF_DAY

2nd value

... (extensible until)

IN16

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE or TIME_OF_DAY

16th value

Return value:

BOOL


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

The calculated values are evaluated by using the Assert block .

FUNCTION_BLOCK ExampleToEq
 
VAR
result1, result2 : BOOL;
END_VAR
result1 := EQ(IN1 := 1.0, IN2 := 2.0);
result2 := EQ(IN1 := 1.0, IN2 := 1.0);
Assert(result1 = FALSE);
Assert(result2 = TRUE);
END_FUNCTION_BLOCK

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.