Overview of Structured Text Programming
638 Rockwell Automation Publication MOTION-RM002H-EN-P-February 2018
Assign an ASCII character to a string data member
Use the assignment operator to assign an ASCII character to an element of the
DATA member of a string tag. To assign a character, specify the value of the
character or specify the tag name, DATA member, and element of the character.
For example:
This is OK This is not OK
string1.DATA[0] := 65; string1.DATA[0] := A;
string1.DATA[0]:= string2.DATA[0]; string1 := string2;
Tip: This assigns all content of string2 to string1
instead of just one character.
To add or insert a string of characters to a string tag, use either of these ASCII
string instructions:
To Use this instruction
Add characters to the end of a string CONCAT
Insert characters into a string INSERT
See also
Structured Text Components: Expressions on page 638
Character string literals on page 646
An expression is a tag name, equation, or comparison. To write an expression, use
any of the following:
• Tag name that stores the value (variable)
• Number that you enter directly into the expression (immediate value)
• String literal that you enter directly into the expression (CompactLogix
5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix
5380, and GuardLogix 5580 controllers only)
• Functions, such as: ABS, TRUNC
• Operators, such as: +, -, <, >, And, Or
As you write expressions, follow these general rules:
• Use any combination of upper-case and lower-case letter. For example, these
three variations of "AND" are acceptable: AND, And, and.
• For more complex requirements, use parentheses to group expressions
within expressions. This makes the whole expression easier to read and
Components: Expressions