![](/images/new-backgrounds/1256769/256769343x1.webp)
20 Custom Macro
20.10 Format of Custom Macro Body
The program format of a user macro is identical with that of a subprogram: O(program number)
:
commands
:
M99
The program number is irrelevant, but the program numbers between O9000 and O9034 are reversed for special calls.
20.11 Variables of the Programming Language
Variables instead of specific numerical values can be assigned to the addresses in the main programs, subprograms and macros. A value can be assigned to each variable within the permissible range. The use of variables will make for much more flexible procedures of programming.
The appropriate data can be parametrized by the use of common variables in the main programs and subprograms, thus it will not be necessary to write new programs for similar work parts of different size. Instead, the operator can change to new part of different size by
The use of variables can make a macro much more flexible than a conventional subprogram. Whereas arguments cannot be transferred to a subprogram, arguments can be attached to a macro through the local variables.
20.11.1 Identification of a Variable
A number of variables can be used, and each will be identified by its number. A variable is composed of the code # and a number. For example,
#12
#138
#5106
A formula may also be used to make reference to variable - #[<formula>] For example,
#[#120] means that variable 120 contains the serial number of variable that is referred to;
number contained in the variable.
20.11.2 Referring to a variable
The various addresses in the words of a program block can assume values of variables as well as numerical values. The minus sign
G#102 | if #102=1.0, this reference is equivalent to G1 |
if #24=135.342, this reference is equivalent to |
172