Sample Programs for the Position Module
The first sample program shows a simple relative move that uses the POSx_CTRL and
POSx_GOTO instructions to perform a cut-to-length operation. This program does not require an
RP seek mode or a motion profile, and the length can be measured in either pulses or engineering
units. Enter the length (VD500) and target speed (VD504). When I0.0 (Start) turns on, the
machine starts. When I0.1 (Stop) turns on, the machine finishes the current operation and stops.
When I0.2 (E_Stop) turns on, the machine aborts any motion and immediately stops.
The second sample program provides an example of the POSx_CTRL, POSx_RUN,
POSx_RSEEK, and POSx_MAN instructions. You must configure the RP seek mode and a
motion profile.
Sample Program 1: Simple Relative Move (Cut to Length application)
Open Loop Motion Control with the S7-200
Network 1
//Control instruction (module in slot 0).
LD
SM0.0
=
L60.0
LDN
I0.2
=
L63.7
LD
L60.0
CALL
POS0_CTRL, L63.7, M1.0, VB900,
VD902, VD906, V910.0
Network 2
//Start puts machine into
//automatic mode
LD
I0.0
AN
I0.2
EU
S
Q0.2, 1
S
M0.1, 1
Network 3
//E_Stop: stops immediately and
//turns off automatic mode.
LD
I0.2
R
Q0.2, 1
Network 4
//Move to a certain point:
//Enter the length to cut.
//Enter the target speed into Speed.
//Set the mode to 1 (Relative mode).
LD
Q0.2
=
L60.0
LD
M0.1
EU
=
L63.7
LD
L60.0
CALL
POS0_GOTO, L63.7, VD500, VD504,
1, I0.2, Q0.4, VB920, VD922, VD926
Network 5
//When in position, turn on the cutter
//for 2 seconds to finish the cut.
LD
Q0.2
A
Q0.4
TON
T33, +200
AN
T33
=
Q0.3
Chapter 9
285