STD-FB - Mathematische Funktionen - CPU922 - 928 - 946-947 - (E) - OCR
STD-FB - Mathematische Funktionen - CPU922 - 928 - 946-947 - (E) - OCR
STD-FB - Mathematische Funktionen - CPU922 - 928 - 946-947 - (E) - OCR
Mathematical Functions
Standard Function Blocks
CPU 922, 928, 9461947
Description C79000-B8576-C667-01
Mathematical Functions Contents
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1.1
2 Function Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2.1
O Siemens AG C79000-B8576-C667701
List of Tables Mathematical Functions
List of Tables
O Siemens AG C79000-B8576-C667-01
Mathematical Functions Introduction
1 Introduction
3 Siemens AG C79000-B8576-C667-01
C
Mathematical Functions Function Description
2 Function Description
General
Error handling
Q Siemens AG C79000-B6576-C667-01
Mathematical Functions Function Description
O SiemensAG C79000-89576-C667-01
Mathematical Functions Interrupt Response
3 lnterrupt Response
:L KB2
:L KB5
AU OB 120 Disable interrupts
:L KB3
:L KB5
U OB 120 Enable interrupts
C3 Siemens AG C79000-B8576-C667701
Interrupt Response Mathematical Functions
:L KB1
;IU OB 122 Disable intermpts
:L KB2
:JU OB 122 Enable interrupts
When saving the buffer area, the system data used are saved
at the beginning of the interrupt-controlled program into a data
block (similar to the scratchpad flags) and loaded again at the
end of the interrupt-controlled program.
U FB 101 Mathematicalfunctions
NAME :SINUS
:C DB n Callbuffermemory
;IU FB37 Loadsystem data area
NAME :DB +RI
Q Siemens AG C790M)-B8576-C667-01
Mathematical Functions Interrupt Response
FB 36 FB 37
FB 36 FB 37
:TIR 6 :TIR 6
ADD BN +26 ADD BN +26
:L RI 229 :L RI 229
:SLD 4 :SLD 4
ADD DH 0000 0019 ADD DH 0000 0019
:TNW 26 :TAK
:BE :lNW 26
:BE
O Siemens AG C79000-58576-C667-01
Mathematical Functions Technical Data
4 Technical Data
Block Lib. No.: Block Runtime (ms) Scratchpadflag System data Lib. No.
No. Name P71200-S.. lengtt CPU CPU assignment assignment (L1MT23
922 928 ST.S5D)
FB 101 SINUS -9101-D-01 242 3.8 2.4 FY 246 - FY 255 R1243 - R1255 906
FB 102 COSINUS -9102-D-01 238 3.8 2.4 FY 246 - P/ 255 R1243 - R1255 906
FB 103 TAN- -9103-D-01 318 4.0 2.5 FY 246 - FY 255 R1243 - R1 255 906
FB 104 GENS- -9104-D-01 321 4.0 2.5 FY 246- FY 255 R1243- R1255 906
COTANG
FB 105 ASCSIN -9105-D-01 218 3.5 2.2 P/ 246- P/ 255 R1243 - R1255 907
FB 106 ARCCOS -9106-D-01 253 3.7 2.3 FY 246- FY 255 R1243 - R1255 910
FB 107 ARCTAN -9107-D-01 268 4.2 2.6 FY 246- FY 255 R1243 - R1255 913
FB 108 ARCCOT -9108-D-01 269 4.3 2.7 FY 246 - FY255 R1243 - R1255 913
FB 109 LNX -9109-D-01 222 4.3 2.9 FY 244 - FY 255 R1242 - R1 255 906
FBI10 LGX -91 10-D-01 222 4.3 2.9 FY244- W 2 5 5 R1242- R1 255 906
FB 111 B LOG X -91 11-D-01 274 7.6 5.1 FY 236 - FY 255 R1236 - R1 255 906
FBI12 EAX -9112-D-01 253 4.5 3.0 FY 246 - FY 255 R1243 - R1255 913
FB 113 ZEHNAX -9113-D-01 260 4.6 3.1 FY 246 - FY 255 R1243 - R1 255 906
FB 114 A2"Al -9114-D-01 418 7.4 4.9 FY 244 - FY 255 R1242 - R1255 906
Table 4.1 Technical data for CPU 922 and CPU 928
O Siemens AG C790MTB8576-C667-01
Technical Data Mathematical Functions
CPU 9461947
FB 105 ASCSIN -6105-D-01 203 0.35 FY 246 - FY 255 RI 243 - R1 255 910
FB 106 ARCCOS -6106-D-01 238 0.35 FY 246 - FY 255 R1 243 - R1 255 910
FB 107 ARCTAN -6107-D-01 260 0.45 FY246-FY255 R1243-R1255 913
FB 108 ARCCOT -6108-D-01 265 0.45 FY 246 - FY 255 R1 243 - R1 255 913
FBI12 EAX -6112-D-01 236 0.50 FY 246 - FY 255 R1 243 - R1 255 913
FB 113 ZEHNAX -6113-D-01 243 0.50 FY 246 - FY 255 R1 243 - R1 255 830
FB 114 A2"Al -6114-D-01 391 0.90 FY 244 - FY 255 R1 242 - R1 255 906
8 Siemens AG C79000-08576-'2667-01
Mathematical Functions Description of Individual Function Blocks
Sine (X)
:L KG (X) Input value
:JU FB 101 Sine (X)
NAME :SINUS
:= Fx.y Errorflag l )
:T xx Result present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is not
within the range from 0 to 2 X ) . The contents of accumulator 1
then remain unchanged.
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
8 Siemens AG C79000-08576-C667-01
Description of Individual Function Blocks Mathematical Functions
Cosine (X)
:L KG (X) Input value
:JU FB 102 Cosine (X)
NAME :COSINUS
:= Fx.y Error flag l )
:T xx Resutt present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is not
within the range from 0 to 2 K ) . The contents of accumulator 1
then remain unchanged.
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
O Siemens AG C79000-B8576-(2667-01
Mathematical Functions Description of Individual Function Blocks
Tangent (X)
:L KG (X) Input value
:JU FB 103 Tangent (X)
NAME :TANGENS
:= Fx.y Error flag l )
:T xx Result present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1". The contents of
accumulator 1 then remain unchanged. One of the following
errors is present:
The input value is not within the range from 0 to 2 . 7 ~ .
The number range was exceeded during calculation of the
function.
The input value is d 2 (KG = +l570796 +01) or 3 . x 12 (KG
= +4712389 +01). The f~nction~value is then infinite and the
function block signals an error. )
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
2) The numbers specified apply to a calculation with a 24-bit mantissa. With a
16-bit mantissa, an error is signalled in the ranges KG = +l570740 +01 to
+l570801 +01 and KG = +4712158 +01 to +4712402 +01.
O Siemens AG C79000-68576-C667-01
Description of Individual Function Blocks Mathematical Functions
Cotangent (X)
:L KG (X) Input value
:JU FB 104 Cotangent (X)
NAME :COTANG
:= Fx.y Error flag l )
:T xx Result present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1".The contents of
accumulator 1 then remain unchanged. One of the following
errors is present:
The input value is not within the range from KG = +2938734
-34 to KG = +6283184 +01.2)
The number range was exceeded during calculation of the
function.
The input value is 0, .rc (KG = +3141593 +01) or 2 x (KG
= +6283185 +01). The function value is then infinite and the
function block signals an error.3)
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
2) All central processors calculate the function value within the defined limits.
The range can be expanded slightly depending on the CPU used or on
whether the calculation is carried out with a l b b i t or 24-bit mantissa.
3) The numbers specified apply to a calculation with a 24-bit mantissa. With a
16-bit mantissa, an error is signalled in the range KG = +3141479 +01 to
+3141602 +01.
Q Siemens AG C79000-58576-C667-01
Mathematical Functions Description of Individual Function Blocks
The flags are set in the same manner as in the general function
description (see above).
O Siemens AG C79000-68576-C667-01
Description of Individual Function Blocks Mathematical Functions
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is not
within the range from -1 to +l). The contents of accumulator 1
then remain unchanged.
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
O Siemens AG C79000-B8576-C667-01
Mathematical Functions Description of Individual Function Blocks
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is not
within the range from -1 to +l). The contents of accumulator 1
then remain unchanged.
The flags are set in the same manner as in the general function
description (see above).
1 ) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
O Siemens AG C79000-B8576-C667-01
Description of Individual Function Blocks Mathematical Functions
Accumulator assignments
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
C
2 Siemens AG C79000-B8576-C667-01
Mathematical Functions Description of Individual Function Blocks
Accumulator assignments
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
Q Siemens AG C79000-88576-C667-01
Description of Individual Function Blocks Mathematical Functions
Napierian logarithm
loge (X)
:L KG (X) Input value
:JU FB 109 Napierian logarithm loge (X)
NAME :LN X
:= Fx.y Error flag l )
:T xx Resutt present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is less
than or equal to 0). The contents of accumulator 1 then remain
unchanged.
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
C3 Siemens AG C790M)-B8576-C667-01
Mathematical Functions Description of Individual Function Blocks
Decimal logarithm
log10 (X)
:L KG (X) Input value
:JU FB 110 Decimal logarithm log10 (X)
NAME :LG X
:= Fx.y Errorflag
:T xx Result present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is less
than or equal to 0). The contents of accumulator 1 then remain
unchanged.
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
Description of Individual Function Blocks Mathematical Functions
General logarithm
log (X) to base b
:L KG (b) lnput value (base)
:L KG (X) Input value (number)
:JU FB 111 General logariihm log (X)to base b
NAME :B LOG X
:= F x.y Error flag l)
:T xx Result present in accumulator 1
Accumulator assignments
The function block expects the input value for the base (b) in
accumulator 2 and the input value for the number (X) in
accumulator 1, both as 24132-bit floating-point numbers. Both
input values must be greater than zero; in addition, the base
must not have a value of +l. The function block also stores the
result in accumulator 1 as a 24132-bit floating-point number.
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (ifthe input value is less
than or equal to 0 or if the base has a value of +l). The
contents of the accumulators then remain unchanged.
The flags are set in the same manner as in the general function
description (see above).
l)Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
Q Siemens AG C79000-58576-C667-01
Mathematical Functions Description of Individual Function Blocks
e to power n
:L KG (X) Input value
:JU FBI12 etopowern
NAME :EAN
:= Fx.y Errorflag l)
:T xx Result present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is not
within the range from KG = -8802962 +02 to KG = +8802966
+02; the function value would then be outside the numeric
range). The ntents of accumulator 1 then remain
unchanged. f?
The assignments of the other registers and of the scratchpad
flags are not changed.
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
2) All central processors calculate the function value within the defined limits.
The range can be expanded slightly depending on the CPU used or on
whether the calculation is carried out with a 16-bit or 24-bit mantissa.
O Siemens AG C79000-58576-C667-01
Description of Individual Function Blocks Mathematical Functions
10 to power n
:L KG (n) Input value
:JU FBI13 10topowern
NAME :ZEHNAN
:= Fx.y Errorflag
:T xx Resutt present in accumulator 1
Accumulator assignments
In the event of an error, the function block sets the result of the
logic operation to a signal state "1" (if the input value is not
within the range from KG = -3823079 +02 to KG = +3823080
+02; the function value would then be outside the numeric
range). The ontents of accumulator 1 then remain
unchanged.27
The flags are set in the same manner as in the general function
description (see above).
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
2) All central processors calculate the function value within the defined limits.
The range can be expanded slightly depending on the CPU used or on
whether the calculation is carried out with a 16-bit or 24-bit mantissa.
O Siemens AG C79000-68576-C667-01
Mathematical Functions Description of Individual Function Blocks
Accumulator 2 to power
accumulator l
:L KG (a2) Input value (base)
:L KG (al) Input value (exponent)
:JU F6 114 Accumulator 2 to power accumulator 1
NAME :A2AA1
:= Fx.y Errorflag l )
:T xx Result present in accumulator 1
Accumulator assignments
The function block expects the input value for the base in
accumulator 2 and the input value for the exponent in
accumulator 1, both as 24132-bit floating-point numbers. The
input value for the base must be positive. The function block
also stores the result in accumulator 1 as a 24132-bit
floating-point number.
1) Error analysis is also possible using the result of the logic operation with a
conditional jump JC or using the overflow bit Ov with a jump with overflow
JO.
C
B Siemens AG C79000-68576-C667-01
Description of Individual Function Blocks Mathematical Functions
The flags are set in the same manner as in the general function
description (see above).
O Siemens AG C79000-68576-C667-01