110
96-8000 Rev AC
May 2010
Control Statements
Control statements allow the programmer to branch, both conditionally and
unconditionally. They also provide the ability to iterate a section of code based
on a condition.
Unconditional Branch (GOTOnnn and M99 Pnnnn)
In the Haas control, there are two methods of branching unconditionally. An un-
conditional branch will always branch to a specified block. M99 P15 will branch
unconditionally to block number 15. The M99 can be used whether or not mac
-
ros is installed and is the traditional method for branching unconditionally in
the Haas control. GOTO15 does the same as M99 P15. In the Haas control, a
GOTO command can be used on the same line as other G-codes. The GOTO
is executed after any other commands like M codes.
Computed Branch (GOTO#n and GOTO [expression])
Computed branching allows the program to transfer control to another line of
code in the same subprogram. The block can be computed as the program
is running, using the GOTO [expression] form. Or the block can be passed in
through a local variable, as in the GOTO#n form.
The GOTO will round the variable or expression result that is associated
with the Computed branch. For instance, if #1 contains 4.49 and GOTO#1 is
executed, the control will attempt to transfer to a block containing N4. If #1
contains 4.5, then execution will transfer to a block containing N5.
The following code skeleton could be developed to make a program that adds
serial numbers to parts:
O9200
(Engrave digit at current location.)
;
(D=Decimal digit to engrave);
IF [[#7 NE #0] AND [#7 GE O] AND [#7 LE 9]]
GOTO99;
#3000=1
(Invalid digit)
;
N99
#7=FIX[#7]
(Truncate any fractional part)
;
GOTO#7
(Now engrave the digit)
;
N0
(Do digit zero)
...
M99
;
N1
(Do digit one)
;
M99
;
N2
(Do digit two)
;
...
Содержание 96-8000
Страница 15: ...6 96 8000 Rev AC May 2010 Mill Warning Decals ...
Страница 16: ...7 96 8000 Rev AC May 2010 Safety Lathe Warning Decals ...
Страница 41: ...32 96 8000 Rev AC May 2010 ...
Страница 93: ...84 96 8000 Rev AC May 2010 ...
Страница 129: ...120 96 8000 Rev AC May 2010 ...
Страница 133: ...124 96 8000 Rev AC May 2010 ...
Страница 268: ......
Страница 269: ......