SIMATIC Instructions
Convert Example
Network 1
I0.0
C10
AC1
VD0
VD4
VD8
Network 2
I3.0
AC0
Network 1
I_DI
I0.0
EN
C10
IN
Network 2
BCD_I
I3.0
EN
AC0
IN
C10
VD0
VD4
VD8
V12
Figure 9-42
9-134
LAD
To convert from an
integer to a real number:
I_DI
Clear accumulator 1.
EN
ENO
Load counter value
(number of inches)
IN
OUT
AC1
into AC1.
DI_R
EN
ENO
Convert to a real number.
IN
OUT
VD0
MUL_R
EN
ENO
Multiply by 2.54 to change
IN1
OUT
VD8
to centimeters.
IN2
ROUND
EN
ENO
Convert back to an integer.
IN
OUT
VD12
BCD_I
EN
ENO
IN
OUT
AC0
DI_R
ENO
EN
ENO
OUT
AC1
AC1
IN
OUT
ENO
OUT
AC0
Double Word Integer to Real and Round
101
Count = 101 inches
101.0
2.54
2.54 constant (inches to centimeters)
256.54
256.54 centimeters as real number
257
257 centimeters as integer
Example of Conversion Instructions for SIMATIC LAD, STL, and FBD
Network 1
LD
ITD
DTR
MOVR
*R
ROUND
Network 2
LD
BCDI
FBD
MUL_R
EN
ENO
IN1
OUT
VD0
VD8
VD0
VD4
IN2
Application
S7-200 Programmable Controller System Manual
STL
I0.0
C10, AC1
AC1, VD0
VD0, VD8
VD4, VD8
VD8, VD12
I3.0
AC0
ROUND
EN
ENO
VD8
IN
OUT
VD12
BCD to Integer
AC0
1234
BCDI
AC0
04D2
A5E00066097-02