S5 To S7 Conversion Tips V1
S5 To S7 Conversion Tips V1
CONVERSION
A Compilation of Tips, Tricks &
FAQs
Version - V1.0
Compiled By
1. INDEX
Contents
Page
1.
Index
2.
Introduction
3.
Binary Commands
4.
Arithmetic Operations
5.
Counters
6.
Timers
10
7.
Linking Operations
11
8.
String Data
13
9.
Conversion of Blocks
14
10.
Analog Values
18
11.
21
12.
23
2.
INTRODUCTION
SIMATIC S5 has been a workhorse for the Industrial Automation for Decades. Even though it was
phased out more than 10 years ago, it is still popular among users.
There are still many SIMATIC-S5 systems running in various industries and are gradually being
converted to SIMATIC S7. Siemens has provided us with a Manual on S5 to S7 conversion tool,
which is installed as a part of the STEP7 Installation. This Manual can be downloaded from the
following link :
http://support.automation.siemens.com/WW/view/en/45531547
However there are many more Tips, Tricks and FAQs scattered around the Support Portal which are
quite useful for anyone who has to convert a SIMATIC-S5 system to a SIMATIC-S7 system.
This is a compilation of many of these FAQs in one document to serve as a comprehensive guide for
the programmers.
This is the First version of the Document intended for free circulation among programmers.
We intend to keep updating the document from time to time. Suggestions and advise for the same is
welcome.
Release Data :
1
Version - V1.0
Initial Release
3.
BINARY COMMANDS
The table below gives a list of STEP5 commands and the equivalent commands that you must use in
STEP7 when programming an S7-300/400. This table is designed to act as a link to your STEP5 know-how
when creating a STEP7 Program
Flag
Bit memory
Digital inputs
Digital inputs
Digital outputs
Digital output
DBX
An operand on a memory
An operand on a memory
area that is controlled via
the DB2 tab.
Position
IN
Input parameter
IN_OUT
Through parameter
OUT
Output parameter
Temporary variable
STEP5
Operation
STEP7
Permissible
operand
Operation
Permissible
operand
I,Q,F,L,DBX,DIX,IN,
Query at "1"
I,Q,F,D
Query at "0"
QN
I,Q,F,D
QN
F 1.0
F 1.0
F 1.1
F 1.1
F 1.2
NOT
QN
F 1.2
I,Q,F,D
IN_OUT
I,Q,F,L,DBX,DIX,IN,
IN_OUT
F 1.2
I,Q,F,L,DBX,DIX,IN,
IN_OUT
PY1
PIB 1
IB1
IB 1
I 1.0
I 1.0
PY1
PIB 1
IB1
IB 1
QN
I 1.0
QN
I 1.0
I,Q,F,D
Q 1.0
Q 1.0
QB 1
QB 1
T PY 1
TQB 1
F 1.0
F 1.0
I,Q,F,L,DBX,DIX,OUT
IN_OUT,stat,temp
R
I,Q,F,D
I,Q,F,L,DBX,DIX,OUT,
IN_OUT
Q 1.0
Q 1.0
Q 1.0
Q 1.0
QB 1
QB 1
PY 1
PQB 1
Q
Q
=
Q
R
QN
S
I 1.0
F 1.0
F 1.1
F 1.1
F 1.0
I 1.0
F 1.0
Q
FP
=
I 1.0
F 1.0
F 1.1
I,Q,F,D
Trailing edge
(example: F2.1 is one cycle long "1"
Q
Q
=
Q
R
Q
S
I 2.0
F 2.0
F 2.1
F 2.1
F 2.0
I 2.0
F 2.0
I,Q,F,D
F,DIX
Q
FN
=
I 2.0
F 2.0
F 2.1
F,DIX
4.
ARITHMETIC OPERATIONS
Table 01 - Operands in STEP 5 and STEP 7.
Operands in STEP 5
Operands in STEP 7
Markers (MB,MW,MD)
Markers (MB,MW,MD)
Input (IB,IW,ID)
Input (IB,IW,ID)
Output (QB,QW,QD)
Output (QB,QW,QD)
DW
DBW
DIW
IN
Input parameter of an FC or FB
IN_OUT
In-out parameter of an FC or FB
OUT
Output parameter of an FC or FB
DIX
Data bit
Table 02 - Comparison operations in STEP 5 and their STEP 7 equivalents in the STL programming
language.
Function description
Operations in STL
STEP 5
STEP 7
<Operand> <Operand>
Transfer content of ACCU 1 into target address (byte, word or double
word).
<Operand> <Operand>
Compare two fixed point numbers (16 bit) for "equal to". If ACCU 2 is equal
!=F
==I
><F
<>I
>F
>I
<F
<I
to ACCU 1, RLO=1.
Compare two fixed point numbers (16 bit) for "not equal to". If ACCU 2 is
not equal to ACCU 1, RLO=1.
Compare two fixed point numbers (16 bit) for "greater than". If ACCU 2 is
greater than ACCU 1, RLO=1.
Compare two fixed point numbers (16 bit) for "less than". If ACCU 2 is less
than ACCU 1, RLO=1.
Compare two fixed point numbers (16 bit) for "greater than or equal to". If
>=F
>=I
<=F
<=I
!=G
==R
><G
<>R
>G
>R
<G
<R
>=G
>=R
<=G
<=R
!D
==D
><D
<>D
>D
>D
<D
<D
>=D
>=D
<=D
<=D
Table 03 - Operations for calling blocks, closing blocks and jumping to jump labels in STEP 5 and the
equivalents in STEP 7. The jump statements in STEP 7 can be cross-network and the distance between
jump source and jump destination can be greater than 128 statements in STEP 7.
Function description
Operations in STL
STEP 5
STEP 7
SPA <Operand>
CALL <Operand>
U <Operand>
U <Operand>
SPB <Operand>
BEA
BEA
BEB
BEB
BE
BE
SPB =M001
SPB M001
(cross-network, no
network).
limits)
(RLO=1).
Block termination (completion of a
block)
Jump to jump label.
M001: NOP 0
Function description
Operations in STL
STEP 5
STEP 7
+F
+I
-F
-I
xF
*I
:F
/I
+G
+R
-G
-R
xG
*R
:G
/R
+D
+D
-D
-D
xD
*D
:D
/D
5.
COUNTERS
The following table lists the command sequences for counters under STEP 5 and their equivalents in
STEP7
STEP5
STEP7
Operation
Operand
Operation
Operation
Pure up
I 2.2
I 2.2
counter
CU
C6
CU
C6
I 2.5
I 2.5
C6
C6
Up counter,
I2.2
I2.2
down counter
CU
C6
CU
C6
I 2.3
I 2.3
CD
C6
CD
C6
I 2.4
I 2.4
KC 4
C# 4
C6
C6
I 2.5
I 2.5
C6
C6
Preset
I 2.7
I 2.7
counter to
KC 6
C# 6
value
C6
C6
and counter
delete
Query
(KC =
(C=
1 to 999)
1 to 999 )
C6
C6
counter bit
(is "1" if counter is
is not equal to
zero)
Load current
C6
counter value
C6
(S5: binary,
FW 30
MW 30
LD
C6
LC
C6
FW32
MW32
S7: integer)
Load current
counter value
(BCD)
6.
TIMERS
The S5TIME data type is stored in binary-coded decimal format (BCD). When you are working with
the S5TIME data type, you define a time value in the range from 0 to 999 and a time base.
The time base indicates the interval with which a time decrements the time value by "1" until the time
value "0" is reached.
Binary structure of the S5TIME data type
15
14
13
12
11
10
a3
a3
a3
a3
a2
a2
a2
a2
a1
a1
a1
a1
Time base
Binary code
Possible range
10 ms
00
10 ms - 9 s 990 ms
100 ms
01
1s
10
1 s - 16 min 39 s
10 s
11
10 s - 2 hr 46 min 30 s
10
7.
LINKING OPERATIONS
The following table lists the operands in STEP 5 and their STEP 7 equivalents.
FW
MW
IW
Input word
IW
Input word
QW
Output word
QW
Output word
DW
DB_
data block
IN
Input parameter of
an FC or FB
IN_OUT
Through
parameter of an
FC or FB
OUT
Output parameter
of an FC or FB
Temporary
variable, local
data
DIX
Static variable of
an FB
11
The following table lists the linking operations in STEP 5 and their STEP 7 equivalents.
STEP 5
STEP 7
Operation
Operand
Operation
Operand
Link words
IN1
IN10
with AND,
IN1
IN20
OR and
AW OW
EXCLUSIVE
OR
AW
XOW
T
OUT
OUT
IN1
IN10
IN1
IN20
OW
OW
OUT
OUT
IN1
IN10
IN1
IN20
XOW
T
XOW
OUT
OUT
IN1,IN1=
IN10,IN20=
IW,QW,FW,DW,KF,KM,KH
IW,QW,MW,DW,IN,
IN_OUT,constant
OUT=
QW,FW,DW
OUT=
QW,MW,DDW,DIW,OUT,
IN_OUT
Link double-
Not
IN30
words
possible
IN40
12
with AND,
AD
OR and
OUT
IN30
IN40
EXCLUSIVE
OR
OD
T
OUT
IN30
IN40
XOD
T
OUT
IN30,IN40=
ID,QD,MD,DBD,DID,
IN,IN_OUT,constant
OUT=
QW,MW,DDD,DID,OUT,
IN_OUT
8.
CONVERSION OF STRINGS
The converter that is part of the Basic Package, converts the data formats of the STEP5 program
correctly. The word-oriented DB in STEP5 is converted into a byte-oriented DB in STEP7. String data
types (STEP5 type 'KC' or 'C') are stored differently in STEP7. The first two bytes contain a length
code. A converted program block doesn't take this code into account and accesses incorrectly, i.e.
offset by 2 bytes.
In the S5, with absolute addressing, the data is accessed in a DB. When converting to S/ this cannot
be converted automatically. Therefore, after conversion, you must adjust the appropriate program
settings manually in S7.
13
9.
CONVERSION OF BLOCKS
STEP 7 includes a S5/S7 converter which can be used to convert S5 to S7 programs as complete as
possible. This converter has certain particularities:
Converting special commands for CPUs of the SIMATIC S5 135U and SIMATIC S5 155U
series is not possible.
This applies to access to the area system data of the CPU (e.g.: L BS 0..255 / T BS 0..255).
The modules in the library "S5-S7 Converting Blocks" (visible in the SIMATIC Manager
with File > Open > Libraries in "Standard Library") are intended only for conversions of
existing S5 programs to S7 programs. They cannot be used in newly created S7 programs.
This STEP 7 library offers the following standard solutions:
Name
Explanation
Number
GP_ADD
FC 63
GP_DIV
FC 66
GP_FPGP
FC 61
GP_GPFP
FC 62
GP_MUL
FC 65
GP_SUB
FC 64
GP_VGL
FC 67
RAD_GP
FC 68
Signal functions:
Name
Explanation
Number
MLD_ED
FC 76
bitwise, A
MLD_EDK
FC 80
bitwise, A+M
MLD_EDW
FC 72
wordwise, A
MLD_EDWK
14
FC 78
wordwise, A+M
MLD_EZ
FC 75
bitwise, A
MLD_EZK
FC 79
bitwise, A+M
MLD_EZW
FC 71
wordwise, A
MLD_EZWK
FC 77
wordwise, A+M
MLD_SAM
FC 74
MLD_SAMW
FC 73
MLD_TG
Clock generator
FC 69
MLD_TGZ
FC 70
Integrated functions:
Name
Explanation
Number
COD_B4
FC 81
COD_16
FC 82
MUL_16
FC 83
DIV_16
FC 84
Calculating functions:
Name
Explanation
Number
ADD_32
FC 85
DIV_32
FC 88
MUL_32
FC 87
RAD_16
FC 89
SUB_32
FC 86
Name
Explanation
Number
REG_FIFO
FC 92
Registry functions:
15
REG_LIFO
FC 93
REG_SCHB
FC 90
REG_SCHW
FC 91
Name
Explanation
Number
DB_COPY1
FC 94
DB_COPY2
FC 95
parameterization
Special functions:
Name
Explanation
Number
LADEN
FC 97
RETTEN
FC 96
COD_B8
FC 98
COD_32
FC 99
Name
Explanation
Number
AE_460_1
FC 100
AE_460_2
FC 101
AE_463_1
FC 102
AE_463_2
FC 103
AE_464_1
FC 104
AE_464_2
FC 105
AE_466_1
FC 106
AE_466_2
FC 107
PER_ET1
FC 110
assignment of parameters)
PER_ET2
FC 111
assignment of parameters)
RLG_AA1
FC 108
16
RLG_AA2
FC 109
Note:
When using the standard functions FC100-FC111, the peripherial addresses are to be observed (see also
online help for these blocks). The refreshment of the process image depends on the S7 CPU. If you assign
a partly peripherial address (between 1 and 8) to the address, these addresses are not taken into account
in the cyclic refreshment of the process image.
Mathematical functions:
Name
Explanation
Number
A2_H_A1
FC 125
ARCCOS
FC 117
ARCCOT
FC 119
ARCSIN
FC 116
ARCTAN
FC 118
B_LOG_X
FC 122
COSINUS
Cosine (x)
FC 113
COTANG
Cotangent (x)
FC 115
E_H_N
e to the power of n
FC 123
LG_X
FC 121
LN_X
FC 120
SINUS
Sine (x)
FC 112
TANGENS
Tangent (x)
FC 114
ZEHN_H_N
10 to the power of n
FC 124
17
Fig. 1: Overview
diagram of
values
transferred
between the
groups
Definition of tags:
a = Output value of S5 analog input module
b = Output value of S5 processing
c = Output value after analog output module
d = Output value of S7 analog input module
e = Converted value for output to S7 analog output module
X = Units (resolution) of S5 analog module
Y = Units (resolution) of S7 analog module
18
If you use an S5 standard interface with a resolution of 2048 units, the following conversion factor applies:
Formula 3: General formula for converting output values from the S7 input module
You replace an S5 analog input module AE460 with an ET 200S. Furthermore, you replace the S5 analog
output module with an S7 module. In the S5 program you use the evaluation with the R64 block. To be able
to continue using the calculation with the existing program, before processing the analog value in the S5
controller, you have to convert the new input signal.
Now you can no longer connect the analog values directly with the input of the R64 block. The value from
the analog module has to be converted with a factor (this factor cannot be set with the COM REG
parameter) and has to be preset on the block as R64 analog format. Once the output values have been
19
calculated by the R64 block, you must once again convert the R64 analog format values with a factor and
then output them to the S7 analog output module.
As described above, the R64 block works with a resolution of 16384 units (analog format). Therefore you
have to recalculate the conversion factor. The combination of formulas 3 and 4 applies.
Formula 5: Conversion for output values of the S7 module when using the R64 block
20
Fig. 01
If the program is now converted to STEP 7, then when bits 12 to 15 are used by STEP 7 the system
changes the addresses.
Fig. 01 shows an example of a bit pattern "W#16#221". After conversion, the address "33.2" is calculated.
Fig. 02
21
Fig. 02 shows the same program, but with the bit pattern"W#16#1221". The leading "1" is not evaluated by
STEP 5. After conversion, however, the address "35.2" is calculated by STEP 7. The reason for this is that
the leading "1" at the bit point is placed by the system in the byte address with value 2.
Fig. 03
Remedy:
If you can't ensure that bits 12 to 15 are not used, then change the two move commands as follows.
Fig. 04
22
Meaning
TI
Time constant
TD
Derivative time
KP
Proportional coefficient
TV
Derivative time
TN
Reset time
TA
Sample time
T1
D component lag
Meaning
TI
Gain
TD
Derivative time
TM_LAG
D component lag
Controlling
Conversion
S5
S7
S5 -> S7
KP x R
Gain
Gain = KP x R
Remarks
TI = TA :
TI = TN
TN
TI(S7) = TA :
TI(S5)
TD = TV :
TD (S7) =
TD(S7) =
TA
TV
TD(S5) x TA
T1
TM_LAG
TM_LAG = 1
23
24