100BBasic instructions
7.5 Math
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
193
●
EXP: Natural exponential (e
IN
=OUT), where base e = 2.71828182845904523536
●
EXPT: General exponential (IN1
IN2
= OUT)
EXPT parameters IN1 and OUT are always the same data type, for which you must
select Real or LReal. You can select the data type for the exponent parameter IN2 from
among many data types.
●
FRAC: Fraction (fractional part of floating point number IN = OUT)
●
SIN: Sine (sin(IN radians) = OUT)
ASIN: Inverse sine (arcsine(IN) = OUT radians), where the sin(OUT radians) = IN
●
COS: Cosine (cos(IN radians) = OUT)
ACOS: Inverse cosine (arccos(IN) = OUT radians), where the cos(OUT radians) = IN
●
TAN: Tangent (tan(IN radians) = OUT)
ATAN: Inverse tangent (arctan(IN) = OUT radians), where the tan(OUT radians) = IN
Table 7- 59 Examples of floating-point math instructions
LAD / FBD
SCL
Description
out := SQR(in);
or
out := in * in;
Square: IN
2
= OUT
For example: If IN = 9, then OUT = 81.
out := EXPT(in1, in2);
or
out := in1 ** in2;
General exponential: IN1
IN2
= OUT
For example: If IN1 = 3 and IN2 = 2, then OUT = 9.
1
For LAD and FBD: Click the "???" (by the instruction name) and select a data type from the drop-down menu.
2
For SCL: You can also use the basic SCL math operators to create the mathematical expressions.
Table 7- 60 Data types for parameters
Parameter
Data type
Description
IN, IN1
Real, LReal, Constant
Inputs
IN2
SInt, Int, DInt, USInt, UInt,UDInt, Real, LReal, Constant
EXPT exponent input
OUT
Real, LReal
Outputs
Table 7- 61 ENO status
ENO
Instruction
Condition
Result (OUT)
1
All
No error
Valid result
Result exceeds valid Real/LReal range
+INF
SQR
IN is +/- NaN (not a number)
+NaN
0
SQRT
IN is negative
-NaN