Structure Of St And Example; Operators - Omron NX1P Programming Manual

Machine automation controller
Table of Contents

Advertisement

6-1-3

Structure of ST and Example

Using general expressions, ST programming requires no special knowledge.
Remember the following two rules:
(1) Use a colon and an equals sign (:=) to assign a value to a variable.
(2) Statements must end with a semicolon (;).
Example
An example of the statement to calculate the distance between two points using Pythagoras'
theorem is shown below.
Just apply the formula.
������������ = � (���� − ����)
■ Formula
■ ST program
Length := SQRT((X1-X0)**2+(Y1-Y0)**2);
* SQRT: Square Root
6-1-4

Operators

Operator
()
-, +
NOT
**
*
/
MOD
+
-
<, >, <=, >=
=
<>
&, AND
XOR
OR
+ (���� − ����)
��
Operation
First priority
Sign
Logical NOT
Exponent
Multiplication
Division
Remainder
Addition
Subtraction
Comparison
Matches
Does not match
Logical AND
Logical exclusive OR
Logical OR
��
Notation example
Value := (1+2)*(3+4);
+100, -100
Value := NOT TRUE;
Value := 2**8;
Value := 8*100;
Value := 200/25;
Value := 10 MOD 6;
Value := 200+25;
Value := 200-25;
Value := 60>10;
Value := 8=7;
Value := 8<>7;
Value := 2#1001 AND 2#1100;
Value := 2#1001 XOR 2#1100;
Value := 2#1001 XOR 2#1100;
Priority
// Value is 21
1
2
// Value is FALSE
// Value is 256
3
// Value is 800
// Value is 8
4
// Value is 4
// Value is 225
5
// Value is 175
// Value is TRUE
6
// Value is FALSE
7
// Value is TRUE
// Value is 2#1000
8
// Value is 2#0101
9
// Value is 2#1101
10
99

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents