8.3
Basic Instructions
8.3.1
ADD_R Add Real
Symbol
ADD_R
EN
OUT
IN2
ENO
IN1
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN1
REAL
I, Q, M, L, D
or constant
First value for addition
IN2
REAL
I, Q, M, L, D
or constant
Second value for addition
OUT
REAL
I, Q, M, L, D
Result of addition
Description
ADD_R (Add Real) is activated by a logic "1" at the Enable (EN) Input. IN1 and IN2 are added and
the result can be scanned at OUT. If the result is outside the permissible range for a floating-point
number (overflow or underflow), the OV bit and OS bit will be "1" and ENO is "0", so that other
functions after this math box which are connected by the ENO (cascade arrangement) are not
executed.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.3 Basic Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
90
Reference Manual, 04/2017, A5E41524738-AA
Example
ADD_R
EN
OUT
IN2
ENO
IN1
MD4
MD0
MD10
I 0.0
NOT
S
Q 4.0
The ADD_R box is activated by logic "1" at I0.0. The result of the addition MD0 + MD4 is output to
MD10. If the result was outside the permissible range for a floating-point number or if the program
statement was not processed (I0.0 = 0), the output Q4.0 is set.
Floating Point Math Instructions
8.3 Basic Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
91
8.3.2
SUB_R Subtract Real
Symbol
SUB_R
EN
OUT
IN2
ENO
IN1
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN1
REAL
I, Q, M, L, D
or constant
First value for subtraction
IN2
REAL
I, Q, M, L, D
or constant
Value to subtract
OUT
REAL
I, Q, M, L, D
Result of subtraction
Description
SUB_R (Subtract Real) is activated by a logic "1" at the Enable (EN) Input. IN2 is subtracted from
IN1 and the result can be scanned at OUT. If the result is outside the permissible range for a
floating-point number (overflow or underflow), the OV bit and OS bit will be "1" and ENO is logic
"0", so that other functions after this math box which are connected by the ENO (cascade
arrangement) are not executed.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Example
SUB_R
EN
OUT
IN2
ENO
IN1
MD4
MD0
MD10
I 0.0
NOT
S
Q 4.0
The SUB_R box is activated by logic "1" at I0.0. The result of the subtraction MD0 - MD4 is output
to MD10. If the result was outside the permissible range for a floating-point number or if the
program statement was not processed, the output Q4.0 is set.
Floating Point Math Instructions
8.3 Basic Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
92
Reference Manual, 04/2017, A5E41524738-AA
8.3.3
MUL_R Multiply Real
Symbol
MUL_R
EN
OUT
IN2
ENO
IN1
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN1
REAL
I, Q, M, L, D
or constant
First value for multiplication
IN2
REAL
I, Q, M, L, D
or constant
Second value for multiplication
OUT
REAL
I, Q, M, L, D
Result of multiplication
Description
MUL_R (Multiply Real) is activated by a logic "1" at the Enable (EN) Input. IN1 and IN2 are
multiplied and the result can be scanned at OUT. If the result is outside the permissible range for a
floating-point number (overflow or underflow), the OV bit and OS bit will be "1" and ENO is logic
"0", so that other functions after this math box which are connected by the ENO (cascade
arrangement) are not executed.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Example
MUL_R
EN
OUT
IN2
ENO
IN1
MD4
MD0
MD10
I 0.0
NOT
S
Q 4.0
The MUL_R box is activated by logic "1" at I0.0. The result of the multiplication MD0 x MD4 is
output to MD0. If the result was outside the permissible range for a floating-point number or if the
program statement was not processed, the output Q4.0 is set.
Floating Point Math Instructions
8.3 Basic Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
93
8.3.4
DIV_R Divide Real
Symbol
DIV_R
EN
OUT
IN2
ENO
IN1
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN1
REAL
I, Q, M, L, D
or constant
Dividend
IN2
REAL
I, Q, M, L, D
or constant
Divisor
OUT
REAL
I, Q, M, L, D
Result of division
Description
DIV_R (Divide Real) is activated by a logic "1" at the Enable (EN) Input. IN1 is divided by IN2 and
the result can be scanned at OUT. If the result is outside the permissible range for a floating-point
number (overflow or underflow), the OV bit and OS bit is "1" and ENO is logic "0", so that other
functions after this math box which are connected by the ENO (cascade arrangement) are not
executed.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Example
DIV_R
EN
OUT
IN2
ENO
IN1
MD4
MD0
MD10
I 0.0
NOT
S
Q 4.0
The DIV_R box is activated by logic "1" at I0.0. The result of the division MD0 by MD4 is output to
MD10. If the result was outside the permissible range for a floating-point number or if the program
statement was not processed, the output Q4.0 is set.
Floating Point Math Instructions
8.3 Basic Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
94
Reference Manual, 04/2017, A5E41524738-AA
8.3.5
ABS Establish the Absolute Value of a Floating-Point Number
Symbol
ABS
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D or
constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: absolute value of the
floating-point number
Description
ABS establishes the absolute value of a floating-point number.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
1
-
-
-
-
0
1
1
1
Example
MD8
ABS
IN
OUT
MD12
I 0.0
Q 4.0
ENO
EN
NOT
If I0.0 = "1", the absolute value of MD8 is output at MD12.
MD8 = + 6.234 gives MD12 = 6.234. Output Q4.0 is "1" when the conversion is not executed (ENO
= EN = 0).
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
95
8.4
Extended Instructions
8.4.1
SQR Establish the Square
Symbol
SQR
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: square of floating-point
number
Description
SQR establishes the square of a floating-point number.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
96
Reference Manual, 04/2017, A5E41524738-AA
8.4.2
SQRT Establish the Square Root
Symbol
SQRT
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: square root of floating-
point number
Description
SQRT establishes the square root of a floating-point number. This instruction issues a positive
result when the address is greater than "0". Sole exception: the square root of -0 is -0.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
97
8.4.3
EXP Establish the Exponential Value
Symbol
EXP
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: exponential value of the
floating-point number
Description
EXP establishes the exponential value of a floating-point number on the basis e (=2,71828...).
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
98
Reference Manual, 04/2017, A5E41524738-AA
8.4.4
LN Establish the Natural Logarithm
Symbol
LN
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: natural logarithm of the
floating-point number
Description
LN establishes the natural logarithm of a floating-point number.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
99
8.4.5
SIN Establish the Sine Value
Symbol
SIN
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: sine of the floating-point
number
Description
SIN establishes the sine value of a floating-point number. The floating-point number represents an
angle in a radian measure here.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
100
Reference Manual, 04/2017, A5E41524738-AA
8.4.6
COS Establish the Cosine Value
Symbol
COS
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: cosine of the floating-
point number
Description
COS establishes the cosine value of a floating-point number. The floating-point number represents
an angle in a radian measure here.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
101
8.4.7
TAN Establish the Tangent Value
Symbol
TAN
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: tangent of the floating-
point number
Description
TAN establishes the tangent value of a floating-point number. The floating-point number represents
an angle in a radian measure here.
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
102
Reference Manual, 04/2017, A5E41524738-AA
8.4.8
ASIN Establish the Arc Sine Value
Symbol
ASIN
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: arc sine of the floating-
point number
Description
ASIN establishes the arc sine value of a floating-point number with a definition range -1 <= input
value <= 1. The result represents an angle in a radian measure within the range
-π/2 ≤ output value ≤ +π/2
where π = 3.1415....
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
103
8.4.9
ACOS Establish the Arc Cosine Value
Symbol
ACOS
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: arc cosine of the floating-
point number
Description
ACOS establishes the arc cosine value of a floating-point number with a definition range -1 <=
input value <= 1. The result represents an angle in a radian measure within the range
0 ≤ output value ≤ +π
where π = 3.1415....
See also Evaluating the Bits of the Status Word.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
x
x
x
x
x
0
x
x
1
Floating Point Math Instructions
8.4 Extended Instructions
Ladder Logic (LAD) for S7-300 and S7-400 Programming
104
Reference Manual, 04/2017, A5E41524738-AA
8.4.10
ATAN Establish the Arc Tangent Value
Symbol
ATAN
EN
OUT
IN
ENO
Parameter
Data Type
Memory Area
Description
EN
BOOL
I, Q, M, L, D
Enable input
ENO
BOOL
I, Q, M, L, D
Enable output
IN
REAL
I, Q, M, L, D
or constant
Input value: floating-point
OUT
REAL
I, Q, M, L, D
Output value: arc tangent of the
floating-point number
Dostları ilə paylaş: |