CONCAT block
Short summary
Name |
CONCAT |
→POU type |
|
Category |
|
Conform to →IEC-standard |
currently restricted
|
Graphical interface |
|
Available since |
version 1.31.0 for logi.CAD 3) |
Functionality
The block concatenates (combines) partial strings to a new string. Enter the partial strings at the corresponding inputs.
logi.CAD 3 determines the character positions within a string as follows: 1, 2, ..., n. 1 corresponds to the leftmost character position and n to the length of the string.
Three-character combination of the dollar sign ($) followed by two hexadecimal digits are evaluated as single character. Example: The string '$B15' (corresponds to '±5') consists of 2 characters. See →character string literal for more examples for those combinations.
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
IN1 |
STRING |
1st value |
IN2 |
STRING |
2nd value |
|
... (extensible until) |
|||
IN16 |
STRING |
16th value |
|
Return value: |
– |
STRING |
|
Input EN and output ENO are available when →calling
the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
Internal error diagnostic for block
The block checks the would-be return value.
If the return value cannot be mapped in the available memory (the return value is too large), the output ENO of the block is set to value FALSE (or an equivalent). When you are using nested blocks with STRING values, observe that the memory for STRING values is restricted (see "In case of nested string blocks: How can the return value be entirely mapped ?" for details and examples).
The following special case might occur regarding this error case: If the result of the call is assigned to a variable that is used as input parameter for the call of this block as well (see the following example), the output ENO of the embracing →POU is set to value FALSE for this error case (but not the output ENO of the called block). Example: ResultString := CONCAT(IN1 := 'a', IN2 := ResultString);
Example for usage within ST-editor
PROGRAM Test
VAR
result1, result2 : STRING[
20
];
result3 : STRING[
10
];
CheckENO1, CheckENO2, CheckENO3 : BOOL;
END_VAR
result1 := CONCAT(IN1 :=
'any'
, IN2 :=
' st'
, IN3 :=
'ring'
, ENO => CheckENO1);
(* The variable
'result1'
evaluates to <
'any string'
>. The variable
'CheckENO1'
evaluates to
'TRUE'
. *)
result2 := CONCAT(IN1 :=
'Deviation: '
, IN2 :=
'$B15'
, ENO => CheckENO2);
(* The variable
'result2'
evaluates to <
'Deviation: $B15'
>. The variable
'CheckENO1'
evaluates to
'TRUE'
. *)
result3 := CONCAT(IN1 :=
'an'
, IN2 :=
'other value'
, ENO => CheckENO3);
(* The variable
'result3'
evaluates to <
'another va'
>. The variable
'CheckENO3'
evaluates to
'FALSE'
. Reason:
'result3'
is declared with length
'10'
and the would-be
return
value exceeds
this
length. *)
END_PROGRAM
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.