Assign an ascii character to a string, Expressions – Rockwell Automation Logix5000 Controllers Structured Text Programming Manual User Manual

Page 13

Advertising
background image

Publication 1756-PM007D-EN-P - November 2012

13

Program Structured Text Chapter 1

Assign an ASCII Character to a String

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.

To add or insert a string of characters to a string tag, use either of these ASCII
string instructions.

Expressions

An expression is a tag name, equation, or comparison. To write an expression,
use any of these elements.

Tag name that stores the value (variable)

Number that you enter directly into the expression (immediate value)

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
ensures that the expression executes in the desired sequence.

This is OK

This is not OK

string1.DATA[0]:= 65;

string1.DATA[0] := A;

string1.DATA[0]:= string2.DATA[0];

string1 := string2;

To

Use this instruction

Add characters to the end of a string

CONCAT

insert characters into a string

INSERT

IMPORTANT

You may add user comments inline. Therefore, local language
switching does not apply to your programming language.

Advertising