EasyManua.ls Logo

Omron NJ Series - Page 270

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-83
6 Programming
NJ-series CPU Unit Software User’s Manual (W501)
6-5 Programming Languages
6
6-5-3 Structured Text Language
Precautions for Correct UsePrecautions for Correct Use
The intended operation may not occur if a function is nested under itself. Always separate the
functions into different statements as shown below.
Example of incorrect notation: out := MyFunc( In1:=x1, In2:=MyFunc( In1:=x2, In2:=x3 ) );
Example of correct notation: temp := MyFunc( In1:=x2, In2:=x3 );
out := MyFunc( In1:=x1, In2:=temp );
Addition + 100+200
Value: 300
6
Subtraction 100-200
Value: 100
Comparison <, >, <=, >= 100<200
If the comparison result is TRUE, the value is set to TRUE.
Otherwise, the value is set to FALSE. In the above exam-
ple, 100 is less than 200, so the value is TRUE.
7
Matches = 100=200
If the two values match, the value is set to TRUE. Other-
wise, the value is set to FALSE. In the above example, 100
does not equal 200, so the value is FALSE.
8
Does not match < > 100<>200
If the two values do not match, the value is set to TRUE.
Otherwise, the value is set to FALSE. In the above exam-
ple, 100 does not equal 200, so the value is TRUE.
Logical AND AND,& Applies 1-bit AND logic to all bits.
The results of 1-bit AND logic are as follows:
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1
0101 AND 1100
Value: 0100
9
Logical exclusive
OR
XOR Applies 1-bit exclusive OR logic to all bits.
The results of 1-bit exclusive OR logic are as follows:
0 XOR 0 = 0
0 XOR 1 = 1
1 XOR 0 = 1
1 XOR 1 = 0
0101 XOR 1100
Value: 1001
10
Logical OR OR Applies 1-bit OR logic to all bits.
The results of 1-bit OR logic are as follows:
0 OR 0 = 0
0 OR 1 = 1
1 OR 0 = 1
1 OR 1 = 1
0101 OR 1100
Value: 1101
11
Operation Operator Notation example and evaluated value Priority

Table of Contents

Other manuals for Omron NJ Series

Related product manuals