
Programming Examples
Ladder Logic (LAD) for S7-300 and S7-400 Programming
A5E00706949-01
B-13
B.5 Example: Integer Math Instructions
Solving a Math Problem
The sample program shows you how to use three integer math instructions to
produce the same result as the following equation:
MW4 = ((IW0 + DBW3) x 15) / MW0
Ladder Logic Program
Network 1: Open Data Block DB1.
OPN
DB1
Network 2: Input word IW0 is added to shared data word DBW3 (data block must
be defined and opened) and the sum is loaded into memory word MW100. MW100
is then multiplied by 15 and the answer stored in memory word MW102. MW102 is
divided by MW0 with the result stored in MW4.
ADD_I
IN1
ENO
EN
IN2
OUT
DBW3
IW0
MW100
MUL_I
IN1
ENO
EN
IN2
OUT
MW100
15
MW102
DIV_I
IN1
ENO
EN
IN2
OUT
MW102
MW0
MW4
Comments to this Manuals