Insert String (INSERT)
Use the INSERT instruction to add ASCII characters to a specified location within a string.
The INSERT instruction adds the characters in Source B to a designated position within Source A and places the result in the Destination.
- Start defines where in Source A that Source B is added.
Unless Source A and the Destination are the same tag, Source A remains unchanged.
Available Languages
Ladder Diagram
FactoryTalk Design Studio
DSL - Ladder DiagramINSERT (SourceA,SourceB,Start,Dest);
Operands
There are data conversion rules for mixed data types within an instruction. See Data Conversion. The INSERT instruction uses the following operands.
Ladder Diagram
Operand | Type | Format | Description | Notes |
---|---|---|---|---|
Source A | String type | Tag | String to add the characters to | String types are default STRING data types or any new string types you create |
Source B | String type | Tag | String containing the characters to add | |
Start | SINT DINT | Immediate tag | Position in Source A to add the characters | Enter a number between 1 and the DATA size of the Source. |
Destination | String type | Tag | String to store the result |
Affects Math Status Flags
No
Major/Minor Faults
Type | Code | Cause | Recovery Method |
---|---|---|---|
4 | 51 | The LEN value of the string tag is greater than the DATA size of the string tag. |
|
4 | 56 | The Start or Quantity value is invalid. | Check that the Start value is between 1 and the DATA size of the Source. |
Execution
Ladder Diagram
Condition | Ladder Diagram Action |
---|---|
Prescan | The rung-condition-out is set to false. |
Rung-condition-in is false | The rung-condition-out is set to false. |
Rung-condition-in is true | The instruction executes.
The rung-condition-out is set to true. |
Postscan | The rung-condition-out is set to false. |
Example
When
temp_high
is set, the INSERT instruction adds the characters in string_2
to position 2 within string_1
and places the result in string_3
.Ladder Diagram
Provide Feedback