MEMCMP block
Short summary
Name |
|
→POU type |
|
Category |
|
Conform to →IEC-standard |
not defined in IEC-standard |
Graphical interface |
|
Available since |
|
Functionality
The block compares bytes of one input value with the bytes of another input value and returns an appropriate value as information about the comparison (see the following table under "Return value").
You enter the first input value at input IN1
and the second input value at input IN2
. At input LEN
, enter the numer of bytes to be compared.
By default, value 0
is specified for the number of bytes.
Special cases:
-
In case of
LEN = 0
, the block automatically calculates the number of bytes to compare forIN1
andIN2
. -
If the value for
LEN
is > than the maximally possible size of the input valuesIN1
andIN2
, the block compares until the maximally possible size of the input value. In this case, the outputENO
is set to valueFALSE
. -
If a
STRING
element with a length is connected toIN1
orIN2
, the length of theSTRING
buffer is used. The length of theSTRING
buffer is determined by the declaration.STRING
elements with a length areSTRING
variables declared by you; see "Declaration of STRING variables (incl. access)". -
If a
STRING
element without a length is connected toIN1
orIN2
, the length of theSTRING
buffer is also used. However, the length of theSTRING
buffer is determined by the resulting value.STRING
elements without a user-defined length are resulting, if you are usingSTRING
functions or →character string literals. -
If you are using the
MEMCMP
block to compare an initialized structure variable with a variable which has been initialized identically by using theMEMSET
block, the comparison ofMEMCMP
returns that both structures are different.
Inputs, outputs, return value
|
Identifier |
Description |
|
---|---|---|---|
In-outs |
|
Further restriction: In the case of function blocks, no function blocks with a →generic data type are allowed. As a result of this restriction, you cannot use the following blocks as input of the current block: LIMITER_O, LIMITER_U, FORCEMRK, MAX_HOLD, MIN_HOLD, and →vendor-function blocks that have been declared with a generic data type. |
input value 1 |
|
Further restriction: In the case of function blocks, no function blocks with a →generic data type are allowed. As a result of this restriction, you cannot use the following blocks as input of the current block: LIMITER_O, LIMITER_U, FORCEMRK, MAX_HOLD, MIN_HOLD, and →vendor-function blocks that have been declared with a generic data type. |
input value 2 |
|
Inputs: |
|
|
value for initialization; default value = |
Return value: |
- |
|
|
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:
-
"Blocks for safe logic" whether this block is supported for developing safety-relevant applications.
-
"Highlighting safe logic in the FBD-editor" for the effects when using the block as a block for safe logic.
Internal error diagnostic for block
The block checks the value connected to the inputs before it is executed.
If the value for LEN
is > than the maximally possible size of the input values IN1
and IN2
, the output ENO
of the block is set to value FALSE
(or an equivalent).
Example for usage within ST-editor
|
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.