Yaskawa MP2000 Series: User's Manual for Motion Programming User Manual
Page 236
![background image](https://www.manualsdir.com/files/819957/content/doc236.png)
8.7 Data Comparisons
8-129
8
Command Reference
The conditional expressions that can be used with data comparison commands are as shown below.
(a) Bit Data Comparison
(b) Integer/Double Integer/Real Number Data Comparison
Format
• Use == (MATCH) command for data comparison.
• Specify a register on the left, and 0 or 1 on the right.
IF MB000000 == 0; "MB000000 = 0
IF MB000000 == 1; "MB000000 = 1
Operations in
Conditional
Expression
• &, |, ! (AND, OR, NOT) can be used.
IF (MB000000 & MB000001) == 1; "MB000000=1 AND MB000001=1
IF (MB000000 & !MB000001) == 1; "MB000000=1 AND MB000001=0
IF (MB000000 | MB000001) == 1; "MB000000=1 OR MB000001=1
IF (MB000000 | !MB000001) == 1; "MB000000=1 OR MB000001=0
Syntax
Error
Examples
• When <> (MISMATCH) is used:
IF MB000000 <> 0; => Syntax error
• When a numerical value is specified on the left, and a register on the right:
IF 1 == MB000000;
=> Syntax error
IF MB000000 == MB000001;
=> Syntax error
• No data comparison command:
IF MB000000; => Syntax error
IF (0);
=> Syntax error
• When more than one data comparison command is used:
IF (MB000000 == 0) & (MB000001 == 1); => Syntax error
Format
• All data comparison commands (==, <>, >, <, >=, <=) can be used.
• Specify a register either on the left or right.
IF MW00000 == 3; "MW00000 = 3
IF ML00000 <> ML00002; "ML00000
≠ ML00002
IF 1.23456 >= MF00000; "1.23456
≥ MF00000
Operations in
Conditional
Expression
• Arithmetic operations and logic operations can be used.
IF MW00000 == (MW00001/3); "MW00000 = (MW00001
÷ 3)
IF (ML00000 & F0000000H) <> ML00002; "(ML00000
∧ F0000000H) ≠ ML00002
IF 1.23456 >= (MF00000 * MF00002); "1.23456
≥ (MF00000 × MF00002)
Syntax Error
Examples
• When a constant is specified both on the left and right:
IF 0 == 3;
=> Syntax error
IF (3.14*2*1000) > 9000.0; => Syntax error
• No data comparison command:
IF MW000000; => Syntax error
IF (-1);
=> Syntax error
• When more than one data comparison command is used:
IF (MW00000 < 0) & (MW000001 > 0); => Syntax error