9 6
Macros
96-8000 rev R June 2007
Logical Operators
Logical operators are operators that work on binary bit values. Macro variables are floating point numbers. When
logical operators are used on macro variables, only the integer portion of the floating point number is used. The
logical operators are:
OR - logically OR two values together
XOR - Exclusively OR two values together
AND - Logically AND two values together
Examples:
#1=1.0; 0000 0001
#2=2.0; 0000 0010
#3=#1 OR #2
0000 0011
Here the variable #3 will contain 3.0 after the OR operation.
#1=5.0;
#2=3.0;
IF [[#1 GT 3.0] AND [#2 LT 10]] GOTO1
Here control will transfer to block 1 because #1 GT 3.0
evaluates to 1.0 and #2 LT 10 evaluates to 1.0, thus 1.0 AND
1.0 is 1.0 (TRUE) and the GOTO occurs.
Note that care must be taken when using logical operators so that the desired result is achieved.
Boolean Operators
Boolean operators always evaluate to 1.0 (TRUE) or 0.0 (FALSE). There are six Boolean operators. These operators
are not restricted to conditional expressions, but they most often are used in conditional expressions. They are:
EQ - Equal to
NE - Not Equal to
GT - Greater Than
LT - Less Than
GE - Greater than or Equal to
LE - Less Than or Equal to
The following are four examples of how Boolean and Logical operators can be used:
Example
Explanation
IF [#1 EQ 0.0] GOTO100;
Jump to block 100 if value in variable #1 equals 0.0.
WHILE [#101 LT 10] DO1;
While variable #101 is less than 10 repeat loop DO1..END1.
#1=[1.0 LT 5.0];
Variable #1 is set to 1.0 (TRUE).
IF [#1 AND #2 EQ #3] GOTO1
If variable #1 logically ANDed with variable #2 is equal to the
value in #3 then control jumps to block 1.
Expressions
Expressions are defined as any sequence of variables and operators surrounded by the square brackets “[“ and “]”.
There are two uses for expressions: conditional expressions or arithmetic expressions. Conditional expressions
return FALSE (0.0) or TRUE (any non zero) values. Arithmetic expressions use arithmetic operators along with
functions to determine a value.
Conditional Expressions
In the HAAS control, ALL expressions set a conditional value. The value is either 0.0 (FALSE) or the value is nonzero
(TRUE). The context in which the expression is used determines if the expression is a conditional expression.
Conditional expressions are used in the IF and WHILE statements and in the M99 command. Conditional expres-
sions can make use of Boolean operators to help evaluate a TRUE or FALSE condition.
Summary of Contents for Mill
Page 12: ...96 8000 rev R June 2007 Safety 5 ...
Page 14: ...96 8000 rev R June 2007 Safety 7 LATHE WARNING DECALS ...
Page 15: ...8 Safety 96 8000 rev R June 2007 ...
Page 17: ...10 Introduction 96 8000 rev R June 2007 ...
Page 117: ...110 4 5 Axis Programming 96 8000 rev R June 2007 ...
Page 199: ...Settings 192 96 8000 rev R June 2007 ...