Math Instructions; Add, Subtract, Multiply, And Divide Instructions - Siemens Simatic S7-200 System Manual

Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

S7-200 Programmable Controller System Manual

Math Instructions

Add, Subtract, Multiply, and Divide Instructions

Add
IN1 + IN2 = OUT
IN1 + OUT = OUT
The Add Integer (+I) or Subtract Integer (–I) instructions add or
subtract two 16-bit integers to produce a 16-bit result. The Add
Double Integer (+D) or Subtract Double Integer (–D) instructions add
or subtract two 32-bit integers to produce a 32-bit result. The Add
Real (+R) and Subtract Real (–R) instructions add or subtract two
32-bit real numbers to produce a 32-bit real number result.
Multiply
IN1 * IN2 = OUT
IN1 * OUT = OUT
6
The Multiply Integer (*I) or Divide Integer (/I) instructions multiply or
divide two 16-bit integers to produce a 16-bit result. (For division, no
remainder is kept.) The Multiply Double Integer (*D) or Divide Double
Integer (/D) instructions multiply or divide two 32-bit integers to
produce a 32-bit result. (For division, no remainder is kept.) The
Multiply Real (*R) or Divide Real (/R) instructions multiply or divide
two 32-bit real numbers to produce a 32-bit real number result.
SM Bits and ENO
SM1.1 indicates overflow errors and illegal values. If SM1.1 is set,
then the status of SM1.0 and SM1.2 is not valid and the original
input operands are not altered. If SM1.1 and SM1.3 are not set, then
the math operation has completed with a valid result and SM1.0 and
SM1.2 contain valid status. If SM1.3 is set during a divide operation,
then the other math status bits are left unchanged.
Error conditions that set ENO = 0
H SM1.1 (overflow)
H SM1.3 (divide by zero)
H 0006 (indirect address)
Table 6-37
Inputs/Outputs
IN1, IN2
OUT
Real (or floating-point) numbers are represented in the format described in the ANSI/IEEE 754–1985 standard
(single-precision). Refer to that standard for more information.
140
Subtract
IN1 – IN2 = OUT
OUT – IN1 = OUT
Divide
IN1 / IN2 = OUT
OUT / IN1 = OUT
Special Memory bits affected
H SM1.0 (zero)
H SM1.1 (overflow, illegal value generated during the operation, or illegal
H SM1.2 (negative)
H SM1.3 (divide by zero)
Valid Operands for Add, Subtract, Multiply, and Divide Instructions
Data Types
Operands
INT
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *AC, *LD, Constant
DINT
ID, QD, VD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC, Constant
REAL
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
INT
IW, QW, VW, MW, SMW, SW, LW, T, C, AC, *VD, *AC, *LD
DINT, REAL
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
LAD and FBD
STL
LAD and FBD
STL
input parameter found)

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents