EasyManua.ls Logo

Omron NJ Series - Page 272

Omron NJ Series
668 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6-85
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-5 Programming Languages
6
6-5-3 Structured Text Language
Assignment
Overview:
This statement assigns the right side (i.e., the value of the expression) to the left side (i.e., the vari-
able).
Reserved Words:
:=
Combination of a colon (:) and an equals sign (=)
Statement Structure:
Application:
Use this statement to assign a value to a variable. For example, use it to set initial values or to store
the results of a calculation.
Description:
This statement assigns (or stores) the <expression_value> to the <variable>.
Example:
Example 1: The following statement assigns the result of the expression X+1 to variable A.
Example 2: The following statement assigns the value of variable B to variable A.
Example 3: The following statement assigns a value of 10 to variable A.
Precautions:
Either the source data type must match the destination data type, or the combination of data types
must allow implicit casting. A building error will occur if you do not use this notation.
If the value that is assigned is STRING data, make the size of the destination STRING variable
larger than that of the source string. Otherwise, an error will occur.
For STRING variables, assignment is allowed if the size of left-hand variable is greater than the
size of the text string stored in right-hand variable.
Example:
Assignment is allowed in the following case.
Variable Table:
User Program:
Var2 :='ABC';
ST Language Statements
<variable>:=<expression>;
<variable>:=<variable>;
<variable>:=<constant>;
A:=X+1;
A:=B;
A:=10;
Variable
name
Data type Size
Var1 STRING 10
Var2 STRING 20

Table of Contents

Other manuals for Omron NJ Series

Related product manuals