
Create the global variables again each time that the E-871.1A1N is switched on or rebooted,
since they are only written to the volatile memory of the E-871.1A1N.
Record the MOVLR macro by sending:
MAC BEG movlr
MAC START movwai ${LEFT}
MAC START movwai ${RIGHT}
MAC END
MOVLR successively starts the MOVWAI macro (which is still to be recorded) for both
directions of motion. The values of the global variables LEFT and RIGHT are used when
MOVWAI is started, to set the value of the local variable 1 contained in MOVWAI (dollar signs
and braces are necessary for the local variable 1 in the macro to actually be replaced by the
value of the global variable and not by its name).
Record the MOVWAI macro by sending:
MAC BEG movwai
MOV <axis> $1
WAC ONT? <axis> = 1
MAC END
MOVWAI moves axis <axis> to the target position which is specified by the value of the local
variable 1 and waits until the axis has reached the target position.
Start the execution of the MOVLR macro by sending:
MAC NSTART movlr 5
The MOVLR macro is executed five times in succession, i.e., axis <axis> alternately moves to
the positions 5 and 15 five times. You can also select any other value for the number of
executions.
Example macro: Realizing multiple calls of a macro in a loop
The TESTDION macro checks the status of the digital input lines on the I/O socket. It uses a
local variable to identify the digital input line (1 to 4). A further macro is recorded with a loop
so that the TESTDION macro does not have to be called separately for each input line.
Record the LOOPDION macro by sending:
MAC BEG loopdion
VAR COUNTER 1
MAC START TESTDION ${COUNTER}
ADD COUNTER ${COUNTER} 1
JRC -2 VAR? COUNTER < 5
MAC END
The COUNTER variable is created with the value 1. After this, the TESTDION macro is started
for the input line whose identifier is specified via the COUNTER variable. Then the value of
the COUNTER is increased by 1. As long as the value of the COUNTER is less than 5, the
macro line pointer subsequently jumps 2 lines back, so that TESTDION can be started for the
next digital input line.
8.6.3
Stopping the Macros
Stopping the macro can be linked to a condition with the
command. The command
must be included in the macro.
1. Stop the macro with the
2. If you want to check whether an error occurred while the macro was running, send the
command. The response shows the last error that has occurred.
8 E-871.1A1N FUNCTIONS
PZ285EN
‒
1/30/2019
96
M O T I O N | P O S I T I O N I N G