NCT Group 2000M, 99M manual Format of Custom Macro Body, Variables of the Programming Language

Models: 2000M 99M

1 206
Download 206 pages 27.56 Kb
Page 172
Image 172

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 re-writing the appropriate common variables.

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; #[#120-4] means that the referred variable number is obtained by subtracting 4 from the

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 ("–") or operator I can, wherever it is permissible with numerical values, be used even when a reference is made to a variable after an address. For example,

G#102

if #102=1.0, this reference is equivalent to G1

XI–#24

if #24=135.342, this reference is equivalent to XI–135.342

172

Page 172
Image 172
NCT Group 2000M, 99M manual Format of Custom Macro Body, Variables of the Programming Language, Identification of a Variable