PROGRAMMING16. CUSTOM MACRO
In a program, the flow of control can be changed using the GOTO
statement and IF statement. Three types of branch and repetition
operations are used:
Branch and repetition GOTO statement (unconditional branch)
IF statement (conditional branch: if ..., then...)
WHILE statement (repetition while ...)
A branch to sequence number n occurs. When a sequence number outside
of the range 1 to 99999 is specified, alarm No. 128 occurs. A sequence
number can also be specified using an expression.
GOTO n ;
n: Sequence number (1 to 99999)
Specify a conditional expression after IF. If the specified conditional
expression is satisfied, a branch to sequence number n occurs. If the
specified condition is not satisfied, the next block is executed.
IF [#1 GT 10] GOTO 2 ;
N2 G00 G91 X10.0 ;
If the value of variable #1 is greater than 10, a branch to sequence number
If the condi-
tion is not sa-
Processing If the condition is satisfied
If the specified conditional expression is satisfied, a predetermined macro
statement is executed. Only a single macro statement is executed.
IF [#1 EQ #2] THEN#3=0 ;
If the values of #1 and #2 are the same, 0 is assigned to #3.
A conditional expression must include an operator inserted between two
variables or between a variable and constant, and must be enclosed in
brackets ([, ]). An expression can be used instead of a variable.
D Conditional expression