30
12.3.3 Loop (WHILE statement)
Format:
WHILE [conditional expression] DO m; (m = 1,2,3)
…
END m;
Specifies the conditional expression after WHILE.
If and when the specified conditional expression is satisfied, program execution from DO to END; If the
specified conditional expression is not satisfied, program execution END block behind.
1. The label can be used repeatedly.
2. DO range cannot cross.
3. DO loops can be nested three.
12.3.4 User Macro
Although the routine processing operations for the preparation of the same program is very useful, but the
user by allowing the use of macro variables, arithmetic and logic operations, and conditional branches, making the
preparation of the same machining operation procedures more convenient and easier. Machining operations can be
compiled for the same general procedure, such as cavity machining macro and fixed cycle macro processing.
When used, the processing program can be used with a simple command in the user macro, and call the subroutine
exactly the same.
12.4 Variables
General machining program directly with the value of the specified G code and the travel distance,
Representations of Variables:
Computer allows the use of variable names, custom macro can not. Variables with variable sign (#) and a
variable number is specified behind.
For example: # 1
Expression can be used to specify a variable number. In this case, the expression must be enclosed in
parentheses.
For example: # 1 + # # [2-12]
Variable type:
When you define a variable value in the program, the decimal point can be omitted.
Example: When defining # 1 = 123; the actual value of variable # 1 is 123.000.
Variable references:
In order to use the variable value in the program, followed by a variable number of the specified address.
When specifying variables expression, put the expression in parentheses.
For example:
G01X [# 1 + # 2] F # 3;
Reference variable value is automatically rounded according to the minimum unit addresses.
For example:
When G00X # 1; when 1 / 1000mm unit implemented, CNC regards to 12.3456 assigned to the variable # 1,
the actual command value G00X12.346.
Changing references symbolic value, should minus sign (-) in front of # of.
For example: G00X- # 1;
When referencing undefined variables, variables and address word are ignored.
For example: When the value of variable # 1 is 0, and the variable # 2 is empty, the execution result G00X #
1Y # 2 of G00X0.