EasyManua.ls Logo

Haas 96-8000 - Conditional Branch (if and M99 Pnnnn)

Haas 96-8000
269 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...
111
96-8000 Rev AC
May 2010
Programming
;
(etc.,...)
With the above subroutine, you would engrave digit ve with the following call:
G65 P9200 D5;
Computed GOTOs using expression could be used to branch processing
based on the results of reading hardware inputs. An example might look like
the following:
GOTO [[#1030*2]+#1031];
NO (1030=0, 1031=0);
...
M99;
N1 (1030=0, 1031=1);
...
M99;
N2 (1030=1, 1031=0);
...
M99;
N3 (1030=1, 1031=1);
...
M99;
The discrete inputs always return either 0 or 1 when read. The GOTO [expres-
sion] will branch to the appropriate line of code based on the state of the two
discrete inputs #1030 and #1031.
Conditional Branch (IF and M99 Pnnnn)
Conditional branching allows the program to transfer control to another section
of code within the same subroutine. Conditional branching can only be used
when macros are enabled. The Haas control allows two similar methods for ac-
complishing conditional branching.
IF [<conditional expression>] GOTOn
As discussed, <conditional expression> is any expression that uses any of
the six Boolean operators EQ, NE, GT, LT, GE, or LE. The brackets surround-
ing the expression are mandatory. In the Haas control, it is not necessary to
include these operators. For example: IF [#1 NE 0.0] GOTO5; could also be: IF
[#1] GOTO5;
In this statement, if the variable #1 contains anything but 0.0, or the undened
value #0, then branching to block 5 will occur; otherwise, the next block will be
executed.
In the Haas control, a conditional expression can also be used with the M99
Pnnnn format. For example:
G0 X0 Y0 [#1EQ#2] M99 P5;

Table of Contents

Related product manuals