84
Macros
96-8000 rev R June 2007
Useful G and M Codes
M00, M01, M30 - Stop Program
G04 - Dwell
G65 Pxx - Macro subprogram call. Allows passing of variables.
M96 Pxx Qxx - Conditional Local Branch when Discrete Input Signal is 0
M97 Pxx - Local Sub Routine Call
M98 Pxx - Sub Program Call
M99 - Sub Program Return or Loop
G103 - Block Lookahead Limit. No cutter comp allowed
M109 - Interactive User Input (see “M Codes” section)
Settings
There are 3 settings that can affect macro programs (9000 series programs), these are 9xxxx progs Lock (#23),
9xxx Progs Trace (#74) and 9xxx Progs Single BLK (#75).
Lookahead
Lookahead is an issue of great importance to the macro programmer. The control will attempt to process as many
lines as possible ahead of time in order to speed up processing. This includes the interpretation of macro variables.
For example,
#1101=1
G04 P1.
#1101=0
This is intended to turn an output ON, wait 1 second, and then turn it off. However, lookahead will cause the output
to turn on then immediately back off while the dwell is being processed. G103 P1 can be used to limit lookahead to
1 blocks. To make this example work properly, it must be modified as follows:
G103 P1 (See the G-code section of the manual for a further explanation of G103)
;
#1101=1
G04 P1.
;
;
;
#1101=0
Round Off
The control stores decimal numbers as binary values. As a result, numbers stored in variables can be off by 1 least
significant digit. For example, the number 7 stored in macro variable #100 may later be read as 7.000001, 7.000000,
or 6.999999. If your statement was, “IF [#100 EQ 7]…”, it may give a false reading. A safer way of programming this
would be, “IF [ROUND [#100] EQ 7]…”. This issue is usually only a problem when storing integers in macro vari-
ables where you do not expect to see a fractional part later.
OPERATION NOTES
Macro variables can be saved or loaded through the RS-232 or the optional floppy drive, much like settings, and
offsets. Refer to the “Loading Programs to the Control” section.
Variable Display Page
The macro variables are displayed and can be modified through the current commands display. To get to the pages,
press CURNT COMDS and use the page up/down key.
As the control interprets a program, the variable changes are displayed on the variable display page and results can
be viewed.
The macro variable is set by entering a value and then pressing the Write/Enter button. Macro Variables can be
cleared by pressing the Origin key, this will clear all variables.