7.2.3
S5 Application Program
As a prerequisite to the application program described below, the process input and output data on
a Simatic S5 must be at the peripheral addresses PW132, PW134 and PW136. This program
corresponds to a great extent to the S5 program from the previous application example.
Read access:
L PW 132
Read status word 1
L PW 134
Read speed actual value
L PW 136
Read apparent current actual value
Write access:
T PW 132
Write control word 1
T PW 134
Read speed setpoint
T PW 136
Write ramp
Fig. 50 shows the S5 program in this example. The current acceleration ramp is temporarily stored
in the flag word MW100 and the current deceleration ramp in MW102. If the
Enable command is
triggered (jump flag ENAB), the current acceleration ramp generator is first transferred from MW100
to PW136 (ramp) and the
Enable command is then transferred to the control word with the coding
0006hex. Similarly, when the
Stop command is given, the deceleration ramp generator is first
transferred from MW102 to PW136 (ramp) and the
Stop command is then transferred to the control
word with the coding 0002
hex
.
The process input data
Status Word 1, Speed Actual Value and Apparent Current Actual Value can
be processed with the load command (e.g. L PW 132).
OB1:
: SPA FB 10
NAME: SEW
: BE
cyclically
FB 10 :
: U E 1.3
: SPB = CCW
: L KF +5000 1000 1/min CW
: T PW 134 as speed setpoint
: SPA = CONT
LEFT : L KF -3750 750 1/min CCW
: T PW 134 as speed setpoint
:
CONT : U E 1.1
: U E 1.2 Control command
: SPB = ENAB Trigger enable
:
: UN E 1.1
: U E 1.2 Control command
: SPB = STOP Trigger stop
:
: UN E 1.2 Control command
: SPB = STOP Trigger rapid stop
: BEA
:
ENAB
: L KH 0006 Write enable
: T PW 132 to control word
: BEA
STOP
: L KH 0002 Write stop
: T PW 132 to control word
: BEA
STOP : L KH 0000 Write rapid stop
: T PW 132 to control word
: BE
: L MW 100 Write acceleration ramp
: T PW 136 from MW 100
: L MW 102 Write deceleration ramp
: T PW 136 from MW 102
00354AEN
Fig. 50: Example of an S5 program for control of the MOVITRAC
®
31.. inverter via the process data
7
Application Examples
MOVITRAC
®
31.. Fieldbus Unit Profile
65
Phone: 800.894.0412 - Fax: 888.723.4773 - Web: www.clrwtr.com - Email: [email protected]