Wire EDM Machine Operation Chapter 10
Copyright November, 98 Page 10-4 Sodick Inc.
N005 G54
N010 G92 X.5 Y-.25
N015 G90
N020 C[H000]
N025 G42 H[H001]
In block number N020, the C word is specified by a variable. Whatever condition number
was passed to the Q routine would be placed in H000 and this value is being referenced
in the Q routine in block number N020. Notice the brackets around the H000 in block
N020. These are NOT parentheses. They are square corner brackets. The keyboard on
your control has these characters. The brackets MUST isolate the H words being
referenced in the Q routine. In this manner the control will add the value which was
transferred into H000 to the C code called.
In block number N025, the offset being set by the second variable (H001) will be passed
from the call statement into the program. Please note that brackets are not really
necessary because the H word by default is the offset word, so the block could really be
G42 H001.
ARITHMETIC IN A Q ROUTINE
Another feature of Q routine techniques is that you have the ability to do arithmetic
calculations right in the Q routine. This means that by using arithmetic with the variables
being passed, you can create a general purpose Q routine that will behave differently each
time it is called (when different variables are passed.)
Arithmetic calculations are used primarily to calculate axis coordinates and radius values.
ALL arithmetic calculations MUST be enclosed in square brackets [ ].
Here is an example of a command that includes a calculation with variables:
G01 X[H000 / 2]
This command would cause the wire to cut to a position in X of half of whatever value is
stored in variable number H000. You can also combine arithmetic calculations in one
command. For example, say the current value of H000 is 5000 (.5 inch) and H001 is
currently set to 10000 (1 inch). See if you can evaluate the result of this command:
X-[[H001/2]-[H000/2]]
The priority of any combined arithmetic expression is like that of any calculator. That is,
anything in brackets will be done first, then multiplication and division, and last, addition
and subtraction.
In the above command, first the value of H001 (10000) would be divided by two (result =