Add, Subtract, Multiply And Divide Instructions - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Basic instructions
7.5 Math functions
Note
You also must create an input for any constants in your function. The constant value would
then be entered in the associated input for the CALCULATE instruction.
By entering constants as inputs, you can copy the CALCULATE instruction to other locations
in your user program without having to change the function. You then can change the values
or tags of the inputs for the instruction without modifying the function.
When CALCULATE is executed and all the individual operations in the calculation complete
successfully, then the ENO = 1. Otherwise, ENO = 0.
7.5.2

Add, subtract, multiply and divide instructions

Table 7- 38
Add, subtract, multiply and divide instructions
LAD / FBD
SCL
out := in1 + in2;
out := in1 - in2;
out := in1 * in2;
out := in1 / in2;
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
1
Table 7- 39
Data types for the parameters (LAD and FBD)
Parameter
Data type
IN1, IN2
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal, Constant
OUT
SInt, Int, DInt, USInt, UInt, UDInt, Real, LReal
Parameters IN1, IN2, and OUT must be the same data type.
1
To remove an input, right-click on an input stub for one of the existing IN parameters (when
there are more than the original two inputs) and select the "Delete" command.
When enabled (EN = 1), the math instruction performs the specified operation on the input
values (IN1 and IN2) and stores the result in the memory address specified by the output
parameter (OUT). After the successful completion of the operation, the instruction sets ENO
= 1.
230
Description
ADD: Addition (IN1 + IN2 = OUT)
SUB: Subtraction (IN1 - IN2 = OUT)
MUL: Multiplication (IN1 * IN2 = OUT)
DIV: Division (IN1 / IN2 = OUT)
An Integer division operation truncates the fractional part of the quotient
to produce an integer output.
1
To add an ADD or MUL input, click the "Create" icon or right-click on an input
stub for one of the existing IN parameters and select the "Insert input" command.
Description
Math operation inputs
Math operation output
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents