
MAC BEG macro2
MVR <axis> -12.5
WAC ONT? <axis> = 1
MAC END
MAC BEG macro3
MAC START macro1
MAC START macro2
MAC END
8.6.2
Running the Macros
Any commands can be sent from the command line while a macro is running on the
controller. The macro content and motion commands received from the command line can
overwrite each other.
It is not possible to run several macros simultaneously. Only one macro can be run at a time.
You can link the conditions for running the macro with the
and
commands. The
commands must be included in the macro.
A delay time for running the macro can be specified with
.
Variables can be used in macros. Setting is done via the
. Responses to query commands can be copied into variables with
and values can be added and saved to variables with
In the following, PITerminal or PIMikroMove's
Command entry
window is used to enter
commands.
1. If the macro should continue running despite an error: Set the Ignore Macro Error?
parameter (0x72) accordingly: Send the
SPA 1 0x72 Status
command where "Status"
can take the value 0 (stop macro on error [standard]) or 1 (ignore macro error).
2. Start the macro:
■
If the macro is to be run once, send the
where
"macroname" is the name of the macro.
■
If the macro is to be run n times, send the
MAC NSTART macroname n string
command where "macroname" is the name of the macro and "n" indicates the number
of times to be run.
Specifying "string" is optional and stands for the values of local variables. The values only
need to be specified when the macro contains corresponding local variables. The
sequence of the values in the input must correspond to the numbering of the appropriate
local variables, starting with the value of the local variable 1. The individual values must
be separated from each other by spaces.
3. If you want to check that the macro is running:
■
Query whether a macro is running on the controller by sending the
command.
■
Query the name of the macro currently running on the controller by sending the
command.
Example Macro: Moving an Axis with Variable Travel Range Back and Forth
The axis <axis> is to move back and forth. The travel to the left and to the right is to be
variably adjustable without having to change the macros used. Local and global variables
are therefore used.
Create the global variables LEFT and RIGHT by sending:
VAR LEFT 5
VAR RIGHT 15
LEFT therefore has the value 5, and RIGHT has the value 15. These values can be changed at
any time, e.g., by sending the
VAR
command again.
8 E-871.1A1N FUNCTIONS
PZ285EN
‒
1/30/2019
95
M O T I O N | P O S I T I O N I N G